@arcgis/coding-components 5.2.0-next.10 → 5.2.0-next.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cdn/{QRQEHI3E.js → 3QN6NREQ.js} +1 -1
  2. package/dist/cdn/{PE22Q7FG.js → 76VHPECE.js} +1 -1
  3. package/dist/cdn/{3LFA3ZUC.js → 7UTCJERR.js} +1 -1
  4. package/dist/cdn/{3RKKHGVW.js → A6IGYBAZ.js} +2 -2
  5. package/dist/cdn/{GRY2G3ZM.js → B3RGPCZC.js} +1 -1
  6. package/dist/cdn/{EHMFQPTC.js → B73HLERI.js} +1 -1
  7. package/dist/cdn/{UCJZGGBB.js → BXC4G3AT.js} +1 -1
  8. package/dist/cdn/{MFMTJO3G.js → GMEKFEH7.js} +2 -2
  9. package/dist/cdn/GTE3KXNK.js +2 -0
  10. package/dist/cdn/{R4PIOB2F.js → H2YYYWPE.js} +1 -1
  11. package/dist/cdn/{3PBQ47BB.js → HXJFZ2Y5.js} +1 -1
  12. package/dist/cdn/{LZ2JU5WD.js → JLYAOSQM.js} +1 -1
  13. package/dist/cdn/{PNDN33UV.js → LEFFI3FB.js} +1 -1
  14. package/dist/cdn/{VVAIS3PR.js → MCVII2KK.js} +1 -1
  15. package/dist/cdn/{DBVA54U6.js → MFDNJU3K.js} +1 -1
  16. package/dist/cdn/{EIW62O7S.js → NCMXRX7O.js} +1 -1
  17. package/dist/cdn/NVWQE3SF.js +2 -0
  18. package/dist/cdn/{CRXBAVHA.js → O6L3YJ7J.js} +1 -1
  19. package/dist/cdn/{XU7YAUUX.js → PJBI5XFD.js} +1 -1
  20. package/dist/cdn/{BEDXEPMS.js → PXKBNRBR.js} +1 -1
  21. package/dist/cdn/{4XEVYDUI.js → Q5RDW24Y.js} +1 -1
  22. package/dist/cdn/{IMMQXUUH.js → RFQXYDLI.js} +1 -1
  23. package/dist/cdn/{6IE7GBIZ.js → TIZLT4V3.js} +1 -1
  24. package/dist/cdn/{4XMC5J5W.js → UTTEHEMP.js} +1 -1
  25. package/dist/cdn/VPVLZ5QO.js +2 -0
  26. package/dist/cdn/{FJWYAXOE.js → WRVJHPML.js} +1 -1
  27. package/dist/cdn/XJRNIBLO.js +2 -0
  28. package/dist/cdn/{MQ6ZAZZK.js → ZXEQOR2Y.js} +1 -1
  29. package/dist/cdn/assets/code-editor/sql-expr.worker.js +2611 -2586
  30. package/dist/cdn/index.js +1 -1
  31. package/dist/chunks/debugger-value-components.js +51 -47
  32. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +4 -5
  33. package/dist/components/arcgis-arcade-debugger-output/customElement.js +21 -18
  34. package/dist/components/arcgis-arcade-editor/customElement.js +5 -5
  35. package/dist/components/arcgis-arcade-results/customElement.js +1 -1
  36. package/dist/components/arcgis-sql-layer-editor/customElement.js +10 -10
  37. package/dist/docs/api.json +1 -1
  38. package/dist/docs/docs.json +1 -1
  39. package/dist/docs/web-types.json +1 -1
  40. package/dist/loader.js +1 -1
  41. package/package.json +5 -5
  42. package/dist/cdn/4KFBAAVC.js +0 -2
  43. package/dist/cdn/GBBSV4NV.js +0 -2
  44. package/dist/cdn/IQR7XS6J.js +0 -2
  45. package/dist/cdn/SYSBF5A6.js +0 -2
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import g from"./Q2EZ6DGG.js";import f from"./UCJZGGBB.js";import e from"./4XMC5J5W.js";import c from"./STN3LSQR.js";import{e as te}from"./3PBQ47BB.js";import b from"./7Z6G332Z.js";import{a as oe,b as re,c as D}from"./O5XRLNCX.js";import"./OLNYBWUC.js";import{a as ae}from"./P37AQWGL.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as ee}from"./DBVA54U6.js";import{a as Z}from"./EHMFQPTC.js";import"./NP37C536.js";import"./XSKI5PRU.js";import"./ECNI2A4K.js";import"./XRUKVCVF.js";import{E as M,F as T,G as X,H as P,K as Y,L as J,h as W,j as d,l as I,n as L,t as Q}from"./XU7YAUUX.js";import{a as G,b as u}from"./VGOFAQ7A.js";import"./257WOXQH.js";import"./R2XZZWNP.js";import"./QTLHVR4Y.js";import{Rk as se,Uk as F,Zk as ie}from"./TEXAGKBD.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,he,{watch:O},m,{property:c,subclass:x},{a:ne,h:v,i:U},{b:N},,,f,{a:ce,b:le}])=>{var me=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;align-items:stretch;background-color:var(--calcite-color-foreground-1);.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}.bottom-action-bar__close{flex:0 0 auto}}`,de="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",h=(t,e)=>{G(t,"Arcade Assistant",e)},ge=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],xe=ge,ue=(t,e)=>e.every(s=>t[s]===!0),Se=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(h("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Ae=async t=>(await he.getCredential(t,{oAuthPopupConfirmation:!1})).token,Pe=async t=>{try{return!!await he.checkSignInStatus(t)}catch{return h("warn","User is not signed in."),!1}};async function fe({portalUrl:t}){t&&h("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return h("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await Pe(s))return{shouldRender:!1};let i=await Ae(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($=>$.json()),fetch(o,{credentials:"include"}).then($=>$.json()),fetch(n,{credentials:"include"}).then($=>$.json())]),[S,A,R]=r,y=S.status==="fulfilled"?S.value:(h("warn",`Failed to fetch selfUrl. Reason: ${S.reason}.`),{}),K=A.status==="fulfilled"?A.value:(h("warn",`Failed to fetch settingsUrl. Reason: ${A.reason}.`),{}),be=R.status==="fulfilled"?R.value:(h("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(y.isPortal)return{shouldRender:!1};let j=y.helpBase||"";if(!K)return h("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Se(K),betaAppsAllowed:be.blockBetaApps!==!0,serviceUrlAvailable:!!y?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:y?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||h("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||h("warn","User does not have the required privileges to use AI Assistants.");let H=ue(B,xe),q=ue(B,ge),V=y?.helperServices?.aiAssistantServices?.url;return V?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:q},serviceUrl:V,helpBase:j,feedbackServiceUrl:de}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:q},helpBase:j,feedbackServiceUrl:de}}var ve=Object.defineProperty,ye=Object.getOwnPropertyDescriptor,_=(t,e,s,i)=>{for(var a=i>1?void 0:i?ye(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ve(e,s,a),a},pe=100,g=class extends m{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=pe}};_([c()],g.prototype,"collectionItems",2);_([c()],g.prototype,"errorMessage",2);_([c()],g.prototype,"expanded",2);_([c()],g.prototype,"requestId",2);_([c()],g.prototype,"schemaValue",2);_([c()],g.prototype,"status",2);_([c()],g.prototype,"visibleChildCount",2);g=_([x("ArcadeDebuggerLazyTreeNodeState")],g);var C=class extends m{constructor(t){super(t),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(t,e=!1,s){let i=this.nodes.get(t);if(i)return i;let a=new g;return a.expanded=e,this.nodes.set(t,a),e&&s&&this.loadNode(t,s),a}setExpanded(t,e,s){let i=this.ensureNode(t,e,s);if(i.expanded===e){e&&s&&this.loadNode(t,s);return}i.expanded=e,e&&s&&this.loadNode(t,s)}showMore(t,e){let s=this.ensureNode(t);s.visibleChildCount>=e||(s.visibleChildCount=Math.min(e,s.visibleChildCount+pe))}loadNode(t,e){switch(e.kind){case"collection":this.runLoad(t,e.load,(s,i)=>{s.collectionItems=i});return;case"schema":this.runLoad(t,e.load,(s,i)=>{s.schemaValue=i});return}}runLoad(t,e,s){let i=this.nodes.get(t);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let 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("ArcadeDebuggerLazyTreeState")],C);var $e=Object.defineProperty,De=Object.getOwnPropertyDescriptor,l=(t,e,s,i)=>{for(var a=i>1?void 0:i?De(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$e(e,s,a),a},b=class extends m{constructor(t){super(t),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};l([c()],b.prototype,"phase",2);l([c()],b.prototype,"mode",2);l([c()],b.prototype,"sessionId",2);l([c()],b.prototype,"result",2);l([c()],b.prototype,"consoleLogs",2);l([c()],b.prototype,"hasExecuted",2);b=l([x("ArcadeDebuggerExecutionModel")],b);var E=class extends m{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}};l([c()],E.prototype,"editorBreakpoints",2);l([c()],E.prototype,"executionBreakpoints",2);E=l([x("ArcadeDebuggerSessionModel")],E);var w=class extends m{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};l([c()],w.prototype,"openedPanel",2);l([c()],w.prototype,"showPanel",2);w=l([x("ArcadeDebuggerUiModel")],w);var k=class extends m{constructor(t){super(t)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(t){this.pausedState=t,this.lastPausedState=t}};l([c()],k.prototype,"pausedState",2);l([c()],k.prototype,"lastPausedState",2);k=l([x("ArcadeDebuggerPausedFrameModel")],k);var p=class extends m{constructor(t){super(t),this.execution=new b,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new N,this.session=new E,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 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){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&v(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!v(t)&&(this.execution.result={resultType:"debug",result:t}),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 N}};l([c()],p.prototype,"execution",2);l([c()],p.prototype,"lazyTreeState",2);l([c()],p.prototype,"pausedLine",2);l([c()],p.prototype,"pausedFrame",2);l([c()],p.prototype,"previewTabsState",2);l([c()],p.prototype,"session",2);l([c()],p.prototype,"ui",2);p=l([x("ArcadeDebuggerStore")],p);var Ee={glyphMargin:!0,lineNumbersMinChars:1},z=class extends X{constructor(){super(...arguments),this._codeEditorElt=M(),this._arcadeAssistantElt=M(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new p,this.messages=ee(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(ne,"Arcade Help")},this._decorations=void 0,this._monacoEditor=Z(ae),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let s=this._debuggerState.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph"}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(s)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=L({bubbles:!1}),this.arcgisScriptChange=L({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=[me]}get _usesBottomExecutionDrawer(){return this.enableDebugger&&!!this.testData}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...Ee,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let s=this._codeEditorElt.value?.value,i=await U(e.definition,s,this.testData,{mode:"run"});return v(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=J("./assets");ce(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(u(this)),()=>{for(this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&f.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve(),await this._codeEditorElt.value?.setFocus()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await le();this._disposables.push(e.onDiagnosticsChange(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this.testData&&!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=te(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"}}]):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(u(this))}async _handleDebugPause(e,s,i){if(!this._debuggerState.isDebugging||e!==this._debuggerState.sessionId)return;let a=Promise.withResolvers();return this._debuggerState.pauseDebug({line:s.line,result:i,continue:a}),await a.promise}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause: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:"Execution failed",error:n instanceof Error?n:new Error(String(n))}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.showPanel&&this._executeScript("run").catch(u(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await f.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=f.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await f.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData;if(!this._codeEditorElt.value||!s)return;let i=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let a=this._codeEditorElt.value?.value??this.script,o={mode:e,console:r=>this._debuggerState.addConsoleLog(r),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(o.onDebugPause=this._handleDebugPause.bind(this,i));let n;if(this.externalExecutor)n=await this._executeWithExternalExecutor(e,a,o);else{let r=await this._editorProfilePromise;if(!r){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}n=await U(r.definition,a,s,o)}if(i===this._debuggerState.sessionId){if(e==="debug"){if(v(n)){this._debuggerState.fail(n);return}this._debuggerState.completeDebug(n);return}v(n)?this._debuggerState.completeRun(n):this.externalExecutor?this._debuggerState.completeRun(n,{useDebugRenderer:!0}):this._debuggerState.fail({type:"error",value:"Unexpected debug result",error:null})}})()},0)}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(u(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(u(this))}_onResultPanelChange(e){let s=e.currentTarget;this._debuggerState.setPanel(s.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[se.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript("run").catch(u(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ie.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:oe,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:re,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(D(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&D(this._askAiBindingKey,void 0),D(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(u(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await fe(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this.enableDebugger||!this.testData?null:d`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action>${this._debuggerState.result?d`<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 d`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${f.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${T(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:r=this._toggleSidePanel}){return d`<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&&d`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:d`<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 d`<arcgis-language-api-panel slot=side-panel class=${P(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=${P(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>${this.suggestions?.length&&d`<arcgis-arcade-suggestions slot=side-panel class=${P(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&d`<arcgis-arcade-coding-assistant slot=side-panel class=${P(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} ${T(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>d`<calcite-flow slot=side-panel class=${P(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):d`<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 d`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;return e?s==="debug-console"?d`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?d`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:d`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${s} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`:null}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",S=this.messages.reset??"Reset",A=this.messages.stop??"Stop";return d`<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-disabled><calcite-action-group scale=s>${a?d`<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=${S} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${S}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${A} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${A}</span></calcite-tooltip>`:d`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(u(this))}}></calcite-action><calcite-action .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(u(this))}}></calcite-action>`}</calcite-action-group>${s?d`<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><calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script icon-flip-rtl .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action></calcite-action-group>`:null}</calcite-action-bar>${e?d`<calcite-action class="bottom-action-bar__close" .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose}></calcite-action>`:null}</div>`}render(){return d`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};Y("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,e,f,g)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./SYSBF5A6.js";import b from"./CRXBAVHA.js";import"./5HKDO4SX.js";import a from"./2WB7S5TQ.js";import{a as u}from"./DBVA54U6.js";import"./EHMFQPTC.js";import"./NP37C536.js";import{c,e as n}from"./XSKI5PRU.js";import{G as i,K as o,h as l,j as s}from"./XU7YAUUX.js";import"./VGOFAQ7A.js";import"./H6RQVSYM.js";export default $arcgis.t(([,{a:t,h:a,i:d,j:m},{h:p}])=>{var h=l`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);--calcite-block-padding: var(--calcite-spacing-sm);overflow:auto;calcite-flow{height:100%}.disabled-state-text{font-size:var(--calcite-font-size-sm);color:var(--calcite-color-text-3);font-style:italic;display:block;margin:var(--calcite-spacing-md)}[class*=result-value-]{line-height:1.25rem}}`,r=class extends i{constructor(){super(...arguments),this.messages=u()}static{this.properties={debuggerStore:0,result:0}}static{this.styles=[h,m,d()]}load(){this.manager.onLifecycle(()=>{let e=c(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>e()})}willUpdate(e){e.has("result")&&this.result&&this.debuggerStore?.lazyTreeState.reset()}updateTheme(){n(this.el)==="dark"?this.elementInternals.states.add(a):this.elementInternals.states.delete(a)}render(){if(!this.result)return s`<span class="disabled-state-text">${this.messages.nooutput??"No output available."}</span>`;let e=this.debuggerStore?.lazyTreeState;return e?s`<calcite-tree .scale=${t.scale} @calciteTreeSelect=${t.oncalciteTreeSelect} .lines=${t.lines} .selectionMode=${t.selectionMode}>${p({expanded:!0,name:this.result.arcadeType,value:this.result,messages:this.messages,path:this.result.arcadeType,lazyTreeState:e})}</calcite-tree>`:s`<span class="disabled-state-text">${this.messages.nooutput??"No output available."}</span>`}};o("arcgis-arcade-debugger-output",r);return r},a,b,d)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import j from"./3LFA3ZUC.js";import i from"./CRXBAVHA.js";import"./5HKDO4SX.js";import"./MZMKV7FA.js";import h from"./2WB7S5TQ.js";import{a as x}from"./DBVA54U6.js";import"./EHMFQPTC.js";import"./NP37C536.js";import{c as b,e as $}from"./XSKI5PRU.js";import"./ECNI2A4K.js";import{E as c,F as o,G as v,H as r,K as f,h as g,j as e,n as d,p as l,u as a}from"./XU7YAUUX.js";import"./VGOFAQ7A.js";import"./H6RQVSYM.js";export default $arcgis.t(([{b:R},{c:y,d:w,e:u,g:P,h:m,i:k,j:S},{a:s,b:T,c:C,d:L,e:M,f:I}])=>{var _=g`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden;min-height:0}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{display:flex;flex-direction:column;min-height:0;.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}}`,n={onClick:p=>{let t=p.currentTarget;t.expanded=!t.expanded}},h=class extends v{constructor(){super(...arguments),this.messages=x(),this.outputRef=c(),this.consoleRef=c(),this.logRef=c(),this.openedResultPanel="output",this.hideHeader=!1,this.arcgisInternalClosePanel=d({bubbles:!1,composed:!1}),this.arcgisInternalOpenedResultPanelChange=d({bubbles:!1,composed:!1})}static{this.properties={consoleLogs:0,loading:5,openedResultPanel:3,result:0,hideHeader:5}}static{this.styles=[_,k(),S]}load(){this.manager.onLifecycle(()=>{let t=b(this.el,["class"],this.updateTheme.bind(this));return this.updateTheme(),()=>t()})}loaded(){this.hideHeader||this.openedResultPanel&&(this.openedResultPanel==="output"&&this.outputRef.value?this.outputRef.value.setFocus():this.openedResultPanel==="console"&&this.consoleRef.value?this.consoleRef.value.setFocus():this.openedResultPanel==="log"&&this.logRef.value&&this.logRef.value.setFocus())}updateResultPanel(t){this.openedResultPanel=t,this.arcgisInternalOpenedResultPanelChange.emit()}_switchResultPanel(t){let i=t.currentTarget.dataset.panelName;i&&this.updateResultPanel(i)}_emitClose(){this.arcgisInternalClosePanel.emit()}updateTheme(){$(this.el)==="dark"?this.elementInternals.states.add(m):this.elementInternals.states.delete(m)}renderConsolePanel(){return this.openedResultPanel!=="console"?null:this.loading&&!this.consoleLogs?.length?e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`:e`<div class="console-logs-container">${this.consoleLogs?.length?this.consoleLogs.map(t=>e`<p>${t}</p>`):e`<p>${this.messages.consolemessage}</p>`}</div>`}renderLogPanel(){if(this.openedResultPanel!=="log")return null;if(this.loading)return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`;let t=this.result?.type==="error"?"color-error":"color-success";return e`<calcite-list .label=${this.messages.results??"Results"}>${this.result?e`<calcite-list-item .label=${a(this.messages.lastexecutionformat,{timeStamp:new Intl.DateTimeFormat(this.messages._t9nLocale,{dateStyle:"medium",timeStyle:"medium"}).format(this.result.timeStamp)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${a(this.messages.compilationtimeformat,{time:new Intl.NumberFormat(this.messages._t9nLocale,{style:"unit",unit:"millisecond",maximumFractionDigits:2}).format(this.result.compilationTime??0)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item><calcite-list-item .label=${a(this.messages.executiontimeformat,{time:new Intl.NumberFormat(this.messages._t9nLocale,{style:"unit",unit:"millisecond",maximumFractionDigits:2}).format(this.result.executionTime??0)})}><calcite-icon slot=content-start icon=information scale=s class=${r(t)}></calcite-icon></calcite-list-item>`:e`<calcite-list-item .label=${this.messages.runscriptmessage}><calcite-icon slot=content-start icon=information scale=s class="color-info"></calcite-icon></calcite-list-item>`}</calcite-list>`}renderOutputPanel(){if(this.openedResultPanel!=="output")return null;if(this.loading)return e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"loading"}></calcite-loader>`;switch(this.result?.type){case"error":return e`<div class="result-value-simple flex-adjustable">${a(this.messages.executionerrorformat??"",{message:this.result.value})}</div>`;case"null":case"unknown":return e`<div class="result-value-simple">${u({type:this.result.type,value:l(this.result.type)})}</div>`;case"text":case"number":case"date":case"dateOnly":case"time":case"boolean":{let{type:t,value:i}=P(this.result);return e`<div class="result-value-simple"><bdi class="value-type">${l(this.result.type)}:&nbsp;</bdi>${u({type:t,value:i})}</div>`}case"array":{let t=(this.result.value??[]).slice(0,R);return e`<div class="result-value-simple"><calcite-tree .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label">${T({arcadeResult:this.result,t9nStrings:this.messages})}</div>${M({items:t,subtree:!0,t9nStrings:this.messages})}</calcite-tree-item></calcite-tree></div>`}case"geometry":return e`<div class="result-value-simple"><calcite-tree .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label"><bdi>${l(this.result.type)}</bdi></div>${w({value:this.result.value,subtree:!0})}</calcite-tree-item></calcite-tree></div>`;case"attachment":return e`<div class="result-value-simple"><calcite-tree .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label"><bdi>${l(this.result.type)}</bdi></div>${y({obj:this.result.value.castAsJson(),subtree:!0})}</calcite-tree-item></calcite-tree></div>`;case"feature":case"dictionary":case"portal":return e`<div class="result-value-simple"><calcite-tree .lines=${s.lines} .selectionMode=${s.selectionMode} .scale=${s.scale} @calciteTreeSelect=${s.oncalciteTreeSelect}><calcite-tree-item expanded @click=${n.onClick}><div class="tree-item-label"><bdi>${l(this.result.type)}</bdi></div>${C({value:this.result.value,subtree:!0,t9nStrings:this.messages})}</calcite-tree-item></calcite-tree></div>`;case"featureSet":return e`<div class="result-value-table">${L({arcadeResult:this.result,t9nStrings:this.messages})}${I({arcadeResult:this.result})}</div>`;case"knowledgeGraph":return e`<div class="result-value-simple"><bdi class="value-type">${l(this.result.type)}:&nbsp;</bdi><bdi class="string-value">${this.result.value.url}</bdi></div>`;default:return e`<div class="result-value-simple flex-adjustable">${this.messages.runscriptmessage}</div>`}}render(){return e`${this.hideHeader?null:e`<header class="flex-row"><calcite-action-bar class="flex-adjustable" layout=horizontal scale=s expanded expand-disabled><calcite-action-group scale=s><calcite-action .active=${this.openedResultPanel==="output"} .text=${this.messages.output??""} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=output ${o(this.outputRef)}></calcite-action><calcite-action .active=${this.openedResultPanel==="console"} .text=${this.messages.console??""} text-enabled scale=s icon=console icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=console ${o(this.consoleRef)}></calcite-action><calcite-action .active=${this.openedResultPanel==="log"} .text=${this.messages.log??""} text-enabled scale=s icon=list icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=log ${o(this.logRef)}></calcite-action></calcite-action-group></calcite-action-bar><calcite-action scale=s icon=x .text=${this.messages.close??""} @click=${this._emitClose}></calcite-action></header>`}<article class="flex-adjustable">${this.loading?e`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading??"Loading"}></calcite-loader>`:e`<div class="flex-column y-scrollable-container">${this.renderOutputPanel()}${this.renderConsolePanel()}${this.renderLogPanel()}</div>`}</article>`}};f("arcgis-arcade-results",h);return h},h,i,j)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./CRXBAVHA.js";import{H as z,j as l,p as V,q as E}from"./XU7YAUUX.js";export default $arcgis.t(([{a:y}])=>{var U=/^[$A-Z_a-z][$\w]*$/u;function q(e){return e.replaceAll("\\","\\\\").replaceAll('"','\\"')}function H(e){return U.test(e)}function B(e){return typeof e=="number"?`[${e}]`:e.startsWith("name:")?`[name="${q(e.slice(5))}"]`:e.startsWith("id:")?`[id="${q(e.slice(3))}"]`:H(e)?`.${e}`:`["${q(e)}"]`}function R(e,t){if(e[t]!=='"')return;let i="",a=t+1;for(;a<e.length;){let m=e[a];if(m==="\\"){if(a+=1,a>=e.length)return;i+=e[a],a+=1;continue}if(m==='"')return{value:i,nextIndex:a+1};i+=m,a+=1}}function J(e){if(!e)return;let t=0,i=[];for(;t<e.length&&/[$A-Z_a-z0-9]/u.test(e[t]);)t+=1;let a=e.slice(0,t);if(!a)return;for(;t<e.length;){let p=e[t];if(p==="."){t+=1;let c=t;for(;t<e.length&&/[$\w]/u.test(e[t]);)t+=1;if(c===t)return;i.push(e.slice(c,t));continue}if(p!=="[")return;if(t+=1,/\d/u.test(e[t]??"")){let c=t;for(;t<e.length&&/\d/u.test(e[t]);)t+=1;if(e[t]!=="]")return;i.push(e.slice(c,t)),t+=1;continue}let $=e.startsWith("name=",t)?"name":e.startsWith("id=",t)?"id":void 0;if($){let c=R(e,t+$.length+1);if(!c||e[c.nextIndex]!=="]")return;i.push(`${$}:${c.value}`),t=c.nextIndex+1;continue}let u=R(e,t);if(!u||e[u.nextIndex]!=="]")return;i.push(u.value),t=u.nextIndex+1}let[m,...s]=i;if(m)return{scopeName:a,rootName:m,pathSegments:s}}function de(e,t){return`${e}${B(t)}`}function M(e,t){return e?`${e}.${t}`:String(t)}function k(e,t){if(e)return`${e}${B(t)}`}function pe(e){return J(e)}function N(e,t){return typeof t=="number"?`${e}[${t}]`:`${e}.${t}`}function K(e){return e.name?`name:${e.name}`:`id:${e.id}`}function Q(e){return Object.entries(e).filter(([t])=>t!=="featureSet")}function X(e,t){if(t){let i=t.featureSet;return{kind:"feature-set",displayValue:i.arcadeType,featureSetValue:i,loadRequest:{kind:"schema",load:()=>i.schema()},mergedCollectionItem:t}}return e.type==="feature-set"?{kind:"feature-set",displayValue:e.arcadeType,featureSetValue:e,loadRequest:{kind:"schema",load:()=>e.schema()}}:e.type==="feature-set-collection"?{kind:"collection",collectionValue:e,displayValue:e.arcadeType,loadRequest:{kind:"collection",load:()=>e.load()}}:null}function x(e){return l`<calcite-tree slot=children .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${e}</calcite-tree>`}function D({lazyTreeState:e,nodePath:t,mergedCollectionItem:i,expanded:a=!1,isMetadata:m=!1,messages:s,name:p,value:$,loadPreview:u,previewLabel:c,previewSourcePath:b,previewLoading:g=!1}){let o=X($,i);if(!o)return null;let n=e.ensureNode(t,a,o.loadRequest),f=o.kind==="feature-set"?o.featureSetValue:void 0,S=c??String(p),v=b??t,C=!!(u&&S&&f&&typeof f.querySample=="function"),d=r=>{r.target===r.currentTarget&&e.setExpanded(t,!0,o.loadRequest)},h=r=>{r.target===r.currentTarget&&e.setExpanded(t,!1,o.loadRequest)},I=r=>{r.stopPropagation(),!(!u||!S||!f)&&u({label:S,sourcePath:v,value:f})},w=()=>l`<calcite-tree-item disabled><div class="tree-item-label"><span class="constant-value">${n.errorMessage||(s.loaderror??"Unable to load data.")}</span></div></calcite-tree-item>`,G=()=>o.kind!=="feature-set"||!n.schemaValue?null:T({name:"schema",value:n.schemaValue,messages:s,path:N(t,"schema"),lazyTreeState:e}),Z=()=>o.kind!=="feature-set"||!o.mergedCollectionItem?[]:Q(o.mergedCollectionItem).map(([r,P])=>T({name:r,value:Y(P),messages:s,path:N(t,r),lazyTreeState:e})),_=()=>{if(o.kind!=="feature-set")return null;if(!n.expanded||n.status==="loading")return x();let r=[];if(n.status==="error")r.push(w());else{r.push(...Z());let P=G();P&&r.push(P)}return r.length?x(r):x()},j=()=>o.kind!=="collection"?null:!n.expanded||n.status==="loading"?x():x(l`${n.status==="error"?w():null}${n.status==="loaded"?n.collectionItems.map(r=>D({name:r.name||r.id,mergedCollectionItem:r,messages:s,nodePath:N(t,r.id),lazyTreeState:e,value:r.featureSet,loadPreview:u,previewLabel:M(c,r.name||r.id),previewSourcePath:k(v,K(r)),previewLoading:g})):null}`),O=()=>o.kind==="collection"?j():_();return l`<calcite-tree-item .expanded=${n.expanded} @calciteTreeItemExpand=${d} @calciteTreeItemCollapse=${h}><div class="tree-item-label">${L({name:p,isMetadata:m})}<bdi>${o.displayValue}</bdi></div>${n.status==="loading"?l`<calcite-loader slot=actions-end scale=s inline type=indeterminate .label=${s.loading??"Loading"} .text=${s.loading??"Loading"}></calcite-loader>`:null}${C?l`<calcite-action slot=actions-end scale=s class="load-action" .text=${s.loadpreview??"Load preview"} text-enabled icon=play .disabled=${g} @click=${I}></calcite-action>`:null}${O()}</calcite-tree-item>`}function Y(e){if(e==null)return{type:"primitive",arcadeType:"",value:null};switch(typeof e){case"boolean":return{type:"primitive",arcadeType:"Boolean",value:e};case"number":return{type:"primitive",arcadeType:"Number",value:e};case"string":return{type:"primitive",arcadeType:"String",value:e};default:return{type:"primitive",arcadeType:"String",value:String(e)}}}var A="tree-item-metadata";function L({name:e,isMetadata:t=!1}){let i=t?`dictionary-property ${A}`:"dictionary-property",a=t?A:void 0;return l`<bdi class=${z(i)}>${e}</bdi><bdi class=${z(a)}>:&nbsp;</bdi>`}function ee({lazyTreeState:e,path:t,expanded:i=!1,value:a,subtree:m,messages:s,onLoadPreview:p,previewLabel:$,previewSourcePath:u,previewLoading:c=!1}){let b=d=>l`<calcite-tree slot=${"children"} .lines=${y.lines} .selectionMode=${y.selectionMode} .scale=${y.scale} @calciteTreeSelect=${y.oncalciteTreeSelect}>${d}</calcite-tree>`;if(!i)return b();let g=e.ensureNode(t,i),o=d=>g.visibleChildCount>=d?null:l`<calcite-tree-item @click=${h=>{h.stopPropagation(),e.showMore(t,d)}}><div class="tree-item-label"><span class=${z(A)}>${s.showmore??"Show more"}</span></div></calcite-tree-item>`,n=a.expand();if(Array.isArray(n)){let d=n.slice(0,g.visibleChildCount),h=F(a)?a.length:n.length;return b(l`${d.map((I,w)=>T({name:w,value:I,messages:s,path:`${t}[${w}]`,lazyTreeState:e,onLoadPreview:p,previewLabel:M($,w),previewSourcePath:k(u,w),previewLoading:c}))}${o(n.length)}${T({name:"length",value:{arcadeType:"Number",type:"primitive",value:h},isMetadata:!0,messages:s,path:`${t}.length`,lazyTreeState:e})}`)}let f=a.arcadeType==="Feature"?n.get("Geometry()"):void 0,S=Math.min(g.visibleChildCount,f?n.size-1:n.size),v=[];for(let[d,h]of n.entries())if(!(d==="Geometry()"&&a.arcadeType==="Feature")){if(v.length>=S)break;v.push([d,h])}let C=!!(f&&g.visibleChildCount>v.length);return b(l`${v.map(([d,h])=>T({name:d,value:h,messages:s,path:`${t}.${d}`,lazyTreeState:e,onLoadPreview:p,previewLabel:M($,d),previewSourcePath:k(u,d),previewLoading:c}))}${C?T({name:"geometry",value:f,messages:s,path:`${t}.geometry`,lazyTreeState:e,onLoadPreview:p,previewLabel:M($,"geometry"),previewSourcePath:k(u,"geometry"),previewLoading:c}):null}${o(n.size)}`)}function te(e){return"expand"in e}function ae(e){return e.type==="simple"}function ie(e){return e.type==="primitive"}function F(e){return e.type==="sequence-container"}function ne(e){return e.type==="feature-set"}function re(e){return e.type==="feature-set-collection"}function le(e){return ne(e)||re(e)}function T({lazyTreeState:e,path:t,name:i,value:a,messages:m,expanded:s,isMetadata:p=!1,onLoadPreview:$,previewLabel:u,previewSourcePath:c,previewLoading:b=!1}){if(a===void 0)return null;if(a===null)return l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi class="uninitialized-value tree-item-metadata">${m.uninitialized??"uninitialized"}</bdi></div></calcite-tree-item>`;if(te(a)){let g=e.ensureNode(t,s),o=v=>{v.target===v.currentTarget&&e.setExpanded(t,!0)},n=v=>{v.target===v.currentTarget&&e.setExpanded(t,!1)},f=typeof a.arcadeType=="string"?a.arcadeType:"unknown",S=F(a)?`${V(f)}(${a.length})`:V(f);return l`<calcite-tree-item .expanded=${g.expanded} @calciteTreeItemExpand=${o} @calciteTreeItemCollapse=${n}><div class="tree-item-label">${L({name:i,isMetadata:p})}<bdi>${S}</bdi></div>${ee({expanded:g.expanded,value:a,subtree:!0,messages:m,path:t,lazyTreeState:e,onLoadPreview:$,previewLabel:u,previewSourcePath:c,previewLoading:b})}</calcite-tree-item>`}return le(a)?D({name:i,value:a,nodePath:t,lazyTreeState:e,messages:m,expanded:s,isMetadata:p,loadPreview:$,previewLabel:u,previewSourcePath:c,previewLoading:b}):ae(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${W({value:a})}</div></calcite-tree-item>`:ie(a)?l`<calcite-tree-item .expanded=${s}><div class="tree-item-label">${L({name:i,isMetadata:p})}${W({value:a})}</div></calcite-tree-item>`:null}var W=({value:e})=>{switch(e.type){case"primitive":if(e.value===null)return l`<bdi class="constant-value">null</bdi>`;switch(e.arcadeType){case"String":return l`<bdi class="string-value">${E(String(e.value))}</bdi>`;case"Number":return l`<bdi class="number-value">${String(e.value)}</bdi>`;case"Boolean":return l`<bdi class="constant-value">${String(e.value)}</bdi>`;default:return null}case"simple":return l`<bdi class="date-value">${e.render()}</bdi>`;case"minimal":return l`<bdi class="constant-value">${e.arcadeType}</bdi>`;default:return null}};return{a:de,b:pe,c:te,d:ae,e:ie,f:ne,g:re,h:T,i:W}},a)