@arcgis/coding-components 5.0.0-next.147 → 5.0.0-next.149

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 (79) hide show
  1. package/dist/cdn/{VOKAILQ5.js → 5GJXU26T.js} +1 -1
  2. package/dist/cdn/CVGNKT6A.js +2 -0
  3. package/dist/cdn/GPCAV243.js +2 -0
  4. package/dist/cdn/H25NK6KP.js +2 -0
  5. package/dist/cdn/HFY5V4YQ.js +2 -0
  6. package/dist/cdn/S5ZW4OSD.js +2 -0
  7. package/dist/cdn/TJHFVCKN.js +2 -0
  8. package/dist/cdn/V2FCS4O5.js +4 -0
  9. package/dist/cdn/XKNRIGBN.js +2 -0
  10. package/dist/cdn/assets/code-editor/sql-expr.worker.js +9397 -9313
  11. package/dist/cdn/index.js +1 -1
  12. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +1 -1
  13. package/dist/components/arcgis-arcade-editor/customElement.d.ts +0 -2
  14. package/dist/components/arcgis-arcade-editor/customElement.js +0 -6
  15. package/dist/components/arcgis-code-editor/customElement.d.ts +0 -7
  16. package/dist/components/arcgis-code-editor/customElement.js +0 -9
  17. package/dist/docs/api.json +1 -1
  18. package/dist/docs/docs.json +1 -1
  19. package/dist/docs/vscode.html-custom-data.json +1 -1
  20. package/dist/docs/web-types.json +1 -1
  21. package/dist/loader.js +3 -4
  22. package/dist/utils/arcade-executor.d.ts +0 -3
  23. package/package.json +5 -5
  24. package/dist/addons/arcade-coding-assistant/useArcadeAssistant.d.ts +0 -33
  25. package/dist/addons/index.d.ts +0 -2
  26. package/dist/addons.js +0 -51
  27. package/dist/cdn/2WEMCNJY.js +0 -2
  28. package/dist/cdn/37TTDUCL.js +0 -2
  29. package/dist/cdn/CYUVUJUQ.js +0 -2
  30. package/dist/cdn/ES55YNFK.js +0 -2
  31. package/dist/cdn/FHLSJMBY.js +0 -2
  32. package/dist/cdn/GNOEAG5O.js +0 -4
  33. package/dist/cdn/I466DUIV.js +0 -2
  34. package/dist/cdn/R235VE2D.js +0 -2
  35. package/dist/cdn/UHVSUPMQ.js +0 -2
  36. package/dist/cdn/W7GMC6R5.js +0 -2
  37. package/dist/cdn/X5YNEMIK.js +0 -2
  38. package/dist/cdn/assets/sql-expression-fields/t9n/messages.ar.json +0 -1
  39. package/dist/cdn/assets/sql-expression-fields/t9n/messages.bg.json +0 -1
  40. package/dist/cdn/assets/sql-expression-fields/t9n/messages.bs.json +0 -1
  41. package/dist/cdn/assets/sql-expression-fields/t9n/messages.ca.json +0 -1
  42. package/dist/cdn/assets/sql-expression-fields/t9n/messages.cs.json +0 -1
  43. package/dist/cdn/assets/sql-expression-fields/t9n/messages.da.json +0 -1
  44. package/dist/cdn/assets/sql-expression-fields/t9n/messages.de.json +0 -1
  45. package/dist/cdn/assets/sql-expression-fields/t9n/messages.el.json +0 -1
  46. package/dist/cdn/assets/sql-expression-fields/t9n/messages.en.json +0 -1
  47. package/dist/cdn/assets/sql-expression-fields/t9n/messages.es.json +0 -1
  48. package/dist/cdn/assets/sql-expression-fields/t9n/messages.et.json +0 -1
  49. package/dist/cdn/assets/sql-expression-fields/t9n/messages.fi.json +0 -1
  50. package/dist/cdn/assets/sql-expression-fields/t9n/messages.fr.json +0 -1
  51. package/dist/cdn/assets/sql-expression-fields/t9n/messages.he.json +0 -1
  52. package/dist/cdn/assets/sql-expression-fields/t9n/messages.hr.json +0 -1
  53. package/dist/cdn/assets/sql-expression-fields/t9n/messages.hu.json +0 -1
  54. package/dist/cdn/assets/sql-expression-fields/t9n/messages.id.json +0 -1
  55. package/dist/cdn/assets/sql-expression-fields/t9n/messages.it.json +0 -1
  56. package/dist/cdn/assets/sql-expression-fields/t9n/messages.ja.json +0 -1
  57. package/dist/cdn/assets/sql-expression-fields/t9n/messages.ko.json +0 -1
  58. package/dist/cdn/assets/sql-expression-fields/t9n/messages.lt.json +0 -1
  59. package/dist/cdn/assets/sql-expression-fields/t9n/messages.lv.json +0 -1
  60. package/dist/cdn/assets/sql-expression-fields/t9n/messages.nl.json +0 -1
  61. package/dist/cdn/assets/sql-expression-fields/t9n/messages.no.json +0 -1
  62. package/dist/cdn/assets/sql-expression-fields/t9n/messages.pl.json +0 -1
  63. package/dist/cdn/assets/sql-expression-fields/t9n/messages.pt-BR.json +0 -1
  64. package/dist/cdn/assets/sql-expression-fields/t9n/messages.pt-PT.json +0 -1
  65. package/dist/cdn/assets/sql-expression-fields/t9n/messages.ro.json +0 -1
  66. package/dist/cdn/assets/sql-expression-fields/t9n/messages.ru.json +0 -1
  67. package/dist/cdn/assets/sql-expression-fields/t9n/messages.sk.json +0 -1
  68. package/dist/cdn/assets/sql-expression-fields/t9n/messages.sl.json +0 -1
  69. package/dist/cdn/assets/sql-expression-fields/t9n/messages.sr.json +0 -1
  70. package/dist/cdn/assets/sql-expression-fields/t9n/messages.sv.json +0 -1
  71. package/dist/cdn/assets/sql-expression-fields/t9n/messages.th.json +0 -1
  72. package/dist/cdn/assets/sql-expression-fields/t9n/messages.tr.json +0 -1
  73. package/dist/cdn/assets/sql-expression-fields/t9n/messages.uk.json +0 -1
  74. package/dist/cdn/assets/sql-expression-fields/t9n/messages.vi.json +0 -1
  75. package/dist/cdn/assets/sql-expression-fields/t9n/messages.zh-CN.json +0 -1
  76. package/dist/cdn/assets/sql-expression-fields/t9n/messages.zh-HK.json +0 -1
  77. package/dist/cdn/assets/sql-expression-fields/t9n/messages.zh-TW.json +0 -1
  78. package/dist/components/arcgis-sql-expression-fields/customElement.js +0 -59
  79. package/dist/components/arcgis-sql-expression-fields/index.js +0 -7
@@ -1,4 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{a as N}from"./2WEMCNJY.js";import{a as ee}from"./G3HPFTUI.js";import"./72K7GT6K.js";import b from"./MGMAMY5S.js";import"./6KH4ZJW7.js";import a from"./2XS25MHS.js";import{d as ie}from"./72CKSOAE.js";import{c as te,d as ae}from"./4EAONLKN.js";import"./EMCHMKAC.js";import"./JUSMJGLC.js";import"./NMIFSDFV.js";import"./VVVV256M.js";import{D as W,E as K,F as Y,G as X,H as I,J as Z,h as B,j as r,k as L,l as R,s as j,v as Q,w as G,x as J}from"./VZCGFCMK.js";import{a as y}from"./RXOG5OZ7.js";import"./E26VIEON.js";import"./CVNYRL2K.js";import"./NXRT3FAY.js";import"./YCOWKBW5.js";import"./ALDX5YZO.js";export default $arcgis.t(([ve,oe,ye,we,$e,{getDeclaredVoxelMembers:xe,getDeclaredPixelMembers:ke},Se,{property:g,subclass:Te},{g:se,h:V},P])=>{var A=class extends J{constructor(e){if(super(e),this.it=R,e.type!==Q.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===R||e==null)return this._t=void 0,this.it=e;if(e===L)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};A.directiveName="unsafeHTML",A.resultType=1;var C=G(A);var Ae=B`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem;max-height:30vh;overflow-y:auto}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`,w=class extends Error{constructor({message:e,code:t,subCode:i,details:o,source:n}){super(e),this.name="ArcadeAssistantError",this.code=t,this.subCode=i,this.details=o,this.source=n}};function ne(a){if(!a)return;let e=a.indexOf('{"error":');if(e!==-1)try{let t=a.slice(e),i=JSON.parse(t);if(i&&typeof i=="object"&&i.error)return i.error}catch{return}}async function Ce(a){let{baseUrl:e,skillId:t,message:i,authToken:o,previousConversationId:n,context:p}=a,d=t?`${e}/skills/${t}/chat`:`${e}/chat`,c=[],s={message:i,context:p};n&&(s.conversation_id=n);let h;try{h=await oe(d,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(s),responseType:"json"})}catch(b){let f=b,k=f.details?.rawResponse||f.message||String(b),S=ne(k);throw S?new w(S):b}let l=h.data;c.push(l);let $=l.conversationId,O=l.inquiryId,x=l.sequenceNumber;async function M(){let b=0,f=25;for(;b<f;){await new Promise(T=>setTimeout(T,1e3));let k=Ie($,x,O),S;try{S=await oe(d,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(k),responseType:"json"})}catch(T){let z=T,fe=z.details?.rawResponse||z.message||String(T),H=ne(fe);throw H?new w(H):T}let v=S.data;if(v.context?.kind==="ArcgisErrorAsContext"&&v.context.error)throw new w({message:v.context.error.message||"ArcGIS Assistant error",code:v.context.error.code,subCode:v.context.error.subCode,details:v.context.error.details,source:"polling-response"});if(c.push(v),x=v.sequenceNumber,b++,!v.hasMore)break}if(b===f)throw new w({message:"Request timed out",code:"TIMEOUT",source:"polling"})}let E=120*1e3;return await Promise.race([M(),new Promise((b,f)=>setTimeout(()=>f(new w({message:"Request timed out",code:"TIMEOUT",source:"hard-timeout"})),E))]),c}function Ie(a,e,t){return{conversationId:a,inquiryId:t,ackSequenceNumber:e}}function Me(a){return a.message.match(/Error in prompt shield/u)?"I'm having trouble with this request. Try again by rephrasing the question.":a.code==="TIMEOUT"?"I'm having trouble with this request. Try again by re-asking the same question or rephrasing it.":a.message}var Ee=({notices:a})=>a.length?r`<div class="border-block-end">${N(a,e=>e.id??e.title,e=>r`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${()=>e.onClose?.()}><div slot=title>${e.title}</div>${e.message&&r`<div slot=message>${e.message}</div>`||""}${e.actionLinkMessage&&e.onAction&&r`<calcite-link slot=link @click=${()=>e.onAction?.()}>${e.actionLinkMessage}</calcite-link>`||""}</calcite-notice>`)}</div>`:null,Re=a=>{let e=a.value.length,t=72,i=180,o=a.offsetWidth,n=Math.max(1,Math.floor(o/8)),p=Math.ceil(e/n),d=t+(p-2)*24;a.style.setProperty("--calcite-text-area-min-height",`${Math.min(d,i)}px`)},Ve=({promptValidationMessage:a,errorMessage:e,contextTooBig:t,contextReducedNoticeDismissed:i,setContextReducedNoticeDismissed:o,setErrorMessage:n,messages:p})=>{let d=[];if(a&&d.push({id:"prompt-validation",kind:"danger",icon:"exclamation-mark-triangle",title:a,closable:!0}),e&&d.push({id:"assistant-error",kind:"danger",icon:"exclamation-mark-triangle",title:e,closable:!0,onClose:()=>n(void 0)}),t&&!i){let c=p.contextreduced??"Context reduced",s=p.contextreducedmessage??"The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";d.push({id:"context-reduced",kind:"warning",icon:"exclamation-mark-triangle",title:c,message:s,closable:!0,onClose:()=>o(!0)})}return d};function Pe({messages:a}){return r`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${a.beta??"Beta"}>${a.beta??"Beta"}</calcite-chip>`}function Ne({popoverContent:a}){return r`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer label=legal-disclaimer placement=bottom auto-close focus-trap-disabled><div class="contained">${a}</div></calcite-popover>`}function qe({errorMessage:a,slot:e}){return r`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e??I}>${a}</calcite-input-message></div>`}function Ue({active:a,setActive:e,messages:t}){return r`<calcite-alert slot=alerts .open=${a} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} .label=${t.expressionapplied??"Expression applied"}><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function De({context:a,messages:e}){return a?r`<div class="gaps">${a.profileId&&r`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>`||""}</div>`:null}function Fe({isDisabled:a,isReadOnly:e,setQuestion:t,setIsViewingResult:i,textAreaRef:o,question:n,errorMessage:p,setErrorMessage:d,promptValidationMessage:c,setPromptValidationMessage:s,submitQuestion:h,messages:l,mode:$,assistantRef:O,context:x,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E}){let b=x?.contextTooLarge??!1,f=Ve({promptValidationMessage:c,errorMessage:p,contextTooBig:b,contextReducedNoticeDismissed:M,setContextReducedNoticeDismissed:E,setErrorMessage:d,messages:l});return r`<div class="text-area-wrapper">${Ee({notices:f})}<calcite-text-area scale=s resize=vertical .readOnly=${a||e} class=${X(f.length?"submission-text-area":"submission-text-area round-top")} .placeholder=${l.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${k=>{Re(k.target),t(k.target.value)}} ${K(o)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${x&&De({context:x,messages:l})||""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${$!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${a} @click=${async()=>{i(!1),t("")}} .label=${l.startover??"Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover??"Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${$!=="refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${a} @click=${async()=>{i(!1),t("")}} class="hidden-below-380" scale=s>${l.startover??"Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(d(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await h()}} class="hidden-below-380">${$==="prompt"?l.ask??"Generate":l.refine??"Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${a} .disabled=${a} @click=${async()=>{if(d(""),!n){s(l.enteraprompt??"Please enter a prompt");return}s(void 0),await h()}} class="hidden-above-380" .label=${$==="prompt"?l.ask??"Generate":l.refine??"Refine"}></calcite-button></div></div></div></calcite-text-area></div>`}var _e="https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement",Oe="https://www.esri.com/en-us/privacy/privacy-statements";function ze({setOpen:a,messages:e,feedback:t,setFeedback:i,onSubmit:o}){return t.active?r`<calcite-sheet class="feedback-sheet" .label=${e.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${()=>a(!1)}><calcite-panel .heading=${e.providefeedback??"Provide feedback"} .description=${e.experiencehelps??"Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${e.experiencehelpful??"Was the assistant helpful?"}<calcite-segmented-control scale=l .disabled=${t.submitting}><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value==="good"} @click=${()=>i({...t,value:"good"})}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value==="bad"} @click=${()=>i({...t,value:"bad"})}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience??"Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${n=>i({...t,text:n.target.value})} .disabled=${t.submitting}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${n=>{i({...t,termsAccepted:n.target.checked})}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement??"I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}",`<calcite-link href=${Oe} target="_blank">${e.esriprivacystatement??"Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}",`<calcite-link href=${_e} target="_blank">${e.supplement??"Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${o} .disabled=${!t.termsAccepted||t.submitting} .loading=${t.submitting}>${e.submitfeedback??"Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`:null}function ce({assistantsEnabled:a,messages:e,slot:t,assistantHelpUrl:i,helpTopicUrl:o}){return r`<calcite-block .label=${e.assistantinformation??"Assistant information"} slot=${t??I} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing??"Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new??"New"} kind=brand scale=s>${e.new??"New"}</calcite-chip></div><p>${e.capabilities??"The assistant uses artificial intelligence to generate Arcade expressions."}</p>${a?r`<p>${e.keepinmind??"Keep in mind the following:"}<ul><li>${e.beconsise??"Be concise, but also clear in your request"}</li><li>${e.avoidambiguity??"Avoid ambiguity and vagueness"}</li><li>${e.moredetails??"you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${C((e.seedocumentation??"Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}",`<calcite-link href=${o} target="_blank">${e.documentation??"documentation"}</calcite-link>`))}</p>`:r`<p>${C(e.useofassistant?.replace("{aiassistants}",`<strong>${e.aiassistants??"Ai Assistants"}</strong>`))}<calcite-link .href=${i} target=_blank icon-end=launch2>${e.configureassistants??"Configure Assistants"}</calcite-link></p>`}</calcite-block>`}function He({messages:a,onProceed:e,onExit:t,helpTopicUrl:i}){return r`<calcite-dialog close-disabled placement=top .heading=${a.welcome??"Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${a.beforeyougetstarted??"Before you get started be aware:"}</h3><ul><li>${a.maybeincorrect??"AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((a.pleasereadhelp??"Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}",`<calcite-link href=${i} target="_blank">${a.helptopic??"help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${a.proceed??"Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${a.exit??"Exit"}</calcite-button></calcite-dialog>`}function Be({messages:a,suggestions:e,onSuggestionClick:t}){return r`<calcite-block .heading=${a.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map(i=>r`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${a.promptsuggestion} class="suggestion-button" @click=${()=>t?.(i)}>${i}</calcite-button>`)}</div></calcite-block>`}var re=200;function le({hidden:a=!1,expanded:e=!1,messages:t,cards:i,heading:o,collapsible:n=!1,showEffectsIcon:p=!1,onCopyCode:d,standalone:c}){return r`<calcite-block .hidden=${a} id=result-block .heading=${o??t.besteffort??"Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${p&&r`<calcite-chip .label=${t.assistantresponses??"Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>`||""}<calcite-card-group .label=${t.assistantresponses??"Assistant responses"}>${N(i,s=>s.conversationId,s=>r`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length>re?`${s.priorPrompt.slice(0,re)}...`:s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} @click=${h=>{let l=h.currentTarget;navigator.clipboard.writeText(s.priorPrompt).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard??"Copy prompt to clipboard"}</calcite-tooltip></div>${s.message&&c&&r`<div class="response-error-container">${qe({errorMessage:s.message})}</div>`||""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext??"Response Context"} scale=s>${s.message&&!c&&r`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error??"Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>`||""}${Le({card:s,messages:t})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor??"Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start>${t.addtoeditor??"Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${()=>s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor??"Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${()=>s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.replaceineditor??"Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${h=>{let l=h.currentTarget;d(s.code).then(()=>{l.setAttribute("data-copied","true"),setTimeout(()=>l.removeAttribute("data-copied"),1500)})}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully??"copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully??"copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard??"Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup??"Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.helpful??"Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown??"Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${c?"standalone":"list"}`} placement=top-start><span>${t.unhelpful??"Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`}var Le=({card:a,messages:e})=>{let t=j(),i=`response-chip-profile-${a.conversationId}-${t}`,o=(e.profilecontextlabel??"Profile context: {profileId}").replace("{profileId}",a.profileId);return r`<calcite-tooltip .referenceElement=${i} placement=top-start class="contained-popover-or-tooltip">${o}</calcite-tooltip><calcite-chip .label=${a.profileId} scale=s appearance=outline icon=map-information id=${i??I}>${a.profileId}</calcite-chip>`},de=a=>a.type==="featureSet",q=a=>{if(!se(a))return[];let e=[];return a.relationships?.forEach(t=>{e.push(t.toJSON())}),e},U=a=>a.length>0?{relationships:a}:{},je=a=>ie(a).map(e=>({alias:e.alias,name:e.name,type:e.type,...e.domain?{domain:e.domain}:{}})),D=a=>a?{fields:je(a)}:{fields:[]};async function pe(a){let e=await a.loadSource(),t=V(e)&&e.isTable,i=q(e);return{name:a.name,type:"featureSet",isTable:t,...D(e?.fields),...U(i)}}async function be(a){switch(a.type){case"feature":{let e=await a.loadSource(),t=q(e);return{name:a.name,type:a.type,...D(e?.fields),...U(t)}}case"featureSet":{let e=await a.loadSource(),t=V(e)&&e.isTable;return{name:a.name,type:"featureSet",...t?{isTable:t}:{},...D(e?.fields),...U(q(e))}}case"featureSetCollection":{let e=await a.loadSource(),t=e?.layers.filter(de)??[],i=e?.tables.filter(de)??[],o=await Promise.all(t.map(pe)),n=await Promise.all(i.map(pe));return{name:a.name,type:"featureSetCollection",layers:o,tables:n}}case"dictionary":{let e=await Promise.all(a.dictionaryVariables.map(be));return{name:a.name,type:"dictionary",attributes:e}}case"pixel":{let e=await a.loadSource();if(!e)return{name:a.name,type:"pixel"};let t=await ke(e);return{name:a.name,type:"pixel",members:t.map(ue)}}case"voxel":{let e=await a.loadSource();if(!e)return{name:a.name,type:"voxel"};let t=await xe(e);return{name:a.name,type:"voxel",members:t.map(ue)}}case"array":return{name:a.name,type:"array",elementType:a.elementType.type};case"number":case"text":case"boolean":case"date":case"knowledgeGraph":case"dateOnly":case"geometry":case"time":return{name:a.name,type:a.type}}}function ue(a){return a.type==="array"?{name:a.name,type:"array",elementType:a.elementType.type}:{name:a.name,type:a.type}}async function Qe(a){return{variables:await Promise.all(a.variables.map(be))}}var Ge=1e5;function Je(a){let e=new TextEncoder().encode(a).length;return Math.ceil(e/3.5)}function F(a){return Je(JSON.stringify(a))}function We(a){let e=i=>({name:i.name,type:i.type,...i.isTable?{isTable:i.isTable}:{},...i.relationships?{relationships:i.relationships}:{}}),t=i=>{switch(i.type){case"feature":case"featureSet":case"knowledgeGraph":return{name:i.name,type:i.type,..."isTable"in i&&i.isTable?{isTable:i.isTable}:{},..."relationships"in i?{relationships:i.relationships}:{}};case"featureSetCollection":return{name:i.name,type:"featureSetCollection",layers:i.layers.map(e),tables:i.tables.map(e)};case"dictionary":return{name:i.name,type:"dictionary",attributes:i.attributes.map(t)};case"pixel":case"voxel":return{name:i.name,type:i.type};case"array":return{name:i.name,type:"array",...i.elementType?{elementType:i.elementType}:{}};default:return i}};return{variables:a.variables.map(t)}}function Ke(a){let e=a.variables,t=e.length,i=e.find(n=>n.name==="$feature")??e.find(n=>n.type==="feature")??e[0],o=i?[i]:[];return{context:{variables:o},wasReduced:t!==o.length,reducedToVariableName:i?.name}}function Ye(a){return F(a)>Ge}var Xe=Object.defineProperty,Ze=Object.getOwnPropertyDescriptor,m=(a,e,t,i)=>{for(var o=i>1?void 0:i?Ze(e,t):e,n=a.length-1,p;n>=0;n--)(p=a[n])&&(o=(i?p(e,t,o):p(o))||o);return i&&o&&Xe(e,t,o),o},u=class extends Se{constructor(a){super(a),this.viewMode="prompt",this.confirmationActive=!1,this.contextReducedNoticeDismissed=!1,this.splashActive=!0,this.isSubmitting=!1,this.question="",this.history=[],this.feedback={active:!1}}};m([g()],u.prototype,"viewMode",2);m([g()],u.prototype,"confirmationActive",2);m([g()],u.prototype,"contextReducedNoticeDismissed",2);m([g()],u.prototype,"splashActive",2);m([g()],u.prototype,"isSubmitting",2);m([g()],u.prototype,"errorMessage",2);m([g()],u.prototype,"promptValidationMessage",2);m([g()],u.prototype,"question",2);m([g()],u.prototype,"history",2);m([g()],u.prototype,"feedback",2);m([g()],u.prototype,"context",2);u=m([Te("ArcadeAssistantViewState")],u);var et="arcade_generation",tt="ArcadeCodeRequest",me="visualization",at="ArcadeAssistant",it=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras"],he=[],ge=!0,_=class extends Y{constructor(){super(...arguments),this.textAreaRef=W(),this.messages=ee(),this._feedbackService=void 0,this.viewState=new u,this.handleFeedbackButton=(e,t)=>{this.updateViewState({feedback:{active:!0,value:e,item:t,termsAccepted:!1,text:"",submitting:!1}})},this.handleFeedbackSheetClose=()=>{this.updateViewState({feedback:{active:!1}})},this.handleFeedbackSubmit=async()=>{if(!this.viewState.feedback.active)return;this.updateViewState({feedback:{...this.viewState.feedback,submitting:!0}});let e=await this.ensureFeedbackService();if(!e){this.handleFeedbackSheetClose();return}let t=this.viewState.feedback.item.contextSnapshot,i=we.applicationName;!i&&!this.appVersion&&y("warn",this,"esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");let{value:o,text:n,termsAccepted:p,item:{question:d,formattedScript:c,conversationId:s}}=this.viewState.feedback,h={user_evaluation:o,your_comments:n||void 0,question:d??"",answer:encodeURIComponent(c??""),useragent:navigator.userAgent,_source:at,version:this.appVersion||i||"NOT_SET",context:t?JSON.stringify(t):"",extras:t?.profileId??"",conversation_id:s??"",privacy_statement:p?"I_agree":""};try{await e.applyEdits({addFeatures:[new $e({attributes:h})]})}catch(l){y("error",this,"Error submitting feedback.",{detail:{error:l}})}this.handleFeedbackSheetClose()},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestionState=e=>{this.updateViewState({question:e,promptValidationMessage:void 0})},this.setFeedbackState=e=>{this.updateViewState({feedback:e})},this.onSuggestionClick=e=>{this.textAreaRef.value&&(this.textAreaRef.value.value=e,this.textAreaRef.value.setFocus(),this.setQuestionState(e))},this.helpBase="",this.assistantsEnabled=!1,this.closed=!1}static{this.properties={closePanel:0,insertText:0,helpBase:1,assistantsEnabled:5,portalUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1}}static{this.styles=Ae}get disclaimerComment(){return`// ${this.messages.disclaimercomment}
3
- // ${this.messages.disclaimerpt2??"AI-generated content may be inaccurate. Review before using."}`}get assistantHelpUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`}get assistantOverviewDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`}get usingTheAssitantDocUrl(){return`${this.helpBase??"https://doc.arcgis.com/en/arcgis-online/"}create-maps/use-arcade-assistant.htm`}async destroy(){}connectedCallback(){super.connectedCallback(),this.updateViewState({history:he,splashActive:ge})}load(){let e=async()=>{let t=this.getModel();if(!t){this.updateViewState({context:void 0});return}let i=await this.getProfileAndMetadata(t.uri);this.updateViewState({context:i,contextReducedNoticeDismissed:i.contextTooLarge?!1:this.viewState.contextReducedNoticeDismissed})};e().catch(t=>{y("error",this,"Error setting initial context.",{detail:{error:t}})}),this.manager.onLifecycle(()=>({remove:P.onModelContextDidChange(async()=>{e().catch(t=>{y("error",this,"Error setting context.",{detail:{error:t}})})}).dispose}))}disconnectedCallback(){super.disconnectedCallback(),he=this.viewState.history,ge=this.viewState.splashActive,this.copySuccessTimer&&(clearTimeout(this.copySuccessTimer),this.copySuccessTimer=void 0)}createFeedbackContextSnapshot(e){let t=We(e.metadata);return{...e,metadata:t,estimatedTokens:F(t)}}updateViewState(e){this.viewState.set(e)}getHistoryCards(){return this.viewState.history.reduce((e,t)=>(!t.script||(e.push({priorPrompt:t.question,code:t.formattedScript||t.error||"",profileId:t.profile??me,onAddToEditor:i=>{te(this.editorRef.editorInstance,t.formattedScript??"",i,this.disclaimerComment)},onThumbsUp:()=>this.handleFeedbackButton("good",t),onThumbsDown:()=>this.handleFeedbackButton("bad",t),conversationId:t.conversationId??"",message:t.message}),this.viewState.viewMode),e),[])}async ensureFeedbackService(){if(this._feedbackService)return this._feedbackService;if(!this.feedbackServiceUrl)return;let e=new ye({url:this.feedbackServiceUrl});await e.load();let t=it.filter(i=>!e.fields.some(o=>o.name===i));if(t.length>0){y("error",this,`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);return}return this._feedbackService=e,e}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(this.viewState.question){this.updateViewState({isSubmitting:!0,errorMessage:void 0});try{let e=await this.getToken(),t=this.getModel();if(!t)return;let i=this.viewState.context??await this.getProfileAndMetadata(t.uri),o=(await Ce({baseUrl:this.serviceUrl,skillId:et,message:this.viewState.question,authToken:e,context:{kind:tt,context:{profile_id:i.profileId,metadata:[i.metadata]}}})).find(n=>n.context?.kind==="ArcadeCodeResponse");if(!o)return;if(o.context?.kind==="ArcadeCodeResponse"){let n=this.createFeedbackContextSnapshot(i);this.updateViewState({history:[{script:o?.context?.arcadeCode?.code,formattedScript:ae(o?.context?.arcadeCode?.code??""),error:void 0,question:this.viewState.question,profile:i.profileId,conversationId:o.conversationId,contextSnapshot:n,...o.message?{message:o.message}:{}},...this.viewState.history],viewMode:"result",errorMessage:void 0})}}catch(e){e instanceof Error&&e.name==="ArcadeAssistantError"?this.updateViewState({errorMessage:Me(e)||this.messages.erroroccurred||"An error occurred."}):this.updateViewState({errorMessage:this.messages.erroroccurred||"An error occurred."}),y("error",this,"Error submitting question",{detail:{error:e}})}finally{this.updateViewState({isSubmitting:!1})}}}async getToken(){let{token:e}=await ve.getCredential(this.portalUrl);return e}async getProfileAndMetadata(e){let t=me,i=P.getEditorProfileForModel(e);i?.loaded||await i?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let n=i?await Qe(i):{variables:[]},p=Ye(n),d=p?Ke(n):void 0,c=d?d.context:n,s=F(c);return{profileId:t,metadata:c,contextTooLarge:p,reducedToVariableName:d?.reducedToVariableName,estimatedTokens:s}}onCopyCode(e){let t=e?`${this.disclaimerComment}
4
- ${e}`:"";return navigator.clipboard.writeText(t)}render(){if(this.closed)return null;let e=this.viewState.viewMode==="result",t=this.getHistoryCards();return this.assistantsEnabled?r`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive&&r`<calcite-scrim></calcite-scrim>`||""}${Pe({messages:this.messages})}${Ne({popoverContent:ce({assistantsEnabled:this.assistantsEnabled,messages:this.messages,assistantHelpUrl:this.assistantHelpUrl,helpTopicUrl:this.usingTheAssitantDocUrl})})}<calcite-shell class="unstyled-shell">${this.viewState.splashActive&&He({messages:this.messages,onProceed:()=>{this.updateViewState({splashActive:!1})},helpTopicUrl:this.assistantOverviewDocUrl,onExit:i=>this.closePanel?.(i)})||""}${Ue({active:this.viewState.confirmationActive,setActive:i=>this.updateViewState({confirmationActive:i}),messages:this.messages})}${Fe({isDisabled:this.viewState.isSubmitting,isReadOnly:!1,setQuestion:this.setQuestionState,setIsViewingResult:i=>this.updateViewState({viewMode:i?"result":"prompt"}),mode:e?"refine":"prompt",textAreaRef:this.textAreaRef,question:this.viewState.question,errorMessage:this.viewState.errorMessage,setErrorMessage:i=>this.updateViewState({errorMessage:i}),promptValidationMessage:this.viewState.promptValidationMessage,setPromptValidationMessage:i=>this.updateViewState({promptValidationMessage:i}),submitQuestion:this.submitQuestion.bind(this),assistantRef:this.el,messages:this.messages,context:this.viewState.context,contextReducedNoticeDismissed:this.viewState.contextReducedNoticeDismissed,setContextReducedNoticeDismissed:i=>this.updateViewState({contextReducedNoticeDismissed:i})})}<calcite-block-group label="interactive blocks">${!e&&!this.viewState.isSubmitting&&Be({messages:this.messages,suggestions:[this.messages.prompsuggestion1??"",this.messages.prompsuggestion2??""],onSuggestionClick:this.onSuggestionClick})||""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${le({expanded:e,messages:this.messages,collapsible:!0,showEffectsIcon:!0,cards:t.length?[t[0]]:[],heading:this.messages.besteffort??"Here's the assistant's best effort",hidden:this.viewState.isSubmitting||!e,onCopyCode:this.onCopyCode.bind(this),standalone:!0})}${le({expanded:!e,messages:this.messages,collapsible:!0,cards:e?t.slice(1):t,heading:this.messages.recentprompts??"Recent prompts",hidden:this.viewState.isSubmitting||this.viewState.history.length===0,onCopyCode:this.onCopyCode.bind(this)})}</calcite-block-group>${this.viewState.feedback.active?ze({setOpen:this.handleFeedbackSheetClose,messages:this.messages,onSubmit:this.handleFeedbackSubmit,feedback:this.viewState.feedback,setFeedback:this.setFeedbackState}):null}</calcite-shell></calcite-flow-item></calcite-flow>`:r`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${ce({slot:"content-top",messages:this.messages,assistantsEnabled:this.assistantsEnabled,assistantHelpUrl:this.assistantHelpUrl,helpTopicUrl:this.usingTheAssitantDocUrl})}</calcite-flow-item></calcite-flow>`}};Z("arcgis-arcade-coding-assistant",_);return _},"identity/IdentityManager","request","layers/FeatureLayer","config","Graphic","applications/Components/arcadeEditorUtils","core/Accessor","core/accessorSupport/decorators",a,b)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import d from"./A4GVNJO4.js";import c from"./AILSAJ35.js";import{a as L}from"./G3HPFTUI.js";import b from"./MGMAMY5S.js";import"./6KH4ZJW7.js";import a from"./2XS25MHS.js";import"./72CKSOAE.js";import"./4EAONLKN.js";import"./EMCHMKAC.js";import"./JUSMJGLC.js";import"./NMIFSDFV.js";import"./VVVV256M.js";import{D as y,E as D,F as C,G as r,J as I,K as B,h as E,j as i,l as f,n as $,s as R}from"./VZCGFCMK.js";import{a as w,b as o}from"./RXOG5OZ7.js";import"./E26VIEON.js";import"./CVNYRL2K.js";import"./NXRT3FAY.js";import{Rk as M}from"./YCOWKBW5.js";import"./ALDX5YZO.js";export default $arcgis.t(([O,,l,{a:T,b:F},{a:k,h:A}])=>{var j=E`: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)}}`,z="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",a=(s,e)=>w(s,"Arcade Assistant",e),H=s=>{let{aiAssistantsEnabled:e}=s;return e===void 0?(a("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},V=s=>!(!s||!("id"in s)),G=async s=>(await O.getCredential(s)).token;async function q({portalUrl:s,profile:e}){if(!V(e))return a("warn","Addon initialization failed. Reason: unsupported profile."),{shouldRender:!1};let t=s.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,""),n=await G(s),c=`${t}/sharing/rest/portals/self?f=json&token=${n}`,h=`${t}/sharing/rest/portals/self/settings?f=json&token=${n}`,p=`${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`,u=await Promise.allSettled([fetch(c,{credentials:"include"}).then(d=>d.json()),fetch(h,{credentials:"include"}).then(d=>d.json()),fetch(p,{credentials:"include"}).then(d=>d.json())]),[g,_,m]=u,S=g.status==="fulfilled"?g.value:(a("warn",`Failed to fetch selfUrl. Reason: ${g.reason}.`),{}),P=_.status==="fulfilled"?_.value:(a("warn",`Failed to fetch settingsUrl. Reason: ${_.reason}.`),{}),U=m.status==="fulfilled"?m.value:(a("warn",`Failed to fetch signinSettingsUrl. Reason: ${m.reason}.`),{}),x=S?.helperServices?.aiAssistantServices?.url;if(!x)return a("warn","Service URL is not available in the portal self response."),{shouldRender:!1};let N=S.helpBase||"";if(!P)return a("warn","Settings response is not available."),{shouldRender:!1};let v=H(P);return U.blockBetaApps===!0&&(a("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),v=!1),{shouldRender:!0,serviceUrl:x,helpBase:N,assistantsEnabled:v,feedbackServiceUrl:z}}var b=class extends C{constructor(){super(...arguments),this._codeEditorElt=y(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this.messages=L(),this._modelId=R(),this._openArcadeHelp=()=>void window.open(k,"Arcade Help"),this._toggleSidePanel=e=>{if(!e.target)return;let t=e.target?.dataset.panelName??"none";this.openedSidePanel=t===this.openedSidePanel?"none":t,this.openedSidePanel==="none"&&this._codeEditorElt.value?.setFocus().catch(o(this))},this._consoleLogs=[],this._executingScript=!1,this._preparingArcade=!1,this._resultPanel="output",this._showExecutionPanel=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.arcgisDiagnosticsChange=$({bubbles:!1}),this.arcgisScriptChange=$({bubbles:!1})}static{this.properties={_apiLibrary:16,_consoleLogs:16,_editorProfile:16,_executingScript:16,_executionResult:16,_preparingArcade:16,_resultPanel:16,_showExecutionPanel:16,_arcadeAssistantRemoteState:16,editorInstance:32,editorOptions:0,hideDocumentationActions:5,hideSideBar:5,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,arcadeAssistant:0}}static{this.styles=[j]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async getEditorInstance(){return await this._componentReadyDefer.promise,this._codeEditorElt.value?.editorInstance}async getScript(){return await this._componentReadyDefer.promise,this._codeEditorElt.value?.value}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 t=this._codeEditorElt.value?.value;return await A(e.definition,t,this.testData)}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async load(){let e=B("./assets");T(e),await this._updateDataModelDeps(),await this._updateArcadeAssistantRemoteState()}willUpdate(e){(e.has("messages")||e.has("profile"))&&this.hasUpdated&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("snippets")&&l.updateApiContextForModel(this._modelId,{snippets:this.snippets}),e.has("arcadeAssistant")&&this._updateArcadeAssistantRemoteState()}async loaded(){this._componentReadyDefer.resolve(),await this._updateApiLibrary();let e=await F();this._disposables.push(e.onDiagnosticsChange(t=>!this._preparingArcade&&this.arcgisDiagnosticsChange.emit(t.diagnostics))),this.testData&&this._addExecuteScriptAction()}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._showExecutionPanel&&this._executeScript().catch(o(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await l.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=l.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await l.getApiLibraryForModel(this._modelId)}async _executeScript(){let e=this.testData;if(!this._codeEditorElt.value||!e)return;let t=await this._editorProfilePromise;if(!t){this._executionResult={type:"error",value:"Missing editor profile",error:null};return}this._showExecutionPanel=!0,this._executingScript=!0,this._consoleLogs=[],setTimeout(()=>void(async()=>{let n=this._codeEditorElt.value?.value;this._executionResult=await A(t.definition,n,e,c=>setTimeout(()=>this._consoleLogs=[...this._consoleLogs,c],0)),this._executingScript=!1})(),0)}_toggleShowExecutionPanel(){this._showExecutionPanel=!this._showExecutionPanel}_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(o(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(o(this))}_onResultPanelChange(e){let t=e.currentTarget;this._resultPanel=t.openedResultPanel}_onExecutionPanelClose(){this._showExecutionPanel=!1}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[M.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript().catch(o(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_disposeSafely(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1),e.dispose()}async _updateArcadeAssistantRemoteState(){this.arcadeAssistant&&(this._arcadeAssistantRemoteState=await q({...this.arcadeAssistant,profile:this.profile}))}renderMainActionBar(){return this.testData?i`<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=${()=>void this._executeScript().catch(o(this))}></calcite-action>${this._executionResult?i`<calcite-action .text=${this.messages.lastresults??""} .active=${this._showExecutionPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`:null}renderMainPanel(){return i`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${l.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${D(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:t,icon:n,active:c,panelName:h,iconFlipRtl:p=!1,onClick:u=this._toggleSidePanel}){return i`<calcite-action id=${e??f} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${n} .active=${c} @click=${u} data-panel-name=${h??f} .iconFlipRtl=${p}></calcite-action>${!this.sideActionBarExpanded&&i`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:i`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e}=this;return i`<arcgis-language-api-panel slot=side-panel class=${r(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${r(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"}></arcgis-editor-variables>${this.suggestions?.length&&i`<arcgis-arcade-suggestions slot=side-panel class=${r(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${this.arcadeAssistant&&this._arcadeAssistantRemoteState.shouldRender&&i`<arcgis-arcade-coding-assistant slot=side-panel class=${r(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${this._arcadeAssistantRemoteState.serviceUrl} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(t=>i`<calcite-flow slot=side-panel class=${r(e===t.id?"":"hidden")}>${t?.useFlows?t.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==t.id,editorRef:this.el}):i`<calcite-flow-item .heading=${t.name} heading-level=2 closable .closed=${e!==t.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${t.description}>${t.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==t.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){return this._showExecutionPanel?i`<arcgis-arcade-results slot=results-panel .openedResultPanel=${this._resultPanel} .loading=${this._executingScript} .result=${this._executionResult} .consoleLogs=${this._consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`:null}render(){return i`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};I("arcgis-arcade-editor",b);return b},"identity/IdentityManager",a,b,c,d)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import c from"./VOKAILQ5.js";import{a}from"./2WEMCNJY.js";import{a as m}from"./G3HPFTUI.js";import"./6KH4ZJW7.js";import b from"./2XS25MHS.js";import"./72CKSOAE.js";import"./4EAONLKN.js";import"./EMCHMKAC.js";import"./JUSMJGLC.js";import"./NMIFSDFV.js";import"./VVVV256M.js";import{F as n,J as d,h as r,j as i,n as s}from"./VZCGFCMK.js";import"./RXOG5OZ7.js";import"./E26VIEON.js";import"./CVNYRL2K.js";import"./NXRT3FAY.js";import"./YCOWKBW5.js";import"./ALDX5YZO.js";export default $arcgis.t(([,h])=>{var g=r`:host{calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`,c=class extends n{constructor(){super(...arguments),this.messages=m(),this._filterValue="",this._flowItemRenderers=[],this._mutationCounter=1,this.loading=!1,this.arcgisClose=s({bubbles:!1}),this.arcgisFieldSelected=s({bubbles:!1})}static{this.properties={_filterValue:16,_flowItemRenderers:16,_mutationCounter:16,loading:5,modelId:1}}static{this.styles=g}willUpdate(t){t.has("modelId")&&(this._flowItemRenderers=[])}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}_handleSelectField(t){if(t.target instanceof HTMLElement)switch(t.target.tagName.toLowerCase()){case"calcite-list-item":{let e=t.target.value;this.arcgisFieldSelected.emit(e??"");break}case"calcite-action":t.stopPropagation();break}}_handleSelectDomain(t){let e=t.target.value;this.arcgisFieldSelected.emit(e?`'${e}'`:"")}_emitClose(){this.arcgisClose.emit()}render(){let t=h.getFeatureLayerForModel(this.modelId??"");return this.loading||!this.modelId||!t?i`<calcite-block .heading=${this.messages.availablefields??""}></calcite-block>`:i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.messages.availablefields??""} closable @calciteFlowItemClose=${this._emitClose}><calcite-list label=fields filter-enabled>${a(t.fields,e=>e.name,e=>i`<calcite-list-item @click=${this._handleSelectField} .label=${e.name} .description=${e.alias??""} .value=${e.name}>${e.domain&&i`<calcite-action slot=actions-end text=open icon=chevron-right @click=${()=>{let o=e.domain;o?.type==="coded-value"&&(this._flowItemRenderers=[...this._flowItemRenderers,()=>i`<calcite-flow-item closable heading-level=2 .heading=${this.messages.domainvalues??""} .description=${e.name} @calciteFlowItemClose=${this._emitClose}><calcite-list label=domains>${a(o.codedValues,l=>l.code,l=>i`<calcite-list-item @click=${this._handleSelectDomain} .label=${l.name} .description=${String(l.code)} .value=${String(l.code)}></calcite-list-item>`)}</calcite-list></calcite-flow-item>`])}}></calcite-action>`||""}</calcite-list-item>`)}</calcite-list></calcite-flow-item>${this._flowItemRenderers.map(e=>e())}</calcite-flow>`}};d("arcgis-sql-expression-fields",c);return c},b,c)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import c from"./W7GMC6R5.js";import"./X5YNEMIK.js";import b from"./VOKAILQ5.js";import"./72K7GT6K.js";import a from"./2XS25MHS.js";import"./72CKSOAE.js";import"./4EAONLKN.js";import"./EMCHMKAC.js";import"./JUSMJGLC.js";import"./NMIFSDFV.js";import"./VVVV256M.js";import"./VZCGFCMK.js";import"./RXOG5OZ7.js";import"./E26VIEON.js";import"./CVNYRL2K.js";import"./NXRT3FAY.js";import"./YCOWKBW5.js";import"./ALDX5YZO.js";export default $arcgis.t(([,,{a:a,b:b,c:c}])=>{return{getSqlExprDiagnosticService:b,getSqlExprWorker:a,setupMode:c}},a,b,c)
@@ -1,2 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import{a as f}from"./X5YNEMIK.js";import a from"./VOKAILQ5.js";import{a as I}from"./72K7GT6K.js";import{a as h}from"./EMCHMKAC.js";import{b as l}from"./RXOG5OZ7.js";import{Qk as T,al as u}from"./YCOWKBW5.js";export default $arcgis.t(([g])=>{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 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- async function t(){return await import("./UHVSUPMQ.js").then(m=>m.default)}export{t as a};
@@ -1 +0,0 @@
1
- {"availablefields":"الحقول المتاحة","domainvalues":"قيم النطاق"}
@@ -1 +0,0 @@
1
- {"availablefields":"Налични Полета","domainvalues":"Стойности на домейн"}
@@ -1 +0,0 @@
1
- {"availablefields":"Dostupna polja","domainvalues":"Vrijednosti domene"}
@@ -1 +0,0 @@
1
- {"availablefields":"Camps disponibles","domainvalues":"Valors de domini"}
@@ -1 +0,0 @@
1
- {"availablefields":"Dostupná pole","domainvalues":"Hodnoty domény"}
@@ -1 +0,0 @@
1
- {"availablefields":"Tilgængelige felter","domainvalues":"Domæneværdier"}
@@ -1 +0,0 @@
1
- {"availablefields":"Verfügbare Felder","domainvalues":"Domänenwerte"}
@@ -1 +0,0 @@
1
- {"availablefields":"Διαθέσιμα πεδία","domainvalues":"Τιμές τομέα"}
@@ -1 +0,0 @@
1
- {"availablefields":"Available Fields","domainvalues":"Domain Values"}
@@ -1 +0,0 @@
1
- {"availablefields":"Campos disponibles","domainvalues":"Valores del dominio"}
@@ -1 +0,0 @@
1
- {"availablefields":"Saadaolevad väljad","domainvalues":"Domeeni väärtused"}
@@ -1 +0,0 @@
1
- {"availablefields":"Käytettävissä olevat kentät","domainvalues":"Arvoalueen arvot"}
@@ -1 +0,0 @@
1
- {"availablefields":"Champs disponibles","domainvalues":"Valeurs de domaine"}
@@ -1 +0,0 @@
1
- {"availablefields":"שדות זמינים","domainvalues":"ערכי דומיין"}
@@ -1 +0,0 @@
1
- {"availablefields":"Dostupna polja","domainvalues":"Vrijednosti domene"}
@@ -1 +0,0 @@
1
- {"availablefields":"Rendelkezésre álló mezők","domainvalues":"Tartományértékek"}
@@ -1 +0,0 @@
1
- {"availablefields":"Kolom yang Tersedia","domainvalues":"Nilai Domain"}
@@ -1 +0,0 @@
1
- {"availablefields":"Campi disponibili","domainvalues":"Valori di dominio"}
@@ -1 +0,0 @@
1
- {"availablefields":"利用可能なフィールド","domainvalues":"ドメイン値"}
@@ -1 +0,0 @@
1
- {"availablefields":"사용 가능한 필드","domainvalues":"도메인 값"}
@@ -1 +0,0 @@
1
- {"availablefields":"Galimi laukai","domainvalues":"Domenų reikšmės"}
@@ -1 +0,0 @@
1
- {"availablefields":"Pieejamie lauki","domainvalues":"Domēna vērtības"}
@@ -1 +0,0 @@
1
- {"availablefields":"Beschikbare velden","domainvalues":"Domeinwaarden"}
@@ -1 +0,0 @@
1
- {"availablefields":"Tilgjengelige felter","domainvalues":"Domeneverdi"}
@@ -1 +0,0 @@
1
- {"availablefields":"Dostępne pola","domainvalues":"Wartości domeny"}
@@ -1 +0,0 @@
1
- {"availablefields":"Campos Disponíveis","domainvalues":"Valores de Domínio"}
@@ -1 +0,0 @@
1
- {"availablefields":"Campos disponíveis","domainvalues":"Valores de Domínio"}
@@ -1 +0,0 @@
1
- {"availablefields":"Câmpuri disponibile","domainvalues":"Valori de domeniu"}
@@ -1 +0,0 @@
1
- {"availablefields":"Доступные поля","domainvalues":"Значения домена"}
@@ -1 +0,0 @@
1
- {"availablefields":"Dostupné stĺpce","domainvalues":"Doménové hodnoty"}
@@ -1 +0,0 @@
1
- {"availablefields":"Razpoložljiva polja","domainvalues":"Vrednosti domen"}
@@ -1 +0,0 @@
1
- {"availablefields":"Dostupna polja","domainvalues":"Vrednosti domena"}
@@ -1 +0,0 @@
1
- {"availablefields":"Tillgängliga fält","domainvalues":"Domänvärden"}
@@ -1 +0,0 @@
1
- {"availablefields":"ฟิลด์ที่พร้อมใช้งาน","domainvalues":"ค่าโดเมน"}
@@ -1 +0,0 @@
1
- {"availablefields":"Kullanılabilir Alanlar","domainvalues":"Domain Değerleri"}
@@ -1 +0,0 @@
1
- {"availablefields":"Доступні поля","domainvalues":"Значення домену"}
@@ -1 +0,0 @@
1
- {"availablefields":"Trường Khả dụng","domainvalues":"Các Giá trị Domain"}
@@ -1 +0,0 @@
1
- {"availablefields":"可用字段","domainvalues":"域值"}
@@ -1 +0,0 @@
1
- {"availablefields":"可用欄位","domainvalues":"網域值"}
@@ -1 +0,0 @@
1
- {"availablefields":"可用欄位","domainvalues":"網域值"}
@@ -1,59 +0,0 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
- import { c as o } from "../../chunks/runtime.js";
3
- import { repeat as a } from "lit/directives/repeat.js";
4
- import { css as r, html as i } from "lit";
5
- import { LitElement as n, createEvent as c } from "@arcgis/lumina";
6
- import { a as m } from "../../chunks/sql-expr-defaults.js";
7
- import { u as d } from "../../chunks/useT9n.js";
8
- const h = r`:host{calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
9
- class g extends n {
10
- constructor() {
11
- super(...arguments), this.messages = d(), this._filterValue = "", this._flowItemRenderers = [], this._mutationCounter = 1, this.loading = !1, this.arcgisClose = c({ bubbles: !1 }), this.arcgisFieldSelected = c({ bubbles: !1 });
12
- }
13
- static {
14
- this.properties = { _filterValue: 16, _flowItemRenderers: 16, _mutationCounter: 16, loading: 5, modelId: 1 };
15
- }
16
- static {
17
- this.styles = h;
18
- }
19
- willUpdate(t) {
20
- t.has("modelId") && (this._flowItemRenderers = []);
21
- }
22
- disconnectedCallback() {
23
- super.disconnectedCallback(), this._flowObserver?.disconnect();
24
- }
25
- _handleSelectField(t) {
26
- if (t.target instanceof HTMLElement)
27
- switch (t.target.tagName.toLowerCase()) {
28
- case "calcite-list-item": {
29
- const s = t.target.value;
30
- this.arcgisFieldSelected.emit(s ?? "");
31
- break;
32
- }
33
- case "calcite-action":
34
- t.stopPropagation();
35
- break;
36
- }
37
- }
38
- _handleSelectDomain(t) {
39
- const e = t.target.value;
40
- this.arcgisFieldSelected.emit(e ? `'${e}'` : "");
41
- }
42
- _emitClose() {
43
- this.arcgisClose.emit();
44
- }
45
- render() {
46
- const t = m.getFeatureLayerForModel(this.modelId ?? "");
47
- return this.loading || !this.modelId || !t ? i`<calcite-block .heading=${this.messages.availablefields ?? ""}></calcite-block>` : i`<calcite-flow><calcite-flow-item heading-level=2 .heading=${this.messages.availablefields ?? ""} closable @calciteFlowItemClose=${this._emitClose}><calcite-list label=fields filter-enabled>${a(t.fields, (e) => e.name, (e) => i`<calcite-list-item @click=${this._handleSelectField} .label=${e.name} .description=${e.alias ?? ""} .value=${e.name}>${e.domain && i`<calcite-action slot=actions-end text=open icon=chevron-right @click=${() => {
48
- const s = e.domain;
49
- s?.type === "coded-value" && (this._flowItemRenderers = [
50
- ...this._flowItemRenderers,
51
- () => i`<calcite-flow-item closable heading-level=2 .heading=${this.messages.domainvalues ?? ""} .description=${e.name} @calciteFlowItemClose=${this._emitClose}><calcite-list label=domains>${a(s.codedValues, (l) => l.code, (l) => i`<calcite-list-item @click=${this._handleSelectDomain} .label=${l.name} .description=${String(l.code)} .value=${String(l.code)}></calcite-list-item>`)}</calcite-list></calcite-flow-item>`
52
- ]);
53
- }}></calcite-action>` || ""}</calcite-list-item>`)}</calcite-list></calcite-flow-item>${this._flowItemRenderers.map((e) => e())}</calcite-flow>`;
54
- }
55
- }
56
- o("arcgis-sql-expression-fields", g);
57
- export {
58
- g as SqlExpressionFields
59
- };
@@ -1,7 +0,0 @@
1
- import "@esri/calcite-components/components/calcite-block";
2
- import "@esri/calcite-components/components/calcite-flow";
3
- import "@esri/calcite-components/components/calcite-flow-item";
4
- import "@esri/calcite-components/components/calcite-list";
5
- import "@esri/calcite-components/components/calcite-list-item";
6
- import "@esri/calcite-components/components/calcite-action";
7
- export * from "./customElement.js";