@esri/solutions-components 5.1.0-next.168 → 5.1.0-next.169

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 (97) hide show
  1. package/dist/cdn/{MXF4BYLT.js → 6F7QJJQO.js} +1 -1
  2. package/dist/cdn/{BU6BDYWD.js → CONTIW5Q.js} +4 -4
  3. package/dist/cdn/{YPBSKBT2.js → D6U5SMQX.js} +1 -1
  4. package/dist/cdn/{2LCG2XWX.js → ESJJVBZM.js} +1 -1
  5. package/dist/cdn/{ZWL4JFKS.js → IZSQYFWM.js} +1 -1
  6. package/dist/cdn/{BYOO7TWU.js → JINR6G2D.js} +1 -1
  7. package/dist/cdn/{CVHZAZLS.js → RLMMQ5UC.js} +1 -1
  8. package/dist/cdn/{UOQSRV3X.js → S26SZJC7.js} +3 -2
  9. package/dist/cdn/{LXGPZJIZ.js → S7HFWITF.js} +1 -1
  10. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ar.json +1 -1
  11. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bg.json +1 -1
  12. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.bs.json +1 -1
  13. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ca.json +1 -1
  14. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.cs.json +1 -1
  15. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.da.json +1 -1
  16. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.de.json +1 -1
  17. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.el.json +1 -1
  18. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.es.json +1 -1
  19. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.et.json +1 -1
  20. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fi.json +1 -1
  21. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.fr.json +1 -1
  22. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.he.json +1 -1
  23. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hr.json +1 -1
  24. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.hu.json +1 -1
  25. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.id.json +1 -1
  26. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.it.json +1 -1
  27. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ja.json +1 -1
  28. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ko.json +1 -1
  29. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lt.json +1 -1
  30. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.lv.json +1 -1
  31. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.nl.json +1 -1
  32. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.no.json +1 -1
  33. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pl.json +1 -1
  34. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-BR.json +1 -1
  35. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.pt-PT.json +1 -1
  36. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ro.json +1 -1
  37. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.ru.json +1 -1
  38. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sk.json +1 -1
  39. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sl.json +1 -1
  40. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sr.json +1 -1
  41. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.sv.json +1 -1
  42. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.th.json +1 -1
  43. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.tr.json +1 -1
  44. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.uk.json +1 -1
  45. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.vi.json +1 -1
  46. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-CN.json +1 -1
  47. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-HK.json +1 -1
  48. package/dist/cdn/assets/arcgis-solutions-assistant/t9n/messages.zh-TW.json +1 -1
  49. package/dist/cdn/assets/solution-details-card/t9n/messages.ar.json +1 -1
  50. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ar.json +1 -1
  51. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bg.json +1 -1
  52. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.bs.json +1 -1
  53. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ca.json +1 -1
  54. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.cs.json +1 -1
  55. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.da.json +1 -1
  56. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.de.json +1 -1
  57. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.el.json +1 -1
  58. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.es.json +1 -1
  59. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.et.json +1 -1
  60. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fi.json +1 -1
  61. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.fr.json +1 -1
  62. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.he.json +1 -1
  63. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hr.json +1 -1
  64. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.hu.json +1 -1
  65. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.id.json +1 -1
  66. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.it.json +1 -1
  67. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ja.json +1 -1
  68. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ko.json +1 -1
  69. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lt.json +1 -1
  70. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.lv.json +1 -1
  71. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.nl.json +1 -1
  72. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.no.json +1 -1
  73. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pl.json +1 -1
  74. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-BR.json +1 -1
  75. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.pt-PT.json +1 -1
  76. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ro.json +1 -1
  77. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.ru.json +1 -1
  78. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sk.json +1 -1
  79. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sl.json +1 -1
  80. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sr.json +1 -1
  81. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.sv.json +1 -1
  82. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.th.json +1 -1
  83. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.tr.json +1 -1
  84. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.uk.json +1 -1
  85. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.vi.json +1 -1
  86. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-CN.json +1 -1
  87. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-HK.json +1 -1
  88. package/dist/cdn/assets/solutions-deploy-app/t9n/messages.zh-TW.json +1 -1
  89. package/dist/cdn/index.js +1 -1
  90. package/dist/chunks/assessBuildRequest.js +3 -2
  91. package/dist/chunks/converter.js +1 -1
  92. package/dist/components/arcgis-solutions-assistant/customElement.js +307 -289
  93. package/dist/docs/api.json +1 -1
  94. package/dist/docs/docs.json +1 -1
  95. package/dist/docs/web-types.json +1 -1
  96. package/dist/solutions-components_commit.txt +6 -6
  97. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import d from"./DFHULDJT.js";import"./HYQVSB6C.js";import c from"./CVHZAZLS.js";import"./2TEBTKD4.js";import"./YUWXPLTE.js";import"./NQH7ZZWD.js";import"./2LCG2XWX.js";import"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import"./2B4SGB3I.js";import"./RLSY4VUQ.js";import"./RDRCAA3H.js";import"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./HIPZRG2Q.js";import"./T3EPRHTT.js";import"./EXBEKVP5.js";export default $arcgis.t(([,,,{b:o}])=>{return o},a,b,c,d)
2
+ import d from"./DFHULDJT.js";import"./HYQVSB6C.js";import c from"./RLMMQ5UC.js";import"./2TEBTKD4.js";import"./YUWXPLTE.js";import"./NQH7ZZWD.js";import"./ESJJVBZM.js";import"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import"./2B4SGB3I.js";import"./RLSY4VUQ.js";import"./RDRCAA3H.js";import"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./HIPZRG2Q.js";import"./T3EPRHTT.js";import"./EXBEKVP5.js";export default $arcgis.t(([,,,{b:o}])=>{return o},a,b,c,d)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{d as _r,e as to,f as Li,g as Di,h as Fi}from"./NQH7ZZWD.js";import{a as Ni}from"./2LCG2XWX.js";import{a as ic,b as ac,c as lc,f as rs,g as ns,j as cc}from"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import{b as jl,c as zl}from"./2B4SGB3I.js";import{b as Ii}from"./RLSY4VUQ.js";import"./RDRCAA3H.js";import{a as Fl}from"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import{$ as Gl,Aa as Qo,Ab as ts,Ba as Yo,Bb as fe,Ca as Xo,Da as yr,Ea as w,Fa as N,Ga as Ri,Ha as $i,J as Kl,K as Ae,L as Wl,M as qo,N as Si,O as Ei,P as Bo,Q as Yn,R as q,Ra as S,S as Ci,T as j,U as Be,V as it,W as Ko,X as Hl,Y as Vl,Z as ki,_ as Wo,a as me,aa as Jl,b as K,ba as Xn,ca as Ho,da as Zl,ea as Ql,fa as Yl,g as Bl,ga as Vo,ha as Xl,ia as Pt,j as qe,ja as Oi,k as Ot,ka as Go,kb as sc,la as $,ma as x,na as Mt,oa as at,pa as ec,qa as Jo,ra as tc,s as Uo,sa as rc,ta as Zo,ua as Pi,va as gr,wa as Mi,wb as eo,xa as nc,y as Qn,ya as oc,zb as es}from"./RDJIKSXN.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import{l as Ul,v as Ti}from"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import{b as Dl}from"./HIPZRG2Q.js";import{F as $l,G as Nl,H as Ll,L as vi,h as Cl,i as st,k as kl,l as Ai,q as xi,t as Ol,w as Pl,x as Ml,y as Rl}from"./T3EPRHTT.js";import{c as El}from"./EXBEKVP5.js";export default $arcgis.t(([gl,uW,pW,Hd,Ig,Tg,Dg,_W,bW,CG,rA,dp,pr,Ja,_p,,pp,Ug,{addressToLocations:qg},Bg,Kg,wp,{createRenderer:Wg},{getSchemesByTag:Hg,getSchemes:Vg},{getBackgroundColorTheme:mp},{createAgeRenderer:Gg,createContinuousRenderer:Jg},{getSchemesByTag:sl},{createContinuousRenderer:Zg},{createRenderer:Qg},{getSchemesByTag:Yg},{createRenderer:Xg},{getSchemesByTag:ey},{createRenderer:ty},{getSchemesByTag:ry},{createRenderer:ny},{getSchemesByTag:oy},{createAgeRenderer:sy,createContinuousRenderer:iy},{createRenderer:ay},{getSchemesByTag:ly},cy,bp,Ap,{formatDateOnly:uy,convertDateFormatToIntlOptions:Gs,formatTimeOnly:dy,formatDate:fp},py,my,fy,hy,gy,xp,,{fetchKnowledgeGraph:hp,executeQueryStreaming:yy,executeSearchStreaming:_y},wy,,,,,,,,,,,,,,,,,,,,,,,,,kV,PV,,,,,,,,,,,,,yA,Lp,_A,tJ,nJ,LA,DA,{r:ql},{r:Zn}])=>{var ro=class extends Rl{constructor(e){if(super(e),this.it=Ai,e.type!==Pl.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Ai||e==null)return this._t=void 0,this.it=e;if(e===kl)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 r=[e];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};ro.directiveName="unsafeHTML",ro.resultType=1;var uc=Ml(ro);var d=w;async function os(t,e,r){if(r===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
2
+ import{d as _r,e as to,f as Li,g as Di,h as Fi}from"./NQH7ZZWD.js";import{a as Ni}from"./ESJJVBZM.js";import{a as ic,b as ac,c as lc,f as rs,g as ns,j as cc}from"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import{b as jl,c as zl}from"./2B4SGB3I.js";import{b as Ii}from"./RLSY4VUQ.js";import"./RDRCAA3H.js";import{a as Fl}from"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import{$ as Gl,Aa as Qo,Ab as ts,Ba as Yo,Bb as fe,Ca as Xo,Da as yr,Ea as w,Fa as N,Ga as Ri,Ha as $i,J as Kl,K as Ae,L as Wl,M as qo,N as Si,O as Ei,P as Bo,Q as Yn,R as q,Ra as S,S as Ci,T as j,U as Be,V as it,W as Ko,X as Hl,Y as Vl,Z as ki,_ as Wo,a as me,aa as Jl,b as K,ba as Xn,ca as Ho,da as Zl,ea as Ql,fa as Yl,g as Bl,ga as Vo,ha as Xl,ia as Pt,j as qe,ja as Oi,k as Ot,ka as Go,kb as sc,la as $,ma as x,na as Mt,oa as at,pa as ec,qa as Jo,ra as tc,s as Uo,sa as rc,ta as Zo,ua as Pi,va as gr,wa as Mi,wb as eo,xa as nc,y as Qn,ya as oc,zb as es}from"./RDJIKSXN.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import{l as Ul,v as Ti}from"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import{b as Dl}from"./HIPZRG2Q.js";import{F as $l,G as Nl,H as Ll,L as vi,h as Cl,i as st,k as kl,l as Ai,q as xi,t as Ol,w as Pl,x as Ml,y as Rl}from"./T3EPRHTT.js";import{c as El}from"./EXBEKVP5.js";export default $arcgis.t(([gl,uW,pW,Hd,Ig,Tg,Dg,_W,bW,CG,rA,dp,pr,Ja,_p,,pp,Ug,{addressToLocations:qg},Bg,Kg,wp,{createRenderer:Wg},{getSchemesByTag:Hg,getSchemes:Vg},{getBackgroundColorTheme:mp},{createAgeRenderer:Gg,createContinuousRenderer:Jg},{getSchemesByTag:sl},{createContinuousRenderer:Zg},{createRenderer:Qg},{getSchemesByTag:Yg},{createRenderer:Xg},{getSchemesByTag:ey},{createRenderer:ty},{getSchemesByTag:ry},{createRenderer:ny},{getSchemesByTag:oy},{createAgeRenderer:sy,createContinuousRenderer:iy},{createRenderer:ay},{getSchemesByTag:ly},cy,bp,Ap,{formatDateOnly:uy,convertDateFormatToIntlOptions:Gs,formatTimeOnly:dy,formatDate:fp},py,my,fy,hy,gy,xp,,{fetchKnowledgeGraph:hp,executeQueryStreaming:yy,executeSearchStreaming:_y},wy,,,,,,,,,,,,,,,,,,,,,,,,,kV,PV,,,,,,,,,,,,,yA,Lp,_A,tJ,nJ,LA,DA,{r:ql},{r:Zn}])=>{var ro=class extends Rl{constructor(e){if(super(e),this.it=Ai,e.type!==Pl.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===Ai||e==null)return this._t=void 0,this.it=e;if(e===kl)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 r=[e];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}};ro.directiveName="unsafeHTML",ro.resultType=1;var uc=Ml(ro);var d=w;async function os(t,e,r){if(r===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
3
3
 
4
4
  If you continue to see this error, please import from "@langchain/core/callbacks/dispatch/web"`,"and explicitly pass in a config parameter.",`
5
5
 
@@ -327,8 +327,8 @@ Alias: {alias}
327
327
  Description: {description}`,sJ=w.object({schemaVersion:w.literal(kA),modified:w.number().int().nonnegative(),embeddings:w.object({modelProvider:w.literal(OA),model:w.literal(PA),dimensions:w.literal(zo),templates:w.object({layer:w.string().default(MA),field:w.string().default(RA)})}),layers:w.array(w.object({id:w.string().min(1),name:w.string().min(1),title:w.string().catch(""),description:w.string().catch(""),vector:w.array(w.number()).length(zo,{message:`Layer vector must be exactly ${zo} dimensions`}),fields:w.array(w.object({name:w.string().min(1),alias:w.string().catch(""),description:w.string().catch(""),vector:w.array(w.number()).length(zo,{message:`Field vector must be exactly ${zo} dimensions`})}))})).default([])});var $A=(t,e)=>{let r=Yo.fromTemplate(t);return Xo.fromMessages([r,...e])};var Fp=async t=>{let{promptText:e,modelTier:r="default",temperature:n=0,messages:o,inputVariables:s,schema:i}=t,a=$A(e,o??[]),c=(await EA(r,n)).withStructuredOutput(i);return await a.pipe(c).invoke(s??{})};var NA=d.object({name:d.string(),description:d.string(),valueType:d.string(),alias:d.string()}),iJ=d.object({fields:d.array(NA)});var aJ=d.object({title:d.string(),description:d.string(),name:d.string().nullable()});var FA=Cl`:host{display:block;height:100%}.margin-lg{margin:var(--calcite-spacing-lg)}.display-flex-row{display:flex;flex-direction:row}.assistant-split-container{display:flex;width:100%;height:calc(100vh - 78px);overflow:hidden;border-radius:10px}.assistant-panel{display:flex;flex-direction:column;height:100%;border:1px solid var(--calcite-color-surface-3);background-color:var(--calcite-color-surface-2);overflow:hidden}.chat-panel{min-width:320px}.builder-panel{min-width:320px;max-width:100%;border-left:1px solid var(--calcite-color-surface-3)}.panel-actions{display:flex;gap:8px;padding:6px;align-items:center}.builder-header,.builder-footer{padding:10px;background:var(--calcite-color-surface-1);border-bottom:1px solid var(--calcite-color-surface-3)}.builder-content{flex:1;overflow:auto;padding:12px}.builder-content pre{white-space:pre-wrap;word-wrap:break-word;max-height:100%;overflow:auto}.builder-actions{display:flex;gap:6px;align-items:center}.padding-left-10{padding-left:10px}.chat-container{display:flex;flex-direction:column;gap:0px;max-width:600px;height:75%;background-color:var(--calcite-color-surface-4);padding:1px}.chat-container_expanded{display:flex;flex-direction:column;gap:0px;max-width:100%;height:95%;background-color:var(--calcite-color-surface-1);border-radius:10px;padding:10px}.chat-panel{--calcite-color-focus: var(--calcite-color-brand);--calcite-panel-border-color: var(--calcite-color-border-2);--calcite-internal-panel-header-vertical-padding: 0px;--calcite-panel-header-content-space: 0px;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-2);height:100%}.header-content{display:flex;align-items:center;gap:var(--calcite-spacing-sm);height:65px;box-sizing:border-box;padding-inline-start:var(--calcite-space-2xl)}@media(resolution:1.25dppx),(resolution:1.75dppx){.chat-panel{margin-top:.5px}}.header-title{font-size:var(--calcite-font-size-md);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1)}.beta-chip{--calcite-chip-corner-radius: var(--calcite-corner-radius-half)}.chat-panel calcite-card,.chat-panel calcite-text-area,.chat-panel calcite-button,.chat-panel .chat-messages,.chat-panel .chat-input{--calcite-color-focus: var(--calcite-color-brand)}.assistant-followup-chip:focus{outline:2px solid var(--calcite-color-brand)}.chat-panel-heading{font-size:var(--calcite-font-size-0);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-surface-1, var(--calcite-color-text-1))}.chat-messages{display:flex;flex-direction:column;gap:20px;padding:4px;height:100%;overflow-y:auto}.user-message{align-self:flex-end;background:var(--calcite-color-brand);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-brand);--calcite-card-border-color: var(--calcite-color-brand);color:var(--calcite-color-text-inverse);text-align:left}.system-message{align-self:flex-start;background:var(--calcite-color-surface-3);border-radius:8px;max-width:90%;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4);color:var(--calcite-color-inverse);text-align:left}.loader-message{align-self:flex-start;background:var(--calcite-color-surface-4);border-radius:8px;--calcite-card-corner-radius: 8px;--calcite-card-background-color: var(--calcite-color-surface-4);--calcite-card-border-color: var(--calcite-color-surface-4)}.message-content{padding:0;font-size:14px}.response-message.message-content>p:first-of-type{margin-top:0}.message-content img{max-width:100%;height:auto;display:block;object-fit:contain}.message-content-pad{padding-bottom:10px;font-size:14px}.message-content-summary{padding-bottom:14px}.message-content-alignment{display:flex;align-items:center;gap:var(--calcite-spacing-md);font-size:var(--calcite-font-size--1);color:var(--calcite-color-text-1)}.padding-top-10{padding-top:10px}.padding-right-8{padding-right:8px}.padding-left-right-5{padding-right:5px;padding-left:5px}.chip-content{padding:5px 5px 5px 0}.chat-input{display:flex;flex-direction:row;flex-grow:1}.table-cell{--calcite-table-cell-background: var(--calcite-color-surface-4)}.cursor-pointer{cursor:pointer}.notice-border-color{--temp-initial-brand: var(--calcite-color-brand)}.notice-border-color calcite-notice{--calcite-color-brand: #ddd;--calcite-icon-color: var(--temp-initial-brand)}.notice-border-color calcite-notice *{--calcite-color-brand: var(--temp-initial-brand)}.solution-card{padding:5px 0;text-decoration:none;display:block;width:100%;cursor:pointer}.solution-card calcite-card{display:flex;flex-direction:column;max-width:520px;overflow:hidden;--calcite-card-corner-radius: var(--calcite-corner-radius-round) !important;--calcite-card-shadow: var(--calcite-shadow-sm);--calcite-card-background-color: var(--calcite-card-background-color) }.solution-card div[slot=thumbnail]{max-height:100%;width:100%;position:relative;&:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;transition:all .15s ease-in-out}}.solution-card div[slot=thumbnail] img{max-height:100%;width:100%;object-fit:cover}.solution-card span[slot=description]{padding-top:10px}.solution-card calcite-chip{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);visibility:hidden;pointer-events:none;opacity:0;transition:all .15s ease-in-out;z-index:9999}.solution-card:hover calcite-chip{visibility:visible;opacity:1}.solution-card:hover div[slot=thumbnail]:after{background-color:#00000080}.solution-card:hover h3{text-decoration:underline}.solution-card:focus{outline:2px solid var(--calcite-color-brand)}.references-container{padding-top:10px;display:block}.references-container.collapsed{display:none}.width-100{width:100%}.disclaimer-div{display:flex;align-items:center;gap:var(--calcite-spacing-sm);font-size:var(--calcite-font-size--0);color:var(--calcite-color-text-1)}.display-none{display:none}.chat-messages calcite-fab{position:absolute;bottom:16px;left:50%;transform:translate(-50%);z-index:999}.icon-color-background{--calcite-button-icon-color: var(--calcite-color-surface-1)}#closeAssistantButton{--calcite-action-text-color: var(--calcite-color-text-1)}.icon-color-background:focus{--calcite-color-focus: var(--calcite-color-surface-1)}@media(max-width:430px){.solution-card .solution-snippet{display:none}}.height-32-flex-auto{height:32px;flex:0 0 auto}.margin-top-0.message-content>p:first-of-type{margin-top:0}a:not(.solution-card){color:var(--calcite-link-text-color, var(--calcite-color-text-link));cursor:pointer;text-decoration:none;line-height:inherit;background-image:linear-gradient(currentColor,currentColor),linear-gradient(var(--calcite-color-brand-underline),var(--calcite-color-brand-underline));background-position-x:0%,100%;background-position-y:min(1.5em,100%);background-repeat:no-repeat,no-repeat;background-size:0% 1px,100% 1px;transition-property:background-size,color;transition-duration:var(--calcite-animation-timing, .15s);transition-timing-function:ease-in-out;outline-color:transparent;position:relative}a:not(.solution-card):hover{background-size:100% 1px,100% 1px}a:not(.solution-card):focus{outline:2px solid var(--calcite-color-brand);outline-offset:2px;outline-color:var(--calcite-color-brand)}a:not(.solution-card):active{color:var(--calcite-color-brand-press)}`;async function be(t,e){let r=Object.entries(t).find(([n])=>n.endsWith(`/${e}.md`));if(!r)throw new Error(`Prompt not found: ${e}
328
328
  Available prompts:
329
329
  ${Object.keys(t).join(`
330
- `)}`);return await r[1]()}function _i(t){return t?.configurable?.context?.translations}function Up(t){if(typeof window>"u"||t.length<=1)return;let e=t.map(n=>n.solution.id),r=t.map(n=>n.solution.title);window.dispatchEvent(new CustomEvent("searchTermSet",{detail:{scope:"all-solutions",searchTerm:""}})),window.dispatchEvent(new CustomEvent("solutionMatchesFromAssistant",{detail:{solutionIds:e,solutionTitles:r},bubbles:!0,composed:!0})),window.dispatchEvent(new CustomEvent("navTabSelected",{detail:{tabType:"all-solutions"}}))}function qp(t){if(typeof window>"u"||!t)return;let e=new CustomEvent("solutionIDFromAssistant",{detail:t,bubbles:!0,composed:!0});window.dispatchEvent(e)}var jA=w.object({needsContext:w.boolean().describe("True when the explorer query requires added context from prior turns."),rewrittenQuery:w.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")}),jp=t=>t?.signal?.aborted??!1,Bp=Object.assign({"./prompts/solutions_explorer_description.md":()=>import("./AS6VINEU.js").then(t=>t.default),"./prompts/transformQuery.md":()=>import("./MFVXFKKM.js").then(t=>t.default)});function zA(t){return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g,'<sup><a href="$2">&#91;$1&#93;</a></sup>')}function UA(t){return t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,r,n)=>`<img src="${n}" alt="${r}" style="width: 100%;">`)}function qA(t,e){let r=[];return(e?.configurable?.context?.configContext.allCards??[]).forEach(n=>{let o=n.title;if(!o)return;let s=new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`,"giu"),i=!1;t=t.replace(s,(a,c,l)=>{let u=l.slice(0,c);return/<img[^>]*alt\s*=\s*["'][^"']*$/i.test(u)?a:(i=!0,`<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`)}),i&&r.push({solution:{title:n.title,id:n.deployCommonId,snippet:n.snippet,description:n.description},score:100})}),{source:t,allMatches:r}}function BA(t){return t&&t.helperServices.aiAssistantServices?`${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat`:null}function Kp(t){return t&&t.helperServices.aiAssistantServices?`${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat`:null}async function _l(t,e,r){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",token:r},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP ${n.status} calling ${e}`);return n.json()}var KA=t=>new Promise(e=>setTimeout(e,t));async function WA(t,e){let r=t.agentExecutionContext.userRequest,n=e?.configurable?.context?.lastTurnAgent,o=t.agentExecutionContext.messages??[];if(!n||o.length<=1||n==="explorer")return r;try{let s=await be(Bp,"transformQuery"),i=await kt({promptText:s,modelTier:"advanced",temperature:0,schema:jA,messages:o.slice(-11),inputVariables:{query:r,lastTurnAgent:n}});if(i.needsContext&&i.rewrittenQuery.trim())return console.debug(`Rephrased query from "${r}" to "${i.rewrittenQuery.trim()}"`),i.rewrittenQuery.trim()}catch{}return r}var HA=S.Root({...ii(),solutionResponse:S({reducer:(t,e)=>e??null,default:()=>null}),documentSkillUrl:S({reducer:(t,e)=>e??null,default:()=>null}),conversationId:S({reducer:(t,e)=>e??t,default:()=>null})}),VA=()=>new fe(HA).addNode("initializeAgent",JA).addNode("askSolutionsQuestions",GA).addEdge(me,"initializeAgent").addEdge("initializeAgent","askSolutionsQuestions").addEdge("askSolutionsQuestions",K),Wp=async(t,e,r,n)=>{if(!t)return;let o=Kp(t);if(!o)return;let s={context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions",persona:{persona:"apps-solutions"},pipeline:{translation:{allow:!0,language:r,use_llm:!1}}}}};n&&(s.conversationId=n),_l(s,o,e??"")},GA=async(t,e)=>{if(jp(e))return{};let r=_i(e),n=t.documentSkillUrl,o=[],s=await WA(t,e);await Pe({text:r.agentProgress.explorerAgentSearching},e);let i=await _l({message:s,conversationId:e?.configurable?.context?.convoId??void 0,context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions",persona:{persona:"apps-solutions"},pipeline:{translation:{allow:!0,language:e?.configurable?.context?.configContext.locale??"en",use_llm:!1}}}}},n,e?.configurable?.context?.token??"");i.conversationId&&e?.configurable?.context?.setConversationId&&e.configurable.context.setConversationId(i.conversationId);let a={message:i.message,conversationId:i.conversationId,hasMore:i.hasMore,ackSequenceNumber:i.sequenceNumber,inquiryId:i.inquiryId},c="",l=async u=>{let m=u.context?.results?.[0]?.reply??"";if(m!==""){let h=zA(m),b=UA(h),A=qA(b,e);c=A.source,o=[...o,...A.allMatches.filter(E=>!o.some(y=>y.solution.id===E.solution.id))]}let f=u.context?.results?.[0]?.status?.currentStatusStep;if(f){let h="";f===1?h=r.agentProgress.explorerAgentReading:f===2?h=r.agentProgress.explorerAgentReviewing:f===3&&(h=r.agentProgress.explorerAgentPreparing),await Pe({text:h},e)}};for(await l(i);a.hasMore;){if(jp(e))return{};await KA(500),i=await _l({conversationId:a.conversationId,ackSequenceNumber:a.ackSequenceNumber,inquiryId:a.inquiryId},n,e?.configurable?.context?.token??""),a={message:i.message,conversationId:i.conversationId,hasMore:i.hasMore,ackSequenceNumber:i.sequenceNumber,inquiryId:i.inquiryId},await l(i)}return Kp(e?.configurable?.context.portal)&&Wp(e?.configurable?.context.portal,e?.configurable?.context.token??"",e?.configurable?.context.configContext.locale??"en",a.conversationId),o.length&&(o.length===1?qp(o[0].solution.id):Up(o)),{outputMessage:c,summary:c,status:"success",solutionResponse:a,conversationId:a.conversationId}},JA=async(t,e)=>{let r=null;return t.documentSkillUrl===null&&e?.configurable?.context?.portal&&(r=BA(e.configurable.context.portal)),{documentSkillUrl:r}};await be(Bp,"solutions_explorer_description");var Hp=t=>{if(t&&Array.isArray(t.id)&&t.id.length>0)return t.id[t.id.length-1].replace("Message","").toLowerCase();if(t&&typeof t._getType=="function")try{return t._getType()}catch{return"human"}return"human"},ZA=t=>{let e=Hp(t);if(t&&t.kwargs)return{role:e,...t.kwargs};if(t&&typeof t=="object"){let r={role:e,content:typeof t.content=="string"?t.content:String(t.content||"")};return t.id&&(r.id=t.id),t.name&&(r.name=t.name),t.additional_kwargs&&(r.additional_kwargs=t.additional_kwargs),t.response_metadata&&(r.response_metadata=t.response_metadata),r}return{role:"human",content:String(t)}},QA=t=>Hp(t)==="human",YA=(t,e=3)=>t.filter(r=>QA(r)).slice(-e).map(ZA),XA=(t,e=" ")=>YA(t).map(r=>r.content).join(e).trim(),ex={understandingRequest:"Understanding your request...",selectTemplatePrompt:"This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.",searchingExistingSolutions:"Searching for existing solutions...",existingSolutionMatch:"I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?",continueBuildingYes:"Yes, I want to build a new solution",continueBuildingNo:"No, I\u2019ll review existing solutions",continueBuildingDeclined:"Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.",creatingDesign:"Generating solution design...",updatingDesign:"Updating solution design...",applyChangeFailed:"I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.",createDesignFailed:"I wasn't able to create a solution design from that request. Please try rephrasing and try again.",discardMessage:"Are you sure you want to discard your solution?",discardForNewSolution:"I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?"},tx={builderMessages:ex},yi=class t{constructor(e,r,n=!0){this.isValid=!0,this.issues=[],this.fieldNameRegistry=null,this.response=e,this.template=r,this.newDesign=n,this.validate()}static{this.INVALID_NAME_CHARS=/[><~`$^+=|]/gu}static{this.NAME_MAX_LENGTH=250}static{this.DESCRIPTION_MAX_LENGTH=2048}static{this.SERVICE_NAME_MAX_LENGTH=100}static{this.FIELD_NAME_MAX_LENGTH=31}validate(){this.compareModels(),this.validateResponse()}compareModels(){this._compareStrings(),this._compareItems(),this._compareFeatureLayers()}validateResponse(){this._validateSolutionProps(),this._validateItems(),this._validateFeatureLayer()}_compareStrings(){let e=new Set(this.response.solution.strings.map(n=>n.key)),r=new Map(this.template.solution.strings.map(n=>[n.key,n]));[...r.keys()].every(n=>e.has(n))||(this.newDesign?this._reconcileStringKeys():this._logIssue("String keys in llm response do not match the template."));for(let n of this.response.solution.strings){if(n.value)continue;let o=r.get(n.key)?.value;this.newDesign&&o?(n.value=o,this._logAutoFix(`String key '${n.key}' had no value. Auto-fixed by restoring the template value.`)):this._logIssue(`String key '${n.key}' has no value in the design. It must be populated.`)}}_reconcileStringKeys(){let e=new Set(this.response.solution.strings.map(r=>r.key));for(let r of this.template.solution.strings)e.has(r.key)||(this.response.solution.strings.push({...r}),this._logAutoFix(`String key '${r.key}' was missing from the design. Auto-fixed by re-adding it from the template.`))}_compareItems(){let e=new Set(this.template.items.map(n=>n.id)),r=new Set(this.response.items.map(n=>n.id));e.size===r.size&&[...e].every(n=>r.has(n))||(this.newDesign?this._reconcileItems():this._logIssue("Item IDs in design do not match the template."))}_reconcileItems(){let e=new Set(this.template.items.map(i=>i.id)),r=new Set(this.response.items.map(i=>i.id)),n=[...r].filter(i=>!e.has(i)),o=[...e].filter(i=>!r.has(i));if(e.size===r.size&&n.length===1&&o.length===1){let i=n[0],a=o[0],c=this.response.items.find(l=>l.id===i);if(c){c.id=a,this._logAutoFix(`Item id '${i}' did not match the template id '${a}'. Auto-fixed in place.`);return}}n.length&&(this.response.items=this.response.items.filter(i=>e.has(i.id)),this._logAutoFix(`Removed items not present in the template: ${n.join(", ")}.`));let s=this.template.items.filter(i=>!r.has(i.id));if(s.length){this.response.items=[...s.map(i=>({...i})),...this.response.items];for(let i of s)this._logAutoFix(`Item '${i.id}' was missing from the design. Auto-fixed by adding it from the template.`)}}_compareFeatureLayers(){let e=this.template.featureLayer,r=this.response.featureLayer;if(e.itemId!==r.itemId){let n=r.itemId;r.itemId=e.itemId,this._logAutoFix(`Feature Layer itemId '${n}' did not match the template. Auto-fixed to '${e.itemId}'.`)}if(!e.addLayers){let n=new Set(e.layers.map(s=>s.id)),o=new Set(r.layers.map(s=>s.id));if(!(n.size===o.size&&[...n].every(s=>o.has(s))))this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);else for(let s of e.layers){if(s.type){let a=r.layers.find(c=>c.id===s.id);if(a&&a.type!==s.type)if(this.newDesign){let c=a.type;a.type=s.type,this._logAutoFix(`Layer '${s.id}' type '${c}' is immutable. Auto-fixed back to template type '${s.type}'.`)}else this._logIssue(`Layer '${s.id}' type '${a.type}' does not match template type '${s.type}'. This layer type is immutable.`)}let i=r.layers.find(a=>a.id===s.id);i&&this._validateRequiredFields(i,s)}}}_validateRequiredFields(e,r){let n=new Map(e.requiredFields.map(o=>[o.name.toLowerCase(),o]));for(let o of r.requiredFields){let s=n.get(o.name.toLowerCase());if(!s){this.newDesign?(e.requiredFields.push({...o}),this._logAutoFix(`Layer '${e.name}' was missing required field '${o.name}'. Auto-fixed by re-adding it from the template.`)):this._logIssue(`Layer '${e.name}' is missing required field '${o.name}'.`);continue}this._enforceRequiredFieldImmutability(e,s,o)}}_enforceRequiredFieldImmutability(e,r,n){let o=[];if(r.type!==n.type&&o.push("type"),(r.length??null)!==(n.length??null)&&o.push("length"),this._choiceListsEqual(r.choiceList,n.choiceList)||o.push("choiceList"),!o.length)return;let s=o.length===1?"property":"properties";this.newDesign?(r.type=n.type,r.length=n.length,r.choiceList=Array.isArray(n.choiceList)?[...n.choiceList]:n.choiceList??null,this._logAutoFix(`Layer '${e.name}' required field '${n.name}' changed immutable ${s} (${o.join(", ")}). Auto-fixed by reverting to the template.`)):this._logIssue(`Layer '${e.name}' required field '${n.name}' changed immutable ${s} (${o.join(", ")}). These cannot be modified.`)}_choiceListsEqual(e,r){let n=Array.isArray(e)?e:null,o=Array.isArray(r)?r:null;if(n===null&&o===null)return!0;if(n===null||o===null)return!1;let s=new Set(n),i=new Set(o);return s.size===i.size&&[...s].every(a=>i.has(a))}_validateSolutionProps(){let e=this.response.solution.title??"",r=this.response.solution.description,n=/[/\\]/u.test(e),o=this.newDesign?e.replace(/[/\\]/gu,""):e;this.newDesign&&o!==e?(this.response.solution.title=o,this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")):!this.newDesign&&n&&this._logIssue("Solution title contains forbidden forward or back slashes.");let s=rs(o);if(s.isValid||this._tryFixName(s.errorType,o,i=>{this.response.solution.title=i},"Solution title","Solution Title")||this._logIssue(`Solution title is invalid (${s.errorType}).`),r){let i=ns(r,t.DESCRIPTION_MAX_LENGTH,!0);i.isValid||this._tryFixDescription(r,a=>{this.response.solution.description=a},"Solution description")||this._logIssue(`Solution description is invalid (${i.errorType}).`)}}_validateItems(){let e=new Set(["Feature Layer (hosted)","Feature Layer (hosted, view)"]);for(let r of this.response.items){if(e.has(r.type)&&r.title.length>t.SERVICE_NAME_MAX_LENGTH)if(this.newDesign){let o=r.title;r.title=r.title.slice(0,t.SERVICE_NAME_MAX_LENGTH).trim(),this._logAutoFix(`Service name '${o}' exceeded ${t.SERVICE_NAME_MAX_LENGTH} characters. Auto-fixed to '${r.title}'.`)}else this._logIssue(`Service name '${r.title}' exceeds 100 characters.`);let n=rs(r.title??"");if(n.isValid||this._tryFixName(n.errorType,r.title??"",o=>{r.title=o},`Item '${r.id}' title`,"Item Title")||this._logIssue(`Item '${r.id}' title is invalid (${n.errorType}).`),r.description){let o=ns(r.description,t.DESCRIPTION_MAX_LENGTH,!0);o.isValid||this._tryFixDescription(r.description,s=>{r.description=s},`Item '${r.id}' description`)||this._logIssue(`Item '${r.id}' description is invalid (${o.errorType}).`)}}}_validateFeatureLayer(){this.response.featureLayer.layers.length||this._logIssue("Feature layer item must contain at least one layer.");let e=this.response.featureLayer.layers.map(r=>r.name.toLowerCase());e.length!==new Set(e).size&&(this.newDesign?this._dedupeLayerNames(this.response.featureLayer.layers):this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${e}.`));for(let r of this.response.featureLayer.layers)this._validateLayer(r,this.response.featureLayer.addLayers)}_dedupeLayerNames(e){let r=new Set;for(let n of e){let o=(n.name??"").toLowerCase();if(r.has(o)){let s=n.name;n.name=this._makeUniqueName(n.name??"Layer",r),this._logAutoFix(`Duplicate layer name '${s}'. Auto-fixed to '${n.name}'.`)}r.add(n.name.toLowerCase())}}_validateLayer(e,r){!r&&e.typeMutable===!0&&e.type==="Table"&&(this.newDesign?(e.type="Point",this._logAutoFix(`Layer '${e.name}' cannot be a Table. Auto-fixed to 'Point'.`)):this._logIssue(`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`));let n=rs(e.name??"");if(n.isValid||this._tryFixName(n.errorType,e.name??"",o=>{e.name=o},`Layer '${e.name}' name`,"Layer Title")||this._logIssue(`Layer '${e.name}' name is invalid (${n.errorType}).`),e.description){let o=ns(e.description,t.DESCRIPTION_MAX_LENGTH,!0);o.isValid||this._tryFixDescription(e.description,s=>{e.description=s},`Layer '${e.name}' description`)||this._logIssue(`Layer '${e.name}' description is invalid (${o.errorType}).`)}this._validateLayerFields(e)}_validateLayerFields(e){let r=e.systemFields??[];this.fieldNameRegistry=new Set([...e.customFields,...e.requiredFields,...r].map(s=>s.name.toLowerCase()));for(let s of[...e.customFields,...e.requiredFields])this._validateField(s);this.fieldNameRegistry=null;let n=new Set(e.requiredFields.map(s=>s.name.toLowerCase())),o=new Set(n);for(let s of e.customFields){let i=s.name.toLowerCase();if(o.has(i)){let a=n.has(i)?"a required field name":"another field with the same name";if(this.newDesign){let c=s.name;s.name=this._makeUniqueName(s.name,o),this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${a}. Auto-fixed to '${s.name}'.`)}else this._logIssue(`Layer '${e.name}' field '${s.name}' collides with ${a}.`)}o.add(s.name.toLowerCase())}}_validateField(e){let r=/^\p{L}/u,n=/^.[\p{L}\p{M}\p{N}_]*$/u;e.alias||(this.newDesign?(e.alias=e.name,this._logAutoFix(`Field '${e.name}' had no display name (alias). Auto-fixed to '${e.alias}'.`)):this._logIssue(`Field '${e.name}' has no display name (alias).`));let o=r.test(e.name),s=n.test(e.name);if(!o||!s)if(this.newDesign){let i=e.name;e.name=this._makeUniqueName(this._sanitizeFieldName(e.name),this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' had an invalid name. Auto-fixed to '${e.name}'.`)}else o||this._logIssue(`Field '${e.name}' does not start with a letter.`),s||this._logIssue(`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`);if(e.name.length>t.FIELD_NAME_MAX_LENGTH)if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(e.name,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' exceeds ${t.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' exceeds ${t.FIELD_NAME_MAX_LENGTH} characters.`);if(ic.has(e.name.toLowerCase()))if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(i,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);if(ac.has(e.name.toLowerCase()))if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(i,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' is a reserved system field name. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' is a reserved system field name.`);if(Array.isArray(e.choiceList)&&e.type!=="string"&&(this.newDesign?e.choiceList.length?(e.type="string",this._logAutoFix(`Field '${e.name}' had a domain but was not of type 'string'. Auto-fixed by setting the type to 'string'.`)):(e.choiceList=null,this._logAutoFix(`Field '${e.name}' had an empty domain but is not of type 'string'. Auto-fixed by removing the domain.`)):this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`)),e.type==="string"&&this._validateStringFieldLength(e),Array.isArray(e.choiceList)&&(this.newDesign?this._autoFixChoiceList(e):this._logChoiceListIssues(e)),Array.isArray(e.choiceList)&&e.length!=null){let i=Math.max(...e.choiceList.map(a=>a.length));i>e.length&&(this.newDesign?(this._logAutoFix(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${i} characters. Auto-fixing to ${i}.`),e.length=i):this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${i} characters.`))}}_autoFixChoiceList(e){let r=e.choiceList,n=r.filter(s=>s?.trim());n.length!==r.length&&(this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`),r=n,e.choiceList=r);let o=[...new Set(r)];o.length!==r.length&&(this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`),r=o,e.choiceList=r),r.length||(this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`),e.choiceList=null)}_logChoiceListIssues(e){if(Array.isArray(e.choiceList)){if(!e.choiceList.length){this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);return}e.choiceList.some(r=>!r?.trim())&&this._logIssue(`A blank domain value was added to Field '${e.name}'.`),e.choiceList.length!==new Set(e.choiceList).size&&this._logIssue(`Field '${e.name}' has duplicate domain values.`)}}_validateStringFieldLength(e){if(this.newDesign&&e.length===255&&(e.length=256),typeof e.length!="number"||Number.isNaN(e.length)){this._handleInvalidStringFieldLength(e,256);return}let r=e.length;if(!cc(r).isValid){let n=r>4e3?4e3:256;this._handleInvalidStringFieldLength(e,n)}}_handleInvalidStringFieldLength(e,r){this.newDesign?(this._logAutoFix(`Field '${e.name}' has an invalid length. Auto-fixing to ${r}.`),e.length=r):this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`)}_makeUniqueName(e,r){let n=e,o=1;for(;r.has(n.toLowerCase());)n=`${e}_${o}`,o+=1;return n}_getUniqueTruncatedFieldName(e,r){let n=t.FIELD_NAME_MAX_LENGTH,o=e.slice(0,n),s=o,i=1;for(;r.has(s.toLowerCase());){let a=`_${i}`,c=Math.max(1,n-a.length);s=`${o.slice(0,c)}${a}`,i+=1}return s}_sanitizeItemName(e,r=t.NAME_MAX_LENGTH){let n=(e??"").replace(new RegExp(lc.source,"gu"),"").replace(t.INVALID_NAME_CHARS,"").replace(/\s+/gu," ").trim();return n.length>r&&(n=n.slice(0,r).trim()),n}_sanitizeDescription(e,r=t.DESCRIPTION_MAX_LENGTH){let n=(e??"").replace(/[<>]/gu,"");return n.length>r&&(n=n.slice(0,r)),n}_sanitizeFieldName(e){let r=(e??"").replace(/[^\p{L}\p{M}\p{N}_]/gu,"");return r.length===0?r="field":/^\p{L}/u.test(r)||(r=`f_${r}`),r}_tryFixName(e,r,n,o,s){if(!this.newDesign)return!1;if(e==="empty")return n(s),this._logAutoFix(`${o} was empty. Auto-fixed to '${s}'.`),!0;let i=this._sanitizeItemName(r)||s;return n(i),this._logAutoFix(`${o} was invalid (${e}). Auto-fixed to '${i}'.`),!0}_tryFixDescription(e,r,n){if(!this.newDesign)return!1;let o=this._sanitizeDescription(e);return r(o),this._logAutoFix(`${n} was invalid. Auto-fixed to a sanitized value.`),!0}_logAutoFix(e){console.debug(e)}_logIssue(e){console.debug(e),this.issues.push(e),this.isValid=!1}},rx=d.object({key:d.string().describe("Stable key identifier for the string."),value:d.string().describe("Display value for the string."),description:d.string().describe("Explanation of where/how the string is used.")}),nx=d.object({id:d.string().describe("ArcGIS item id (32 hex characters)."),title:d.string().describe("Item title."),description:d.string().describe("Item description."),type:d.enum(["Feature Layer (hosted)","Feature Layer (hosted, view)","Web Map","Instant App","Dashboard","Web Experience","Form","Table (hosted)","Table (hosted, view)","Hub Site Application","Hub Page","CSV","Data Pipeline","Desktop Application Template","Group","Notebook","QuickCapture Project"]).describe("ArcGIS item type.")}),zp=d.object({name:d.string().describe("Field name."),type:d.enum(["string","integer","double","date","oid","guid","globalid"]).describe("Field data type."),alias:d.string().describe("Field alias for display."),description:d.string().describe("Field description."),choiceList:d.array(d.string()).nullable().describe("List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."),length:d.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")}),ox=d.object({id:d.number().int().describe("Layer/table id within the feature service."),type:d.enum(["Point","Polyline","Polygon","Table"]).describe("Layer type."),typeMutable:d.boolean().describe("Indicates whether the layer type can be changed."),name:d.string().describe("Layer/table name."),description:d.string().describe("Layer/table description."),customFields:d.array(zp).describe("User/business fields specific to the solution."),requiredFields:d.array(zp).describe("Fields required for solution functionality (e.g., relationship keys).")}),sx=d.object({itemId:d.string().describe("ArcGIS item id for the feature layer."),addLayers:d.boolean().describe("Indicates whether new layers can be added during solution design."),layers:d.array(ox)}),bl=d.object({response:d.string().describe("Conversational response to the user's query."),solution:d.object({itemId:d.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),title:d.string().describe("Title of the solution."),description:d.string().describe("Description of the solution."),tags:d.array(d.string()).describe("Keywords/tags associated with the solution."),strings:d.array(rx).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")}),items:d.array(nx).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),featureLayer:sx.describe("Primary feature layer item and its schema/layers/tables details.")}),ix=d.object({op:d.enum(["add","remove","replace","move","copy"]).describe("RFC 6902 operation type."),path:d.string().describe("RFC 6901 JSON Pointer to the target location."),value:d.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null \u2014 not an empty string \u2014 for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),from:d.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null \u2014 not an empty string \u2014 for all other operations.")}),ax=d.object({response:d.string().describe("Conversational response describing the accepted design changes."),patches:d.array(ix).describe("Minimal RFC 6902 patch operations needed to update the current design.")}),lx=d.object({response:d.string().describe("Short, user-friendly explanation of why the requested update was not applied.")}),cx=d.object({assistantResponse:d.string().describe("Natural-language response for the user."),isValidUpdate:d.boolean().describe("True only when the request is in scope for supported design updates.")}),ux=d.object({matchedTitles:d.array(d.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")}),dx=d.object({templateId:d.string().min(1).describe("Template id from the available template list."),confidence:d.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),templateDescription:d.string().min(1).describe("Short action\u2011oriented description of the template in the user's use case/workflow, starting with a verb.")}),px=d.object({assistantResponse:d.string().nullable().describe("Natural-language response for the user."),isValidUseCase:d.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),matchedTemplates:d.array(dx).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")}),mx=t=>t.length?t.map((e,r)=>`${r+1}. ${e}`).join(`
331
- `):"No validation errors were provided.",fx=async t=>{let{query:e,validationIssues:r,recentMessages:n,fallbackMessage:o,promptModules:s}=t;try{return(await Fp({promptText:await be(s,"explainValidationFailure"),modelTier:"fast",temperature:0,schema:lx,messages:n,inputVariables:{query:e,validationIssueCount:String(r.length),validationIssues:mx(r)}})).response?.trim()||o}catch(i){return console.warn("Natural language response failed:",{error:i}),o}},Al=t=>t in _r,hx=5,gx=.8,yx=.5,_x="Web Mapping Application",wx="Embeddings",fi=null,yl=null,hi=null,gi=null,bx="Build",fr=Object.assign({"./prompts/assessBuildRequest.md":()=>import("./UOQSRV3X.js").then(t=>t.default),"./prompts/assessUpdateRequest.md":()=>import("./7X2SPNNK.js").then(t=>t.default),"./prompts/description.md":()=>import("./E25ZWVBK.js").then(t=>t.default),"./prompts/designSolution.md":()=>import("./SNA7NRRQ.js").then(t=>t.default),"./prompts/explainValidationFailure.md":()=>import("./I5E3PM26.js").then(t=>t.default),"./prompts/findExistingSolution.md":()=>import("./LPFG5XTA.js").then(t=>t.default),"./prompts/updateDesign.md":()=>import("./MBT2S4J5.js").then(t=>t.default)}),Ax=tx.builderMessages,G=t=>t?.signal?.aborted??!1,re=(t,e,r)=>_i(e)?.builderMessages?.[t]??Ax[t],Vp=t=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("arcgis-solution-design-update",{detail:t}))},xx=async(t,e,r)=>{if(!t)return null;let n=`type:"${_x}" AND typekeywords:${wx} AND group:${t}`;return(await Ti({q:n,params:e?{token:e}:void 0,portal:r,num:1}))?.results?.[0]??null};async function vx(t,e,r,n){try{let o=await xx(t,e,r);if(!o||G(n))return null;let s=new DA({id:o.id});return await s.load(),G(n)?null:await s.fetchData("json")}catch{return null}}var Ix=async(t,e,r)=>{if(!t)return[];let n=`type:Solution AND typekeywords:${bx} AND group:${t}`;return(await Ti({q:n,params:e?{token:e}:void 0,portal:r,num:100}))?.results??[]},Tx=async(t,e,r)=>{try{let n=await Ul(t,{params:e?{token:e}:void 0,portal:r}),o=n?.buildSolution;if(!o)return null;let s=n?.params,i=s&&typeof s=="object"&&!Array.isArray(s)?s:null;return{buildSolution:o,params:i}}catch{return null}},hr=(t,e={})=>{let r=t;return"itemId"in e&&(r={...r,solution:{...r.solution,itemId:e.itemId??null}}),e.sourceBuildSolution!=null&&(r={...r,sourceBuildSolution:e.sourceBuildSolution}),"params"in e&&(r={...r,params:e.params??null}),"templateId"in e&&(r={...r,templateId:e.templateId??null}),r},Gp=(t,e)=>{if(t==null||e==null)return{ok:!1,error:"design or sourceBuildSolution is null/undefined"};try{let r=structuredClone(e);return new Ni({buildSolution:r}).applyLlmTemplate(t),{ok:!0}}catch(r){return{ok:!1,error:r instanceof Error?r.stack??r.message:String(r)}}},xl=async t=>{if(yl){Object.entries(yl).forEach(([i,a])=>{_r[i]&&(_r[i].initialTemplate=a)});return}let e=t?.configurable?.context?.token,r=Zp(t),n=Qp(t);if(!r){console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");return}let o=await Ix(r,e,n),s={};G(t)||(await Promise.all(o.map(async i=>{let a=i.properties?.templateInfo;if(!a||typeof a!="object")return;let c=a.id;if(typeof c!="string"||s[c])return;let l=await Tx(i.id,e,n);if(!l||G(t))return;let{buildSolution:u,params:m}=l;if(typeof u=="object"&&u!==null&&"solution"in u){let h=u.solution;h.thumbnailUrl=i.thumbnail?`${n??"https://www.arcgis.com/sharing/rest"}/content/items/${i.id}/info/${i.thumbnail}`:void 0,h.item=i}let f={...a,buildSolution:u};s[c]=hr(new Ni(f).dumpToLlmTemplate(),{itemId:i.id,sourceBuildSolution:structuredClone(u),params:m?structuredClone(m):null}),_r[c]={...a,initialTemplate:s[c]}})),yl=s)},Jp=t=>{let e=t?.configurable?.context?.token;return typeof e!="string"||!e.trim()?null:e},Zp=t=>{let e=t?.configurable?.context?.configContext?.primarySolutionsGroupId;return typeof e!="string"||!e.trim()?null:e},Qp=t=>{let e=t?.configurable?.context?.configContext?.portalURL;if(!(typeof e!="string"||!e.trim()))return`${e.replace(/\/+$/,"")}/sharing/rest`},Sx=async t=>{await Promise.all([Xp(t),xl(t)])},Yp=async t=>{let e=Jp(t);(!hi||e&&e!==gi)&&(gi=e??gi,hi=Sx(t).catch(r=>{throw hi=null,gi=null,r})),await hi};async function Xp(t){if(fi)return fi;let e=Zp(t);if(!e)return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."),null;let r=Qp(t),n=t?.configurable?.context?.configContext?.portalURL;if(await new LA(n?{url:n}:void 0).load(),G(t))return null;let o=Jp(t)??void 0,s=await vx(e,o,r,t);return G(t)?null:s?(fi=s.items,fi):null}var Ex=()=>Object.entries(_r).map(([t,e])=>`ID: ${t}
330
+ `)}`);return await r[1]()}function _i(t){return t?.configurable?.context?.translations}function Up(t){if(typeof window>"u"||t.length<=1)return;let e=t.map(n=>n.solution.id),r=t.map(n=>n.solution.title);window.dispatchEvent(new CustomEvent("searchTermSet",{detail:{scope:"all-solutions",searchTerm:""}})),window.dispatchEvent(new CustomEvent("solutionMatchesFromAssistant",{detail:{solutionIds:e,solutionTitles:r},bubbles:!0,composed:!0})),window.dispatchEvent(new CustomEvent("navTabSelected",{detail:{tabType:"all-solutions"}}))}function qp(t){if(typeof window>"u"||!t)return;let e=new CustomEvent("solutionIDFromAssistant",{detail:t,bubbles:!0,composed:!0});window.dispatchEvent(e)}var jA=w.object({needsContext:w.boolean().describe("True when the explorer query requires added context from prior turns."),rewrittenQuery:w.string().min(1).describe("The final query to send to doc AI. Keep original query if no context is needed.")}),jp=t=>t?.signal?.aborted??!1,Bp=Object.assign({"./prompts/solutions_explorer_description.md":()=>import("./AS6VINEU.js").then(t=>t.default),"./prompts/transformQuery.md":()=>import("./MFVXFKKM.js").then(t=>t.default)});function zA(t){return t.replace(/<sup>\[\[(\d+)\]\]\(([^)]+)\)<\/sup>/g,'<sup><a href="$2">&#91;$1&#93;</a></sup>')}function UA(t){return t.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(e,r,n)=>`<img src="${n}" alt="${r}" style="width: 100%;">`)}function qA(t,e){let r=[];return(e?.configurable?.context?.configContext.allCards??[]).forEach(n=>{let o=n.title;if(!o)return;let s=new RegExp(`(?<![\\p{L}\\p{N}])${o}(?![\\p{L}\\p{N}])`,"giu"),i=!1;t=t.replace(s,(a,c,l)=>{let u=l.slice(0,c);return/<img[^>]*alt\s*=\s*["'][^"']*$/i.test(u)?a:(i=!0,`<a href="" target="solutionId:${n.deployCommonId}">${o}</a>`)}),i&&r.push({solution:{title:n.title,id:n.deployCommonId,snippet:n.snippet,description:n.description},score:100})}),{source:t,allMatches:r}}function BA(t){return t&&t.helperServices.aiAssistantServices?`${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/chat`:null}function Kp(t){return t&&t.helperServices.aiAssistantServices?`${t.helperServices.aiAssistantServices.url}/skills/doc_ai_assistant/api/pre-chat`:null}async function _l(t,e,r){let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",token:r},body:JSON.stringify(t)});if(!n.ok)throw new Error(`HTTP ${n.status} calling ${e}`);return n.json()}var KA=t=>new Promise(e=>setTimeout(e,t));async function WA(t,e){let r=t.agentExecutionContext.userRequest,n=e?.configurable?.context?.lastTurnAgent,o=t.agentExecutionContext.messages??[];if(!n||o.length<=1||n==="explorer")return r;try{let s=await be(Bp,"transformQuery"),i=await kt({promptText:s,modelTier:"advanced",temperature:0,schema:jA,messages:o.slice(-11),inputVariables:{query:r,lastTurnAgent:n}});if(i.needsContext&&i.rewrittenQuery.trim())return console.debug(`Rephrased query from "${r}" to "${i.rewrittenQuery.trim()}"`),i.rewrittenQuery.trim()}catch{}return r}var HA=S.Root({...ii(),solutionResponse:S({reducer:(t,e)=>e??null,default:()=>null}),documentSkillUrl:S({reducer:(t,e)=>e??null,default:()=>null}),conversationId:S({reducer:(t,e)=>e??t,default:()=>null})}),VA=()=>new fe(HA).addNode("initializeAgent",JA).addNode("askSolutionsQuestions",GA).addEdge(me,"initializeAgent").addEdge("initializeAgent","askSolutionsQuestions").addEdge("askSolutionsQuestions",K),Wp=async(t,e,r,n)=>{if(!t)return;let o=Kp(t);if(!o)return;let s={context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions",persona:{persona:"apps-solutions"},pipeline:{translation:{allow:!0,language:r,use_llm:!1}}}}};n&&(s.conversationId=n),_l(s,o,e??"")},GA=async(t,e)=>{if(jp(e))return{};let r=_i(e),n=t.documentSkillUrl,o=[],s=await WA(t,e);await Pe({text:r.agentProgress.explorerAgentSearching},e);let i=await _l({message:s,conversationId:e?.configurable?.context?.convoId??void 0,context:{kind:"DocAIAssistantRequest",filters:{products:"ArcGIS Solutions",persona:{persona:"apps-solutions"},pipeline:{translation:{allow:!0,language:e?.configurable?.context?.configContext.locale??"en",use_llm:!1}}}}},n,e?.configurable?.context?.token??"");i.conversationId&&e?.configurable?.context?.setConversationId&&e.configurable.context.setConversationId(i.conversationId);let a={message:i.message,conversationId:i.conversationId,hasMore:i.hasMore,ackSequenceNumber:i.sequenceNumber,inquiryId:i.inquiryId},c="",l=async u=>{let m=u.context?.results?.[0]?.reply??"";if(m!==""){let h=zA(m),b=UA(h),A=qA(b,e);c=A.source,o=[...o,...A.allMatches.filter(E=>!o.some(y=>y.solution.id===E.solution.id))]}let f=u.context?.results?.[0]?.status?.currentStatusStep;if(f){let h="";f===1?h=r.agentProgress.explorerAgentReading:f===2?h=r.agentProgress.explorerAgentReviewing:f===3&&(h=r.agentProgress.explorerAgentPreparing),await Pe({text:h},e)}};for(await l(i);a.hasMore;){if(jp(e))return{};await KA(500),i=await _l({conversationId:a.conversationId,ackSequenceNumber:a.ackSequenceNumber,inquiryId:a.inquiryId},n,e?.configurable?.context?.token??""),a={message:i.message,conversationId:i.conversationId,hasMore:i.hasMore,ackSequenceNumber:i.sequenceNumber,inquiryId:i.inquiryId},await l(i)}return Kp(e?.configurable?.context.portal)&&Wp(e?.configurable?.context.portal,e?.configurable?.context.token??"",e?.configurable?.context.configContext.locale??"en",a.conversationId),o.length&&(o.length===1?qp(o[0].solution.id):Up(o)),{outputMessage:c,summary:c,status:"success",solutionResponse:a,conversationId:a.conversationId}},JA=async(t,e)=>{let r=null;return t.documentSkillUrl===null&&e?.configurable?.context?.portal&&(r=BA(e.configurable.context.portal)),{documentSkillUrl:r}};await be(Bp,"solutions_explorer_description");var Hp=t=>{if(t&&Array.isArray(t.id)&&t.id.length>0)return t.id[t.id.length-1].replace("Message","").toLowerCase();if(t&&typeof t._getType=="function")try{return t._getType()}catch{return"human"}return"human"},ZA=t=>{let e=Hp(t);if(t&&t.kwargs)return{role:e,...t.kwargs};if(t&&typeof t=="object"){let r={role:e,content:typeof t.content=="string"?t.content:String(t.content||"")};return t.id&&(r.id=t.id),t.name&&(r.name=t.name),t.additional_kwargs&&(r.additional_kwargs=t.additional_kwargs),t.response_metadata&&(r.response_metadata=t.response_metadata),r}return{role:"human",content:String(t)}},QA=t=>Hp(t)==="human",YA=(t,e=3)=>t.filter(r=>QA(r)).slice(-e).map(ZA),XA=(t,e=" ")=>YA(t).map(r=>r.content).join(e).trim(),ex={understandingRequest:"Understanding your request...",selectTemplatePrompt:"This use case could be supported in a few different ways. Choose the option that best matches what you want to accomplish.",searchingExistingSolutions:"Searching for existing solutions...",existingSolutionMatch:"I found one or more existing solutions that match your use case. These are ready-to-use solutions that may already meet your needs and can be deployed now. Do you want to continue building your own solution?",continueBuildingYes:"Yes, I want to build a new solution",continueBuildingNo:"No, I\u2019ll review existing solutions",continueBuildingDeclined:"Sounds good. We can focus on existing solutions. Let me know if I can help answer any questions or provide more details.",creatingDesign:"Generating solution design...",updatingDesign:"Updating solution design...",applyChangeFailed:"I wasn't able to apply that change. The design was not modified. Please try rephrasing your request.",createDesignFailed:"I wasn't able to create a solution design from that request. Please try rephrasing and try again.",discardMessage:"Are you sure you want to discard your solution?",discardForNewSolution:"I can help you build a new solution, but I will need to discard your current solution design. Do you want to continue?"},tx={builderMessages:ex},yi=class t{constructor(e,r,n=!0){this.isValid=!0,this.issues=[],this.fieldNameRegistry=null,this.response=e,this.template=r,this.newDesign=n,this.validate()}static{this.INVALID_NAME_CHARS=/[><~`$^+=|]/gu}static{this.NAME_MAX_LENGTH=250}static{this.DESCRIPTION_MAX_LENGTH=2048}static{this.FIELD_NAME_MAX_LENGTH=31}validate(){this.compareModels(),this.validateResponse()}compareModels(){this._compareStrings(),this._compareItems(),this._compareFeatureLayers()}validateResponse(){this._validateSolutionProps(),this._validateItems(),this._validateFeatureLayer()}_compareStrings(){let e=new Set(this.response.solution.strings.map(n=>n.key)),r=new Map(this.template.solution.strings.map(n=>[n.key,n]));[...r.keys()].every(n=>e.has(n))||(this.newDesign?this._reconcileStringKeys():this._logIssue("String keys in llm response do not match the template."));for(let n of this.response.solution.strings){if(n.value)continue;let o=r.get(n.key)?.value;this.newDesign&&o?(n.value=o,this._logAutoFix(`String key '${n.key}' had no value. Auto-fixed by restoring the template value.`)):this._logIssue(`String key '${n.key}' has no value in the design. It must be populated.`)}}_reconcileStringKeys(){let e=new Set(this.response.solution.strings.map(r=>r.key));for(let r of this.template.solution.strings)e.has(r.key)||(this.response.solution.strings.push({...r}),this._logAutoFix(`String key '${r.key}' was missing from the design. Auto-fixed by re-adding it from the template.`))}_compareItems(){let e=new Set(this.template.items.map(n=>n.id)),r=new Set(this.response.items.map(n=>n.id));e.size===r.size&&[...e].every(n=>r.has(n))||(this.newDesign?this._reconcileItems():this._logIssue("Item IDs in design do not match the template."))}_reconcileItems(){let e=new Set(this.template.items.map(i=>i.id)),r=new Set(this.response.items.map(i=>i.id)),n=[...r].filter(i=>!e.has(i)),o=[...e].filter(i=>!r.has(i));if(e.size===r.size&&n.length===1&&o.length===1){let i=n[0],a=o[0],c=this.response.items.find(l=>l.id===i);if(c){c.id=a,this._logAutoFix(`Item id '${i}' did not match the template id '${a}'. Auto-fixed in place.`);return}}n.length&&(this.response.items=this.response.items.filter(i=>e.has(i.id)),this._logAutoFix(`Removed items not present in the template: ${n.join(", ")}.`));let s=this.template.items.filter(i=>!r.has(i.id));if(s.length){this.response.items=[...s.map(i=>({...i})),...this.response.items];for(let i of s)this._logAutoFix(`Item '${i.id}' was missing from the design. Auto-fixed by adding it from the template.`)}}_compareFeatureLayers(){let e=this.template.featureLayer,r=this.response.featureLayer;if(e.itemId!==r.itemId){let n=r.itemId;r.itemId=e.itemId,this._logAutoFix(`Feature Layer itemId '${n}' did not match the template. Auto-fixed to '${e.itemId}'.`)}if(!e.addLayers){let n=new Set(e.layers.map(s=>s.id)),o=new Set(r.layers.map(s=>s.id));if(!(n.size===o.size&&[...n].every(s=>o.has(s))))this._logIssue(`Feature Layer '${e.itemId}' had its layer ids altered.`);else for(let s of e.layers){if(s.type){let a=r.layers.find(c=>c.id===s.id);if(a&&a.type!==s.type)if(this.newDesign){let c=a.type;a.type=s.type,this._logAutoFix(`Layer '${s.id}' type '${c}' is immutable. Auto-fixed back to template type '${s.type}'.`)}else this._logIssue(`Layer '${s.id}' type '${a.type}' does not match template type '${s.type}'. This layer type is immutable.`)}let i=r.layers.find(a=>a.id===s.id);i&&this._validateRequiredFields(i,s)}}}_validateRequiredFields(e,r){let n=new Map(e.requiredFields.map(o=>[o.name.toLowerCase(),o]));for(let o of r.requiredFields){let s=n.get(o.name.toLowerCase());if(!s){this.newDesign?(e.requiredFields.push({...o}),this._logAutoFix(`Layer '${e.name}' was missing required field '${o.name}'. Auto-fixed by re-adding it from the template.`)):this._logIssue(`Layer '${e.name}' is missing required field '${o.name}'.`);continue}this._enforceRequiredFieldImmutability(e,s,o)}}_enforceRequiredFieldImmutability(e,r,n){let o=[];if(r.type!==n.type&&o.push("type"),(r.length??null)!==(n.length??null)&&o.push("length"),this._choiceListsEqual(r.choiceList,n.choiceList)||o.push("choiceList"),!o.length)return;let s=o.length===1?"property":"properties";this.newDesign?(r.type=n.type,r.length=n.length,r.choiceList=Array.isArray(n.choiceList)?[...n.choiceList]:n.choiceList??null,this._logAutoFix(`Layer '${e.name}' required field '${n.name}' changed immutable ${s} (${o.join(", ")}). Auto-fixed by reverting to the template.`)):this._logIssue(`Layer '${e.name}' required field '${n.name}' changed immutable ${s} (${o.join(", ")}). These cannot be modified.`)}_choiceListsEqual(e,r){let n=Array.isArray(e)?e:null,o=Array.isArray(r)?r:null;if(n===null&&o===null)return!0;if(n===null||o===null)return!1;let s=new Set(n),i=new Set(o);return s.size===i.size&&[...s].every(a=>i.has(a))}_validateSolutionProps(){let e=this.response.solution.title??"",r=this.response.solution.description,n=/[/\\]/u.test(e),o=this.newDesign?e.replace(/[/\\]/gu,""):e;this.newDesign&&o!==e?(this.response.solution.title=o,this._logAutoFix("Solution title contained forward or back slashes. Auto-fixed by removing them.")):!this.newDesign&&n&&this._logIssue("Solution title contains forbidden forward or back slashes.");let s=rs(o);if(s.isValid||this._tryFixName(s.errorType,o,i=>{this.response.solution.title=i},"Solution title","Solution Title")||this._logIssue(`Solution title is invalid (${s.errorType}).`),r){let i=ns(r,t.DESCRIPTION_MAX_LENGTH,!0);i.isValid||this._tryFixDescription(r,a=>{this.response.solution.description=a},"Solution description")||this._logIssue(`Solution description is invalid (${i.errorType}).`)}}_validateItems(){for(let e of this.response.items){let r=rs(e.title??"");if(r.isValid||this._tryFixName(r.errorType,e.title??"",n=>{e.title=n},`Item '${e.id}' title`,"Item Title")||this._logIssue(`Item '${e.id}' title is invalid (${r.errorType}).`),e.description){let n=ns(e.description,t.DESCRIPTION_MAX_LENGTH,!0);n.isValid||this._tryFixDescription(e.description,o=>{e.description=o},`Item '${e.id}' description`)||this._logIssue(`Item '${e.id}' description is invalid (${n.errorType}).`)}}}_validateFeatureLayer(){this.response.featureLayer.layers.length||this._logIssue("Feature layer item must contain at least one layer.");let e=this.response.featureLayer.layers.map(r=>r.name.toLowerCase());e.length!==new Set(e).size&&(this.newDesign?this._dedupeLayerNames(this.response.featureLayer.layers):this._logIssue(`Layer names must be unique (case-insensitive). Layer names in design: ${e}.`));for(let r of this.response.featureLayer.layers)this._validateLayer(r,this.response.featureLayer.addLayers)}_dedupeLayerNames(e){let r=new Set;for(let n of e){let o=(n.name??"").toLowerCase();if(r.has(o)){let s=n.name;n.name=this._makeUniqueName(n.name??"Layer",r),this._logAutoFix(`Duplicate layer name '${s}'. Auto-fixed to '${n.name}'.`)}r.add(n.name.toLowerCase())}}_validateLayer(e,r){!r&&e.typeMutable===!0&&e.type==="Table"&&(this.newDesign?(e.type="Point",this._logAutoFix(`Layer '${e.name}' cannot be a Table. Auto-fixed to 'Point'.`)):this._logIssue(`Layer '${e.name}' cannot be a Table. It may be a Point, Line, or Polygon.`));let n=rs(e.name??"");if(n.isValid||this._tryFixName(n.errorType,e.name??"",o=>{e.name=o},`Layer '${e.name}' name`,"Layer Title")||this._logIssue(`Layer '${e.name}' name is invalid (${n.errorType}).`),e.description){let o=ns(e.description,t.DESCRIPTION_MAX_LENGTH,!0);o.isValid||this._tryFixDescription(e.description,s=>{e.description=s},`Layer '${e.name}' description`)||this._logIssue(`Layer '${e.name}' description is invalid (${o.errorType}).`)}this._validateLayerFields(e)}_validateLayerFields(e){let r=e.systemFields??[];this.fieldNameRegistry=new Set([...e.customFields,...e.requiredFields,...r].map(s=>s.name.toLowerCase()));for(let s of[...e.customFields,...e.requiredFields])this._validateField(s);this.fieldNameRegistry=null;let n=new Set(e.requiredFields.map(s=>s.name.toLowerCase())),o=new Set(n);for(let s of e.customFields){let i=s.name.toLowerCase();if(o.has(i)){let a=n.has(i)?"a required field name":"another field with the same name";if(this.newDesign){let c=s.name;s.name=this._makeUniqueName(s.name,o),this._logAutoFix(`Layer '${e.name}' field '${c}' collided with ${a}. Auto-fixed to '${s.name}'.`)}else this._logIssue(`Layer '${e.name}' field '${s.name}' collides with ${a}.`)}o.add(s.name.toLowerCase())}}_validateField(e){let r=/^\p{L}/u,n=/^.[\p{L}\p{M}\p{N}_]*$/u;e.alias||(this.newDesign?(e.alias=e.name,this._logAutoFix(`Field '${e.name}' had no display name (alias). Auto-fixed to '${e.alias}'.`)):this._logIssue(`Field '${e.name}' has no display name (alias).`));let o=r.test(e.name),s=n.test(e.name);if(!o||!s)if(this.newDesign){let i=e.name;e.name=this._makeUniqueName(this._sanitizeFieldName(e.name),this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' had an invalid name. Auto-fixed to '${e.name}'.`)}else o||this._logIssue(`Field '${e.name}' does not start with a letter.`),s||this._logIssue(`Field '${e.name}' contains invalid characters (only letters from any writing system, numbers, and underscores are allowed; emojis and punctuation are not allowed).`);if(e.name.length>t.FIELD_NAME_MAX_LENGTH)if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(e.name,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' exceeds ${t.FIELD_NAME_MAX_LENGTH} characters. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' exceeds ${t.FIELD_NAME_MAX_LENGTH} characters.`);if(ic.has(e.name.toLowerCase()))if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(i,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' is a SQL reserved keyword. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' is a SQL reserved keyword.`);if(ac.has(e.name.toLowerCase()))if(this.newDesign){let i=e.name;e.name=this._getUniqueTruncatedFieldName(i,this.fieldNameRegistry),this.fieldNameRegistry.add(e.name.toLowerCase()),this._logAutoFix(`Field '${i}' is a reserved system field name. Auto-fixing to '${e.name}'.`)}else this._logIssue(`Field '${e.name}' is a reserved system field name.`);if(Array.isArray(e.choiceList)&&e.type!=="string"&&(this.newDesign?e.choiceList.length?(e.type="string",this._logAutoFix(`Field '${e.name}' had a domain but was not of type 'string'. Auto-fixed by setting the type to 'string'.`)):(e.choiceList=null,this._logAutoFix(`Field '${e.name}' had an empty domain but is not of type 'string'. Auto-fixed by removing the domain.`)):this._logIssue(`Field '${e.name}' must be of type 'string' to have a domain.`)),e.type==="string"&&this._validateStringFieldLength(e),Array.isArray(e.choiceList)&&(this.newDesign?this._autoFixChoiceList(e):this._logChoiceListIssues(e)),Array.isArray(e.choiceList)&&e.length!=null){let i=Math.max(...e.choiceList.map(a=>a.length));i>e.length&&(this.newDesign?(this._logAutoFix(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${i} characters. Auto-fixing to ${i}.`),e.length=i):this._logIssue(`The choice provided for field '${e.name}' is too long. It must fit within ${e.length} characters, but the choice requires ${i} characters.`))}}_autoFixChoiceList(e){let r=e.choiceList,n=r.filter(s=>s?.trim());n.length!==r.length&&(this._logAutoFix(`Field '${e.name}' had blank domain values. Auto-fixed by removing them.`),r=n,e.choiceList=r);let o=[...new Set(r)];o.length!==r.length&&(this._logAutoFix(`Field '${e.name}' had duplicate domain values. Auto-fixed by removing duplicates.`),r=o,e.choiceList=r),r.length||(this._logAutoFix(`Field '${e.name}' had an empty domain. Auto-fixed by removing the domain.`),e.choiceList=null)}_logChoiceListIssues(e){if(Array.isArray(e.choiceList)){if(!e.choiceList.length){this._logIssue(`Field '${e.name}' has an empty domain. At least one value is required.`);return}e.choiceList.some(r=>!r?.trim())&&this._logIssue(`A blank domain value was added to Field '${e.name}'.`),e.choiceList.length!==new Set(e.choiceList).size&&this._logIssue(`Field '${e.name}' has duplicate domain values.`)}}_validateStringFieldLength(e){if(this.newDesign&&e.length===255&&(e.length=256),typeof e.length!="number"||Number.isNaN(e.length)){this._handleInvalidStringFieldLength(e,256);return}let r=e.length;if(!cc(r).isValid){let n=r>4e3?4e3:256;this._handleInvalidStringFieldLength(e,n)}}_handleInvalidStringFieldLength(e,r){this.newDesign?(this._logAutoFix(`Field '${e.name}' has an invalid length. Auto-fixing to ${r}.`),e.length=r):this._logIssue(`Field '${e.name}' length is invalid (must be a number between 1 and 4000).`)}_makeUniqueName(e,r){let n=e,o=1;for(;r.has(n.toLowerCase());)n=`${e}_${o}`,o+=1;return n}_getUniqueTruncatedFieldName(e,r){let n=t.FIELD_NAME_MAX_LENGTH,o=e.slice(0,n),s=o,i=1;for(;r.has(s.toLowerCase());){let a=`_${i}`,c=Math.max(1,n-a.length);s=`${o.slice(0,c)}${a}`,i+=1}return s}_sanitizeItemName(e,r=t.NAME_MAX_LENGTH){let n=(e??"").replace(new RegExp(lc.source,"gu"),"").replace(t.INVALID_NAME_CHARS,"").replace(/\s+/gu," ").trim();return n.length>r&&(n=n.slice(0,r).trim()),n}_sanitizeDescription(e,r=t.DESCRIPTION_MAX_LENGTH){let n=(e??"").replace(/[<>]/gu,"");return n.length>r&&(n=n.slice(0,r)),n}_sanitizeFieldName(e){let r=(e??"").replace(/[^\p{L}\p{M}\p{N}_]/gu,"");return r.length===0?r="field":/^\p{L}/u.test(r)||(r=`f_${r}`),r}_tryFixName(e,r,n,o,s){if(!this.newDesign)return!1;if(e==="empty")return n(s),this._logAutoFix(`${o} was empty. Auto-fixed to '${s}'.`),!0;let i=this._sanitizeItemName(r)||s;return n(i),this._logAutoFix(`${o} was invalid (${e}). Auto-fixed to '${i}'.`),!0}_tryFixDescription(e,r,n){if(!this.newDesign)return!1;let o=this._sanitizeDescription(e);return r(o),this._logAutoFix(`${n} was invalid. Auto-fixed to a sanitized value.`),!0}_logAutoFix(e){console.debug(e)}_logIssue(e){console.debug(e),this.issues.push(e),this.isValid=!1}},rx=d.object({key:d.string().describe("Stable key identifier for the string."),value:d.string().describe("Display value for the string."),description:d.string().describe("Explanation of where/how the string is used.")}),nx=d.object({id:d.string().describe("ArcGIS item id (32 hex characters)."),title:d.string().describe("Item title."),description:d.string().describe("Item description."),type:d.enum(["Feature Layer (hosted)","Feature Layer (hosted, view)","Web Map","Instant App","Dashboard","Web Experience","Form","Table (hosted)","Table (hosted, view)","Hub Site Application","Hub Page","CSV","Data Pipeline","Desktop Application Template","Group","Notebook","QuickCapture Project"]).describe("ArcGIS item type.")}),zp=d.object({name:d.string().describe("Field name."),type:d.enum(["string","integer","double","date","oid","guid","globalid"]).describe("Field data type."),alias:d.string().describe("Field alias for display."),description:d.string().describe("Field description."),choiceList:d.array(d.string()).nullable().describe("List of allowed values for string fields with a controlled vocabulary. Null if unrestricted or not applicable."),length:d.number().int().nullable().describe("Maximum string length for string fields. Null for non-string fields.")}),ox=d.object({id:d.number().int().describe("Layer/table id within the feature service."),type:d.enum(["Point","Polyline","Polygon","Table"]).describe("Layer type."),typeMutable:d.boolean().describe("Indicates whether the layer type can be changed."),name:d.string().describe("Layer/table name."),description:d.string().describe("Layer/table description."),customFields:d.array(zp).describe("User/business fields specific to the solution."),requiredFields:d.array(zp).describe("Fields required for solution functionality (e.g., relationship keys).")}),sx=d.object({itemId:d.string().describe("ArcGIS item id for the feature layer."),addLayers:d.boolean().describe("Indicates whether new layers can be added during solution design."),layers:d.array(ox)}),bl=d.object({response:d.string().describe("Conversational response to the user's query."),solution:d.object({itemId:d.string().nullable().describe("ArcGIS item id of the source Solution template used for deployment. Preserve the existing value exactly when known; otherwise use null."),title:d.string().describe("Title of the solution."),description:d.string().describe("Description of the solution."),tags:d.array(d.string()).describe("Keywords/tags associated with the solution."),strings:d.array(rx).describe("Localized strings/labels used by apps (dashboards, forms, etc.).")}),items:d.array(nx).describe("ArcGIS items that belong to the solution (apps, maps, layers, etc.)."),featureLayer:sx.describe("Primary feature layer item and its schema/layers/tables details.")}),ix=d.object({op:d.enum(["add","remove","replace","move","copy"]).describe("RFC 6902 operation type."),path:d.string().describe("RFC 6901 JSON Pointer to the target location."),value:d.string().nullable().describe(`JSON-encoded value to apply (required for add and replace). Must be null \u2014 not an empty string \u2014 for remove, move, and copy operations. Serialize as a JSON string, e.g. '\\"text\\"' for a string, '[\\"a\\",\\"b\\"]' for an array, or '{\\"name\\":\\"x\\"}' for an object.`),from:d.string().nullable().describe("RFC 6901 JSON Pointer to the source location (required for move and copy). Must be null \u2014 not an empty string \u2014 for all other operations.")}),ax=d.object({response:d.string().describe("Conversational response describing the accepted design changes."),patches:d.array(ix).describe("Minimal RFC 6902 patch operations needed to update the current design.")}),lx=d.object({response:d.string().describe("Short, user-friendly explanation of why the requested update was not applied.")}),cx=d.object({assistantResponse:d.string().describe("Natural-language response for the user."),isValidUpdate:d.boolean().describe("True only when the request is in scope for supported design updates.")}),ux=d.object({matchedTitles:d.array(d.string()).describe("Titles of solutions that match the user's request. Empty array if no strong match.")}),dx=d.object({templateId:d.string().min(1).describe("Template id from the available template list."),confidence:d.number().min(0).max(1).describe("Confidence score from 0 to 1 for this template match."),templateDescription:d.string().min(1).describe("Short action\u2011oriented description of the template in the user's use case/workflow, starting with a verb.")}),px=d.object({assistantResponse:d.string().nullable().describe("Natural-language response for the user."),isValidUseCase:d.boolean().describe("True only when the request is concrete, appropriate, and has at least one matching template."),matchedTemplates:d.array(dx).describe("Ordered list of matching templates, best match first. Empty when no valid match exists.")}),mx=t=>t.length?t.map((e,r)=>`${r+1}. ${e}`).join(`
331
+ `):"No validation errors were provided.",fx=async t=>{let{query:e,validationIssues:r,recentMessages:n,fallbackMessage:o,promptModules:s}=t;try{return(await Fp({promptText:await be(s,"explainValidationFailure"),modelTier:"fast",temperature:0,schema:lx,messages:n,inputVariables:{query:e,validationIssueCount:String(r.length),validationIssues:mx(r)}})).response?.trim()||o}catch(i){return console.warn("Natural language response failed:",{error:i}),o}},Al=t=>t in _r,hx=5,gx=.8,yx=.5,_x="Web Mapping Application",wx="Embeddings",fi=null,yl=null,hi=null,gi=null,bx="Build",fr=Object.assign({"./prompts/assessBuildRequest.md":()=>import("./S26SZJC7.js").then(t=>t.default),"./prompts/assessUpdateRequest.md":()=>import("./7X2SPNNK.js").then(t=>t.default),"./prompts/description.md":()=>import("./E25ZWVBK.js").then(t=>t.default),"./prompts/designSolution.md":()=>import("./SNA7NRRQ.js").then(t=>t.default),"./prompts/explainValidationFailure.md":()=>import("./I5E3PM26.js").then(t=>t.default),"./prompts/findExistingSolution.md":()=>import("./LPFG5XTA.js").then(t=>t.default),"./prompts/updateDesign.md":()=>import("./MBT2S4J5.js").then(t=>t.default)}),Ax=tx.builderMessages,G=t=>t?.signal?.aborted??!1,re=(t,e,r)=>_i(e)?.builderMessages?.[t]??Ax[t],Vp=t=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("arcgis-solution-design-update",{detail:t}))},xx=async(t,e,r)=>{if(!t)return null;let n=`type:"${_x}" AND typekeywords:${wx} AND group:${t}`;return(await Ti({q:n,params:e?{token:e}:void 0,portal:r,num:1}))?.results?.[0]??null};async function vx(t,e,r,n){try{let o=await xx(t,e,r);if(!o||G(n))return null;let s=new DA({id:o.id});return await s.load(),G(n)?null:await s.fetchData("json")}catch{return null}}var Ix=async(t,e,r)=>{if(!t)return[];let n=`type:Solution AND typekeywords:${bx} AND group:${t}`;return(await Ti({q:n,params:e?{token:e}:void 0,portal:r,num:100}))?.results??[]},Tx=async(t,e,r)=>{try{let n=await Ul(t,{params:e?{token:e}:void 0,portal:r}),o=n?.buildSolution;if(!o)return null;let s=n?.params,i=s&&typeof s=="object"&&!Array.isArray(s)?s:null;return{buildSolution:o,params:i}}catch{return null}},hr=(t,e={})=>{let r=t;return"itemId"in e&&(r={...r,solution:{...r.solution,itemId:e.itemId??null}}),e.sourceBuildSolution!=null&&(r={...r,sourceBuildSolution:e.sourceBuildSolution}),"params"in e&&(r={...r,params:e.params??null}),"templateId"in e&&(r={...r,templateId:e.templateId??null}),r},Gp=(t,e)=>{if(t==null||e==null)return{ok:!1,error:"design or sourceBuildSolution is null/undefined"};try{let r=structuredClone(e);return new Ni({buildSolution:r}).applyLlmTemplate(t),{ok:!0}}catch(r){return{ok:!1,error:r instanceof Error?r.stack??r.message:String(r)}}},xl=async t=>{if(yl){Object.entries(yl).forEach(([i,a])=>{_r[i]&&(_r[i].initialTemplate=a)});return}let e=t?.configurable?.context?.token,r=Zp(t),n=Qp(t);if(!r){console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping live template hydration.");return}let o=await Ix(r,e,n),s={};G(t)||(await Promise.all(o.map(async i=>{let a=i.properties?.templateInfo;if(!a||typeof a!="object")return;let c=a.id;if(typeof c!="string"||s[c])return;let l=await Tx(i.id,e,n);if(!l||G(t))return;let{buildSolution:u,params:m}=l;if(typeof u=="object"&&u!==null&&"solution"in u){let h=u.solution;h.thumbnailUrl=i.thumbnail?`${n??"https://www.arcgis.com/sharing/rest"}/content/items/${i.id}/info/${i.thumbnail}`:void 0,h.item=i}let f={...a,buildSolution:u};s[c]=hr(new Ni(f).dumpToLlmTemplate(),{itemId:i.id,sourceBuildSolution:structuredClone(u),params:m?structuredClone(m):null}),_r[c]={...a,initialTemplate:s[c]}})),yl=s)},Jp=t=>{let e=t?.configurable?.context?.token;return typeof e!="string"||!e.trim()?null:e},Zp=t=>{let e=t?.configurable?.context?.configContext?.primarySolutionsGroupId;return typeof e!="string"||!e.trim()?null:e},Qp=t=>{let e=t?.configurable?.context?.configContext?.portalURL;if(!(typeof e!="string"||!e.trim()))return`${e.replace(/\/+$/,"")}/sharing/rest`},Sx=async t=>{await Promise.all([Xp(t),xl(t)])},Yp=async t=>{let e=Jp(t);(!hi||e&&e!==gi)&&(gi=e??gi,hi=Sx(t).catch(r=>{throw hi=null,gi=null,r})),await hi};async function Xp(t){if(fi)return fi;let e=Zp(t);if(!e)return console.warn("Solution Builder: missing primarySolutionsGroupId in appConfig; skipping embeddings load."),null;let r=Qp(t),n=t?.configurable?.context?.configContext?.portalURL;if(await new LA(n?{url:n}:void 0).load(),G(t))return null;let o=Jp(t)??void 0,s=await vx(e,o,r,t);return G(t)?null:s?(fi=s.items,fi):null}var Ex=()=>Object.entries(_r).map(([t,e])=>`ID: ${t}
332
332
  Label: ${e.label}
333
333
  Description: ${e.description}`).join(`
334
334
 
@@ -337,4 +337,4 @@ Snippet: ${u.snippet}
337
337
  Description: ${u.description}`).join(`
338
338
 
339
339
  `),l=t.agentExecutionContext.messages.slice(-11);return{existingMatches:(await kt({promptText:await be(fr,"findExistingSolution"),modelTier:"fast",temperature:0,schema:ux,messages:l,inputVariables:{query:r,candidates:c}})).matchedTitles.map(u=>a.find(({solution:m})=>m.title===u)).filter(u=>u!==void 0)}},Dx=(t,e)=>{if(G(e))return{};let{existingMatches:r}=t,{hitlResponse:n}=e.configurable,o=`confirmExistingSolution:${r[0].solution.id}`;if(n?.agentId!=="solutionBuilder"||n.id!==o){r.length===1?qp(r[0].solution.id):Up(r);let a=re("existingSolutionMatch",e),c=[re("continueBuildingYes",e),re("continueBuildingNo",e)],l={agentId:"solutionBuilder",id:o,kind:"singleSelection",message:a,metadata:c};throw new Uo(l)}let s=String(n.payload??"").trim(),i=re("continueBuildingNo",e);return{continueBuilding:s!==i}},Fx=(t,e)=>{let r=re("continueBuildingDeclined",e);return{outputMessage:r,summary:r,status:"success"}},em=async(t,e)=>{if(G(e))return{};if(await Yp(e),G(e))return{};let{currentDesign:r}=t,n=t.agentExecutionContext.userRequest;await Pe({text:re("creatingDesign",e)},e);let o=to(t.selectedTemplate);if(o?.initialTemplate||(await xl(e),o=to(t.selectedTemplate)),G(e))return{};if(!o?.initialTemplate)throw new Error("No hydrated templates are available for solution design.");let s=hr(r??o.initialTemplate,{itemId:(r??o.initialTemplate)?.solution?.itemId??null,sourceBuildSolution:r?.sourceBuildSolution??o.initialTemplate.sourceBuildSolution,params:r?.params??o.initialTemplate.params??null}),i=t.agentExecutionContext.messages.slice(-11),a=await kt({promptText:await be(fr,"designSolution"),modelTier:"advanced",temperature:0,schema:bl,messages:i,inputVariables:{currentDesign:JSON.stringify(Li(s)),templateInstructions:o.instructions,query:n}});if(await Pe({text:" of design solution 1"},e),G(e))return{};let{response:c,featureLayer:l,...u}=a,m=Fi(l,s.featureLayer),f=hr({...u,featureLayer:m},{itemId:s?.solution?.itemId,sourceBuildSolution:s.sourceBuildSolution,templateId:t.selectedTemplate??null,params:s.params??null}),h=new yi(f,o.initialTemplate);if(!h.isValid)return console.warn("[SolutionBuilder] designSolution validation failed:",{issues:h.issues,llmResponse:a}),{outputMessage:re("createDesignFailed",e)};let b=f.sourceBuildSolution,A=Gp(f,b);if(!A.ok){console.warn("[SolutionBuilder] designSolution Esri JSON conversion failed:",{error:A.error,llmResponse:a,design:f});let E=re("createDesignFailed",e);return{outputMessage:E,summary:E,status:"success"}}return G(e)?{}:(Vp(f),{outputMessage:c,summary:c,status:"success",currentDesign:f})},jx=async(t,e)=>{if(G(e))return{};let{currentDesign:r}=t;if(!r)return em(t,e);let n=t.agentExecutionContext.userRequest,o=t.agentExecutionContext.messages.slice(-11);await Pe({text:re("updatingDesign",e)},e);let s;try{s=await kt({promptText:await be(fr,"updateDesign"),modelTier:"advanced",temperature:0,schema:ax,messages:o,inputVariables:{currentDesign:JSON.stringify(Di(r)),query:n}})}catch(P){console.warn("[SolutionBuilder] updateDesign structured prompt failed:",P);let z=re("applyChangeFailed",e);return{outputMessage:z,summary:z,status:"success"}}let{response:i,patches:a}=s;if(!a||a.length===0)return{outputMessage:i,summary:i,status:"success"};let c=P=>{try{return JSON.parse(P)}catch{let z=P.replace(/[\u0000-\u001F]/g,U=>{switch(U){case"\b":return"\\b";case"\f":return"\\f";case`
340
- `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return"\\u"+U.charCodeAt(0).toString(16).padStart(4,"0")}});try{return JSON.parse(z)}catch{return P}}},l=[...a.map(P=>({op:P.op,path:P.path.replace(/\/+$/,""),...P.value!=null&&P.value!==""?{value:c(P.value)}:{},...P.from!=null&&P.from!==""?{from:P.from}:{}}))].sort((P,z)=>P.op!=="remove"||z.op!=="remove"?0:z.path.localeCompare(P.path,void 0,{numeric:!0})),u=structuredClone(Li(r));try{Jn(u,l,!0)}catch(P){console.warn("[SolutionBuilder] updateDesign JSON patch failed:",{error:P,llmResponse:s,patches:l,patchTarget:u});let z=re("applyChangeFailed",e);return{outputMessage:z,summary:z,status:"success"}}let m=hr({response:"",...u},{itemId:r.solution?.itemId??null}),f=bl.safeParse(m);if(!f.success){console.warn("[SolutionBuilder] updateDesign schema validation failed:",{errors:f.error.issues,llmResponse:s,patchedDesign:m});let P=re("applyChangeFailed",e);return{outputMessage:P,summary:P,status:"success"}}let{response:h,featureLayer:b,...A}=f.data,E=Fi(b,r.featureLayer),y=hr({...A,featureLayer:E},{itemId:r.solution?.itemId,sourceBuildSolution:r.sourceBuildSolution,templateId:r.templateId??t.selectedTemplate??null,params:r.params??null}),v=to(t.selectedTemplate);if(v?.initialTemplate||(await xl(e),v=to(t.selectedTemplate)),G(e))return{};if(!v?.initialTemplate)throw new Error("No hydrated templates are available for solution design.");let C=new yi(y,v.initialTemplate,!1);if(!C.isValid){console.warn("[SolutionBuilder] updateDesign validation failed:",{issues:C.issues,llmResponse:s,patchedDesign:y});let P=await fx({query:n,validationIssues:C.issues,recentMessages:o,fallbackMessage:re("applyChangeFailed",e),promptModules:fr});return{outputMessage:P,summary:P,status:"success"}}let L=y.sourceBuildSolution,B=Gp(y,L);if(!B.ok){console.warn("[SolutionBuilder] updateDesign Esri JSON conversion failed:",{error:B.error,llmResponse:s,design:y});let P=re("applyChangeFailed",e);return{outputMessage:P,summary:P,status:"success"}}return G(e)?{}:(Vp(y),{outputMessage:i,summary:i,status:"success",currentDesign:y})},zx=t=>t.currentDesign!==null?"assessUpdateRequest":"assessBuildRequest",Ux=t=>!t.updateAssessment||!t.updateAssessment.isValidUpdate?"invalidUpdateExit":"updateDesign",qx=t=>!t.assessment||!t.assessment.isValidUseCase?"invalidBuildExit":!t.selectedTemplate&&t.assessment.matchedTemplates.length>1?"selectTemplateHIL":"findExistingSolutions",Bx=t=>t.existingMatches.length>0?"confirmContinueBuildingHIL":"designSolution",Kx=t=>t.continueBuilding===!1?"declineContinueBuildingExit":"designSolution",Wx=()=>new fe(kx).addNode("syncCurrentDesignFromContext",Ox).addNode("assessBuildRequest",Px).addNode("assessUpdateRequest",Rx).addNode("invalidBuildExit",Mx).addNode("invalidUpdateExit",$x).addNode("selectTemplateHIL",Nx).addNode("findExistingSolutions",Lx).addNode("confirmContinueBuildingHIL",Dx).addNode("declineContinueBuildingExit",Fx).addNode("designSolution",em).addNode("updateDesign",jx).addEdge(me,"syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext",zx,{assessUpdateRequest:"assessUpdateRequest",assessBuildRequest:"assessBuildRequest"}).addConditionalEdges("assessUpdateRequest",Ux,{invalidUpdateExit:"invalidUpdateExit",updateDesign:"updateDesign"}).addConditionalEdges("assessBuildRequest",qx,{invalidBuildExit:"invalidBuildExit",selectTemplateHIL:"selectTemplateHIL",findExistingSolutions:"findExistingSolutions"}).addEdge("invalidBuildExit",K).addEdge("invalidUpdateExit",K).addEdge("selectTemplateHIL","findExistingSolutions").addConditionalEdges("findExistingSolutions",Bx,{confirmContinueBuildingHIL:"confirmContinueBuildingHIL",designSolution:"designSolution"}).addConditionalEdges("confirmContinueBuildingHIL",Kx,{declineContinueBuildingExit:"declineContinueBuildingExit",designSolution:"designSolution"}).addEdge("declineContinueBuildingExit",K).addEdge("designSolution",K).addEdge("updateDesign",K);await be(fr,"description");var Hx=w.object({tool:w.enum(["explorer","builder","other"]).describe("The selected tool based on the user\u2019s intent using the conversation context."),confidence:w.number().min(0).max(1).describe("A confidence score (0.00\u20131.00)."),rationale:w.string().min(1).describe("A brief rationale for the tool choice (\u2264140 characters)")}),wi=t=>t?.signal?.aborted??!1,vl=Object.assign({"./prompts/assistantResponse.md":()=>import("./4L7TJNAM.js").then(t=>t.default),"./prompts/classifyIntent.md":()=>import("./LWJF6EXD.js").then(t=>t.default),"./prompts/description.md":()=>import("./ENLFOYSI.js").then(t=>t.default)}),Vx=t=>{let e=t?.configurable?.context?.solutionDesignJson,r=t?.configurable?.context?.lastTurnAgent,n=r==="assistant"?"other":r,o=!1;if(typeof e=="string"&&e.trim())try{o=JSON.parse(e).solution!=null}catch{o=!1}return{activeSolutionDesign:o,lastTool:n}},Il=(t,e)=>{let r=t?.configurable?.context?.setLastTurnAgent;typeof r=="function"&&r(e);let n=new CustomEvent("assistantProcessing",{detail:{finished:!0,agent:e}});window.dispatchEvent(n)},tm=S.Root({...ii(),selectedTool:S({reducer:(t,e)=>e??null,default:()=>null}),intentRationale:S({reducer:(t,e)=>e??null,default:()=>null})}),Gx=async(t,e)=>{if(wi(e))return{};let r=_i(e);await Pe({text:r?.builderMessages.understandingRequest},e);let n=t.agentExecutionContext.userRequest,o=t.agentExecutionContext.messages.slice(-11),{activeSolutionDesign:s,lastTool:i}=Vx(e),a=await be(vl,"classifyIntent"),c=await kt({promptText:a,modelTier:"advanced",temperature:0,schema:Hx,messages:o,inputVariables:{query:n,activeSolutionDesign:s,lastTool:i}});return{selectedTool:c.tool,intentRationale:c.rationale}},Jx=async(t,e)=>{if(wi(e))return{};let r=await VA().compile().invoke(t,e);return Il(e,"explorer"),r},Zx=async(t,e)=>{if(wi(e))return{};let r=await Wx().compile().invoke(t,e);return Il(e,"builder"),r},Qx=async(t,e)=>{if(wi(e))return{};let r=_i(e),n=t.agentExecutionContext.userRequest;await Pe({text:r?.executingSolutionsAssistantAgent},e);let o=await be(vl,"assistantResponse"),s=t.agentExecutionContext.messages.slice(-11),i=await Pp({promptText:o,modelTier:"advanced",temperature:0,messages:s,inputVariables:{query:n}});return Il(e,"assistant"),{outputMessage:i,summary:i,status:"success"}},Yx=t=>t.selectedTool??"other",Xx=()=>new fe(tm).addNode("classifyIntent",Gx).addNode("routeToExplorer",Jx).addNode("routeToBuilder",Zx).addNode("assistantResponse",Qx).addEdge(me,"classifyIntent").addConditionalEdges("classifyIntent",Yx,{explorer:"routeToExplorer",builder:"routeToBuilder",other:"assistantResponse"}).addEdge("routeToExplorer",K).addEdge("routeToBuilder",K).addEdge("assistantResponse",K),ev=await be(vl,"description"),tv={id:"solutionsAssistant",name:"Solutions Assistant Agent",description:ev,createGraph:Xx,workspace:tm},rv="https://links.esri.com/solutions/agol-organizational-account",nv="https://links.esri.com/solutions/configure-assistants",wl=class extends Ll{constructor(){super(),this.open=!1,this.userFirstName="",this.builderVisible=!1,this.hasActiveBuilderDesign=!1,this._conversationId=void 0,this._lastTurnAgent=void 0,this._orgSettings={aiAssistantsEnabled:!1,blockBetaApps:!0,colocateCompute:!1},this._suggestedPrompts=[],this._hasInteracted=!1,this._isMobile=window.innerWidth<=800,this._translations=Fl({name:"arcgis-solutions-assistant",blocking:!0}),this._builderWidth=48,this._solutionDesignJson='{ "solution": null }',this._isAssistantBusy=!1,this._isBuilderBusy=!1,this._preChatCheck=!1,this._showNewChatConfirm=!1,this._assistantRef=$l(),this._configContextConsumer=Ii({context:jl,subscribe:!0,callback:e=>{e?.portalURL&&(gl.portalUrl=e.portalURL),e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings)}}),this._builderDesignContextConsumer=Ii({context:zl,subscribe:!0,callback:e=>{e?.design&&(this._solutionDesignJson=JSON.stringify(e.design,null,2))}}),this._handleResize=()=>{this._isMobile=window.innerWidth<=800},this._chatStartTime=null,this._handleAssistantProcessingFinished=e=>{let r=e;if(r.detail?.finished&&this._chatStartTime!==null){let n=ql(this._chatStartTime);this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"Chat",dimensions:[r.detail.agent],metrics:[n]}),this._chatStartTime=null}},this.closeAssistant=xi(),this.assistantProcessing=xi(),this._handleAssistantLinkClick=e=>{let r=e.composedPath().find(n=>n instanceof HTMLAnchorElement);if(r?.href)if(e.preventDefault(),r.target.indexOf("solutionId:")>-1){let n=r.target.split("solutionId:")[1];this._emitItemIdFromAI(n)}else window.open(r.href,"_blank","noopener,noreferrer")},this._onSolutionDesignUpdate=e=>{let r=e.detail;this._solutionDesignJson=r?JSON.stringify(r,null,2):'{ "solution": null }'},this._handleSignIn=()=>{this._configContextConsumer.value?.authentication?.signIn("aiOpen")},this._checkURLOpenParameter=()=>{this.open=this._configContextConsumer.value?.authentication?.SignInParam==="aiOpen"||this.open},this.listenOn(window,"arcgisFeedback",e=>{let r=e.detail,{agentPicked:n,taskAssigned:o,userMessage:s}=this._parseAgentPickedAndTask(r);this._sendFeedback(r.content,s??o??"",r.feedback?.positive?"Good":r.feedback?.positive=="Bad"?"Bad":"N/A",n??"")}),this.listenOn(window,"clearAssistantConversation",()=>{this._clearConversation()})}static{this.properties={open:5,userFirstName:1,builderVisible:5,hasActiveBuilderDesign:5,_conversationId:16,_lastTurnAgent:16,_orgSettings:16,_suggestedPrompts:16,_hasInteracted:16,_isMobile:16,_translations:16,_builderWidth:16,_solutionDesignJson:16,_isAssistantBusy:16,_isBuilderBusy:16,_preChatCheck:16,_showNewChatConfirm:16}}static{this.styles=FA}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}connectedCallback(){super.connectedCallback(),window.addEventListener("arcgis-solution-design-update",this._onSolutionDesignUpdate),this.el.addEventListener("click",this._handleAssistantLinkClick),window.addEventListener("resize",this._handleResize),window.addEventListener("assistantProcessing",this._handleAssistantProcessingFinished),this._builderDesignContextConsumer}disconnectedCallback(){window.removeEventListener("arcgis-solution-design-update",this._onSolutionDesignUpdate),this.el.removeEventListener("click",this._handleAssistantLinkClick),window.removeEventListener("resize",this._handleResize),window.removeEventListener("assistantProcessing",this._handleAssistantProcessingFinished),super.disconnectedCallback()}loaded(){this._checkURLOpenParameter()}load(){gl.applicationName="Solutions",this._configContextConsumer.value?.portalURL&&(gl.portalUrl=this._configContextConsumer.value.portalURL)}firstUpdated(e){this._loadUserFirstName()}willUpdate(e){e.has("open")&&this.open&&window.dispatchEvent(new CustomEvent("openAssistant")),this._configContextConsumer.value?.authentication&&this._configContextConsumer.value?.userSession?.token&&(this._preChatCheck||(Wp(this._configContextConsumer.value?.authentication.Portal,this._configContextConsumer.value?.userSession?.token,this._configContextConsumer.value?.locale??"en"),this._preChatCheck=!0)),this._configContextConsumer.value?.userSession?.token&&this._configContextConsumer.value?.authentication?.CanUseAI}_renderNoSign(){return st`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage??vi} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`}_renderNoPermission(){return st`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${uc(this._translations.noPermissionMessage.replace("{{orgUrl}}",rv).replace("{{configAI}}",nv))}</div></calcite-notice>`}render(){let e=this._suggestedPrompts.length>0?this._suggestedPrompts:this._hasInteracted?[]:Object.values(this._translations.defaultFollowUpQuestions);return this._suggestedPrompts.length>0?e=this._suggestedPrompts:this._hasInteracted||(e=[...Object.values(this._translations.defaultFollowUpQuestions)]),st`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token?this._configContextConsumer.value?.authentication?.CanUseAI?st`${!this._isMobile&&st`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${()=>{this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"Toggle Builder Panel",dimensions:[this.builderVisible?"Close":"Open"]}),window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"))}} scale=m slot=header-actions-end></calcite-action>`||""}${!this._isMobile&&st`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>`||""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage??vi} .suggestedPrompts=${e} @arcgisSubmit=${()=>{this._suggestedPrompts=[],e=[],this._hasInteracted=!0,this._chatStartTime=Date.now(),this.assistantProcessing.emit(!0)}} @arcgisFeedback=${r=>{r.detail}} @arcgisResponse=${()=>{this.assistantProcessing.emit(!1)}} ${Nl(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${()=>{this.hasActiveBuilderDesign?this._showNewChatConfirm=!0:(this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"New Chat",dimensions:["No Active Design"]}),this._clearConversation())}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${tv} .context=${{token:this._configContextConsumer.value?.userSession?.token,configContext:this._configContextConsumer.value,convoId:this._conversationId,portal:this._configContextConsumer.value?.authentication.Portal,assistantRef:this._assistantRef,translations:this._translations,solutionDesignJson:this._solutionDesignJson,lastTurnAgent:this._lastTurnAgent,setConversationId:r=>{this._conversationId=r},setLastTurnAgent:r=>{this._lastTurnAgent=r},clearSuggestedPrompts:()=>{this._suggestedPrompts=[]}}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>`:this._renderNoPermission():this._renderNoSign()}${this._showNewChatConfirm&&st`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${()=>{this._showNewChatConfirm=!1}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${()=>{this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"New Chat",dimensions:["With Design Discard"]}),this._showNewChatConfirm=!1,window.dispatchEvent(new CustomEvent("requestBuilderDiscard"))}} slot=footer-end>${this._translations.discard}</calcite-button></calcite-dialog>`||""}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${()=>{this.closeAssistant.emit(!0)}} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`}_clearConversation(){this._conversationId=void 0,this._lastTurnAgent=void 0,this._suggestedPrompts=[],this._hasInteracted=!1,this._assistantRef.value?.clearChatHistory()}_sendFeedback(e,r,n,o){let s=`https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(r)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({agent:o}))}&field:version=${encodeURIComponent("v2")}`;window.open(s,"_blank")}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let r=e.fullName.split(" ")[0];this.userFirstName=r}}catch{}}_parseAgentPickedAndTask(e){let r=Array.from(this._assistantRef.value?.messages||[]),n=e.log||[],o=[...r].sort((u,m)=>m.id-u.id).find(u=>u.role==="user"&&u.id<=e.id)?.content||null,s=n.find(u=>typeof u=="string"&&u.includes("Agent picked:"))??null;if(!s)return{agentPicked:null,taskAssigned:null,userMessage:o};let i=/Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i,a=s.match(i);if(!a)return{agentPicked:null,taskAssigned:null,userMessage:o};let c=a[1].trim(),l=a[2].trim();return{agentPicked:c,taskAssigned:l,userMessage:o}}_emitItemIdFromAI(e){let r=new CustomEvent("solutionIDFromAssistant",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(r)}};Dl("arcgis-solutions-assistant",wl);return wl},"config","identity/IdentityManager","portal/Portal","portal/Portal","identity/IdentityManager","config","core/reactiveUtils","layers/FeatureLayer","request","layers/FeatureLayer","core/reactiveUtils","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","Graphic","rest/locator","symbols/PictureMarkerSymbol","geometry/Extent","geometry/Point","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type","layers/support/FeatureEffect","layers/support/FeatureFilter","geometry/operators/unionOperator","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/TopFeaturesQuery","rest/support/TopFilter","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","views/LinkChartView","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","portal/Portal","portal/PortalItem",a,b)
340
+ `:return"\\n";case"\r":return"\\r";case" ":return"\\t";default:return"\\u"+U.charCodeAt(0).toString(16).padStart(4,"0")}});try{return JSON.parse(z)}catch{return P}}},l=[...a.map(P=>({op:P.op,path:P.path.replace(/\/+$/,""),...P.value!=null&&P.value!==""?{value:c(P.value)}:{},...P.from!=null&&P.from!==""?{from:P.from}:{}}))].sort((P,z)=>P.op!=="remove"||z.op!=="remove"?0:z.path.localeCompare(P.path,void 0,{numeric:!0})),u=structuredClone(Li(r));try{Jn(u,l,!0)}catch(P){console.warn("[SolutionBuilder] updateDesign JSON patch failed:",{error:P,llmResponse:s,patches:l,patchTarget:u});let z=re("applyChangeFailed",e);return{outputMessage:z,summary:z,status:"success"}}let m=hr({response:"",...u},{itemId:r.solution?.itemId??null}),f=bl.safeParse(m);if(!f.success){console.warn("[SolutionBuilder] updateDesign schema validation failed:",{errors:f.error.issues,llmResponse:s,patchedDesign:m});let P=re("applyChangeFailed",e);return{outputMessage:P,summary:P,status:"success"}}let{response:h,featureLayer:b,...A}=f.data,E=Fi(b,r.featureLayer),y=hr({...A,featureLayer:E},{itemId:r.solution?.itemId,sourceBuildSolution:r.sourceBuildSolution,templateId:r.templateId??t.selectedTemplate??null,params:r.params??null}),v=to(t.selectedTemplate);if(v?.initialTemplate||(await xl(e),v=to(t.selectedTemplate)),G(e))return{};if(!v?.initialTemplate)throw new Error("No hydrated templates are available for solution design.");let C=new yi(y,v.initialTemplate,!1);if(!C.isValid){console.warn("[SolutionBuilder] updateDesign validation failed:",{issues:C.issues,llmResponse:s,patchedDesign:y});let P=await fx({query:n,validationIssues:C.issues,recentMessages:o,fallbackMessage:re("applyChangeFailed",e),promptModules:fr});return{outputMessage:P,summary:P,status:"success"}}let L=y.sourceBuildSolution,B=Gp(y,L);if(!B.ok){console.warn("[SolutionBuilder] updateDesign Esri JSON conversion failed:",{error:B.error,llmResponse:s,design:y});let P=re("applyChangeFailed",e);return{outputMessage:P,summary:P,status:"success"}}return G(e)?{}:(Vp(y),{outputMessage:i,summary:i,status:"success",currentDesign:y})},zx=t=>t.currentDesign!==null?"assessUpdateRequest":"assessBuildRequest",Ux=t=>!t.updateAssessment||!t.updateAssessment.isValidUpdate?"invalidUpdateExit":"updateDesign",qx=t=>!t.assessment||!t.assessment.isValidUseCase?"invalidBuildExit":!t.selectedTemplate&&t.assessment.matchedTemplates.length>1?"selectTemplateHIL":"findExistingSolutions",Bx=t=>t.existingMatches.length>0?"confirmContinueBuildingHIL":"designSolution",Kx=t=>t.continueBuilding===!1?"declineContinueBuildingExit":"designSolution",Wx=()=>new fe(kx).addNode("syncCurrentDesignFromContext",Ox).addNode("assessBuildRequest",Px).addNode("assessUpdateRequest",Rx).addNode("invalidBuildExit",Mx).addNode("invalidUpdateExit",$x).addNode("selectTemplateHIL",Nx).addNode("findExistingSolutions",Lx).addNode("confirmContinueBuildingHIL",Dx).addNode("declineContinueBuildingExit",Fx).addNode("designSolution",em).addNode("updateDesign",jx).addEdge(me,"syncCurrentDesignFromContext").addConditionalEdges("syncCurrentDesignFromContext",zx,{assessUpdateRequest:"assessUpdateRequest",assessBuildRequest:"assessBuildRequest"}).addConditionalEdges("assessUpdateRequest",Ux,{invalidUpdateExit:"invalidUpdateExit",updateDesign:"updateDesign"}).addConditionalEdges("assessBuildRequest",qx,{invalidBuildExit:"invalidBuildExit",selectTemplateHIL:"selectTemplateHIL",findExistingSolutions:"findExistingSolutions"}).addEdge("invalidBuildExit",K).addEdge("invalidUpdateExit",K).addEdge("selectTemplateHIL","findExistingSolutions").addConditionalEdges("findExistingSolutions",Bx,{confirmContinueBuildingHIL:"confirmContinueBuildingHIL",designSolution:"designSolution"}).addConditionalEdges("confirmContinueBuildingHIL",Kx,{declineContinueBuildingExit:"declineContinueBuildingExit",designSolution:"designSolution"}).addEdge("declineContinueBuildingExit",K).addEdge("designSolution",K).addEdge("updateDesign",K);await be(fr,"description");var Hx=w.object({tool:w.enum(["explorer","builder","other"]).describe("The selected tool based on the user\u2019s intent using the conversation context."),confidence:w.number().min(0).max(1).describe("A confidence score (0.00\u20131.00)."),rationale:w.string().min(1).describe("A brief rationale for the tool choice (\u2264140 characters)")}),wi=t=>t?.signal?.aborted??!1,vl=Object.assign({"./prompts/assistantResponse.md":()=>import("./4L7TJNAM.js").then(t=>t.default),"./prompts/classifyIntent.md":()=>import("./LWJF6EXD.js").then(t=>t.default),"./prompts/description.md":()=>import("./ENLFOYSI.js").then(t=>t.default)}),Vx=t=>{let e=t?.configurable?.context?.solutionDesignJson,r=t?.configurable?.context?.lastTurnAgent,n=r==="assistant"?"other":r,o=!1;if(typeof e=="string"&&e.trim())try{o=JSON.parse(e).solution!=null}catch{o=!1}return{activeSolutionDesign:o,lastTool:n}},Il=(t,e)=>{let r=t?.configurable?.context?.setLastTurnAgent;typeof r=="function"&&r(e);let n=new CustomEvent("assistantProcessing",{detail:{finished:!0,agent:e}});window.dispatchEvent(n)},tm=S.Root({...ii(),selectedTool:S({reducer:(t,e)=>e??null,default:()=>null}),intentRationale:S({reducer:(t,e)=>e??null,default:()=>null})}),Gx=async(t,e)=>{if(wi(e))return{};let r=_i(e);await Pe({text:r?.builderMessages.understandingRequest},e);let n=t.agentExecutionContext.userRequest,o=t.agentExecutionContext.messages.slice(-11),{activeSolutionDesign:s,lastTool:i}=Vx(e),a=await be(vl,"classifyIntent"),c=await kt({promptText:a,modelTier:"advanced",temperature:0,schema:Hx,messages:o,inputVariables:{query:n,activeSolutionDesign:s,lastTool:i}});return{selectedTool:c.tool,intentRationale:c.rationale}},Jx=async(t,e)=>{if(wi(e))return{};let r=await VA().compile().invoke(t,e);return Il(e,"explorer"),r},Zx=async(t,e)=>{if(wi(e))return{};let r=await Wx().compile().invoke(t,e);return Il(e,"builder"),r},Qx=async(t,e)=>{if(wi(e))return{};let r=_i(e),n=t.agentExecutionContext.userRequest;await Pe({text:r?.executingSolutionsAssistantAgent},e);let o=await be(vl,"assistantResponse"),s=t.agentExecutionContext.messages.slice(-11),i=await Pp({promptText:o,modelTier:"advanced",temperature:0,messages:s,inputVariables:{query:n}});return Il(e,"assistant"),{outputMessage:i,summary:i,status:"success"}},Yx=t=>t.selectedTool??"other",Xx=()=>new fe(tm).addNode("classifyIntent",Gx).addNode("routeToExplorer",Jx).addNode("routeToBuilder",Zx).addNode("assistantResponse",Qx).addEdge(me,"classifyIntent").addConditionalEdges("classifyIntent",Yx,{explorer:"routeToExplorer",builder:"routeToBuilder",other:"assistantResponse"}).addEdge("routeToExplorer",K).addEdge("routeToBuilder",K).addEdge("assistantResponse",K),ev=await be(vl,"description"),tv={id:"solutionsAssistant",name:"Solutions Assistant Agent",description:ev,createGraph:Xx,workspace:tm},rv="https://links.esri.com/solutions/agol-organizational-account",nv="https://links.esri.com/solutions/configure-assistants",wl=class extends Ll{constructor(){super(),this.open=!1,this.userFirstName="",this.builderVisible=!1,this.hasActiveBuilderDesign=!1,this._conversationId=void 0,this._lastTurnAgent=void 0,this._lastResponseAgent=void 0,this._orgSettings={aiAssistantsEnabled:!1,blockBetaApps:!0,colocateCompute:!1},this._suggestedPrompts=[],this._hasInteracted=!1,this._isMobile=window.innerWidth<=800,this._translations=Fl({name:"arcgis-solutions-assistant",blocking:!0}),this._builderWidth=48,this._solutionDesignJson='{ "solution": null }',this._isAssistantBusy=!1,this._isBuilderBusy=!1,this._preChatCheck=!1,this._showNewChatConfirm=!1,this._assistantRef=$l(),this._configContextConsumer=Ii({context:jl,subscribe:!0,callback:e=>{e?.portalURL&&(gl.portalUrl=e.portalURL),e?.userSession&&!this.userFirstName&&this._loadUserFirstName(),e?.authentication?.PortalSubset?.orgSettings&&(this._orgSettings=e?.authentication?.PortalSubset?.orgSettings)}}),this._builderDesignContextConsumer=Ii({context:zl,subscribe:!0,callback:e=>{e?.design&&(this._solutionDesignJson=JSON.stringify(e.design,null,2))}}),this._handleResize=()=>{this._isMobile=window.innerWidth<=800},this._chatStartTime=null,this._responseMetadata=new Map,this._pendingResponseAgent=void 0,this._handleAssistantProcessingFinished=e=>{let r=e;if(r.detail?.finished&&this._chatStartTime!==null){let n=r.detail.agent;this._lastResponseAgent=n,this._pendingResponseAgent=n;let o=ql(this._chatStartTime);this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"Chat",dimensions:[n],metrics:[o]}),this._chatStartTime=null}},this.closeAssistant=xi(),this.assistantProcessing=xi(),this._handleAssistantLinkClick=e=>{let r=e.composedPath().find(n=>n instanceof HTMLAnchorElement);if(r?.href)if(e.preventDefault(),r.target.indexOf("solutionId:")>-1){let n=r.target.split("solutionId:")[1];this._emitItemIdFromAI(n)}else window.open(r.href,"_blank","noopener,noreferrer")},this._onSolutionDesignUpdate=e=>{let r=e.detail;this._solutionDesignJson=r?JSON.stringify(r,null,2):'{ "solution": null }'},this._handleSignIn=()=>{this._configContextConsumer.value?.authentication?.signIn("aiOpen")},this._checkURLOpenParameter=()=>{this.open=this._configContextConsumer.value?.authentication?.SignInParam==="aiOpen"||this.open},this.listenOn(window,"arcgisFeedback",e=>{let r=e.detail,{agentPicked:n,taskAssigned:o,userMessage:s}=this._parseAgentPickedAndTask(r),i=this._responseMetadata.get(r.id),a=i?.agent??n??"",c=i?.userMessage??i?.userMessage??s??o??"";this._sendFeedback(r.content,c,r.feedback?.positive?"Good":r.feedback?.positive===!1?"Bad":"N/A",a)}),this.listenOn(window,"clearAssistantConversation",()=>{this._clearConversation()})}static{this.properties={open:5,userFirstName:1,builderVisible:5,hasActiveBuilderDesign:5,_conversationId:16,_lastTurnAgent:16,_lastResponseAgent:16,_orgSettings:16,_suggestedPrompts:16,_hasInteracted:16,_isMobile:16,_translations:16,_builderWidth:16,_solutionDesignJson:16,_isAssistantBusy:16,_isBuilderBusy:16,_preChatCheck:16,_showNewChatConfirm:16}}static{this.styles=FA}get _telemetry(){return this._configContextConsumer.value?.telemetrySession}connectedCallback(){super.connectedCallback(),window.addEventListener("arcgis-solution-design-update",this._onSolutionDesignUpdate),this.el.addEventListener("click",this._handleAssistantLinkClick),window.addEventListener("resize",this._handleResize),window.addEventListener("assistantProcessing",this._handleAssistantProcessingFinished),this._builderDesignContextConsumer}disconnectedCallback(){window.removeEventListener("arcgis-solution-design-update",this._onSolutionDesignUpdate),this.el.removeEventListener("click",this._handleAssistantLinkClick),window.removeEventListener("resize",this._handleResize),window.removeEventListener("assistantProcessing",this._handleAssistantProcessingFinished),super.disconnectedCallback()}loaded(){this._checkURLOpenParameter()}load(){gl.applicationName="Solutions",this._configContextConsumer.value?.portalURL&&(gl.portalUrl=this._configContextConsumer.value.portalURL)}firstUpdated(e){this._loadUserFirstName()}willUpdate(e){e.has("open")&&this.open&&window.dispatchEvent(new CustomEvent("openAssistant")),this._configContextConsumer.value?.authentication&&this._configContextConsumer.value?.userSession?.token&&(this._preChatCheck||(Wp(this._configContextConsumer.value?.authentication.Portal,this._configContextConsumer.value?.userSession?.token,this._configContextConsumer.value?.locale??"en"),this._preChatCheck=!0)),this._configContextConsumer.value?.userSession?.token&&this._configContextConsumer.value?.authentication?.CanUseAI}_renderNoSign(){return st`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=message>${this._translations.signInMessage}</div><calcite-link @click=${this._handleSignIn} slot=link title=${this._translations.signInMessage??vi} class="padding-top-10">${this._translations.signIn}</calcite-link></calcite-notice>`}_renderNoPermission(){return st`<calcite-notice class="margin-lg" open scale=m icon=effects kind=info><div slot=title>${this._translations.noPermissionTitle}</div><div slot=message class="padding-top-10">${uc(this._translations.noPermissionMessage.replace("{{orgUrl}}",rv).replace("{{configAI}}",nv))}</div></calcite-notice>`}render(){let e=this._suggestedPrompts.length>0?this._suggestedPrompts:this._hasInteracted?[]:Object.values(this._translations.defaultFollowUpQuestions);return this._suggestedPrompts.length>0?e=this._suggestedPrompts:this._hasInteracted||(e=[...Object.values(this._translations.defaultFollowUpQuestions)]),st`<calcite-panel class="chat-panel"><div class="header-content" slot=header-content><span class="header-title">${this._translations.solutionAssistantTitle}</span></div>${this._configContextConsumer.value?.userSession?.token?this._configContextConsumer.value?.authentication?.CanUseAI?st`${!this._isMobile&&st`<calcite-action id=solutionBuilderAction icon=pencil-square .text=${this._translations.tooltips.builder} text-enabled .indicator=${this.hasActiveBuilderDesign} .disabled=${!this.hasActiveBuilderDesign} .active=${this.builderVisible} selection-appearance=highlight @click=${()=>{this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"Toggle Builder Panel",dimensions:[this.builderVisible?"Close":"Open"]}),window.dispatchEvent(new CustomEvent("toggleSolutionBuilder"))}} scale=m slot=header-actions-end></calcite-action>`||""}${!this._isMobile&&st`<calcite-tooltip placement=bottom reference-element=solutionBuilderAction><span>${this._translations.tooltips.solutionBuilder}</span></calcite-tooltip>`||""}<arcgis-assistant reference-element copy-enabled feedback-enabled heading description entry-message=${this._translations.defaultStartUpMessage??vi} .suggestedPrompts=${e} @arcgisSubmit=${()=>{this._suggestedPrompts=[],e=[],this._hasInteracted=!0,this._chatStartTime=Date.now(),this.assistantProcessing.emit(!0)}} @arcgisFeedback=${r=>{r.detail&&console.log("arcgis feedback: ",r.detail)}} @arcgisResponse=${()=>{let r=this._pendingResponseAgent??this._lastResponseAgent;if(r){let n=o=>{if(this._captureResponseMetadata(r)){this._pendingResponseAgent=void 0;return}o<3&&requestAnimationFrame(()=>n(o+1))};requestAnimationFrame(()=>n(1))}this.assistantProcessing.emit(!1)}} ${Nl(this._assistantRef)}><calcite-button appearance=transparent id=newChatButton icon-start=speech-bubble-plus kind=neutral .label=${this._translations.tooltips.newChat} @click=${()=>{this.hasActiveBuilderDesign?this._showNewChatConfirm=!0:(this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"New Chat",dimensions:["No Active Design"]}),this._clearConversation())}} round scale=m slot=entry-actions-start>${this._translations.tooltips.newChat}</calcite-button><arcgis-assistant-agent .agent=${tv} .context=${{token:this._configContextConsumer.value?.userSession?.token,configContext:this._configContextConsumer.value,convoId:this._conversationId,portal:this._configContextConsumer.value?.authentication.Portal,assistantRef:this._assistantRef,translations:this._translations,solutionDesignJson:this._solutionDesignJson,lastTurnAgent:this._lastTurnAgent,setConversationId:r=>{this._conversationId=r},setLastTurnAgent:r=>{this._lastTurnAgent=r},clearSuggestedPrompts:()=>{this._suggestedPrompts=[]}}}></arcgis-assistant-agent></arcgis-assistant><div slot=footer class="disclaimer-div width-100"><calcite-chip class="beta-chip" appearance=solid kind=neutral .label=${this._translations.betaTag} scale=s>${this._translations.betaTag}</calcite-chip><span>${this._translations.disclaimerMessage} <a href=https://links.esri.com/solutions/security-concern rel="noopener noreferrer" target=_blank>${this._translations.reportConcern}</a></span></div>`:this._renderNoPermission():this._renderNoSign()}${this._showNewChatConfirm&&st`<calcite-dialog close-disabled escape-disabled .heading=${this._translations.newConversationConfirmTitle} modal open outside-close-disabled>${this._translations.builderMessages.discardMessage}<calcite-button appearance=outline @click=${()=>{this._showNewChatConfirm=!1}} slot=footer-end>${this._translations.cancel}</calcite-button><calcite-button appearance=solid kind=danger @click=${()=>{this._telemetry?.logEvent({category:Zn.ASSISTANT,action:"New Chat",dimensions:["With Design Discard"]}),this._showNewChatConfirm=!1,window.dispatchEvent(new CustomEvent("requestBuilderDiscard"))}} slot=footer-end>${this._translations.discard}</calcite-button></calcite-dialog>`||""}<calcite-action icon=x id=closeAssistantButton .label=${this._translations.tooltips.close} @click=${()=>{this.closeAssistant.emit(!0)}} slot=header-actions-end .text=${this._translations.tooltips.close}></calcite-action><calcite-tooltip placement=bottom reference-element=closeAssistantButton><span>${this._translations.tooltips.close}</span></calcite-tooltip></calcite-panel>`}_clearConversation(){this._conversationId=void 0,this._lastTurnAgent=void 0,this._lastResponseAgent=void 0,this._pendingResponseAgent=void 0,this._suggestedPrompts=[],this._hasInteracted=!1,this._responseMetadata.clear(),this._assistantRef.value?.clearChatHistory()}_sendFeedback(e,r,n,o){let s=`https://survey123.arcgis.com/share/6e349a50b4504ca6b6107216d568db5f?field:_source=${encodeURIComponent("Solutions Assistant")}&field:user_evaluation=${encodeURIComponent(n)}&field:question=${encodeURIComponent(r)}&field:answer=${encodeURIComponent(e)}&field:context=${encodeURIComponent(JSON.stringify({agent:o}))}&field:version=${encodeURIComponent("v2")}`;window.open(s,"_blank")}async _loadUserFirstName(){try{let e=await this._configContextConsumer.value?.userSession?.getUser();if(e?.fullName){let r=e.fullName.split(" ")[0];this.userFirstName=r}}catch{}}_captureResponseMetadata(e){let r=Array.from(this._assistantRef.value?.messages||[]);for(let n=r.length-1;n>=0;n--){let o=r[n];if(o.role==="assistant"&&!this._responseMetadata.has(o.id)){let s;for(let i=n-1;i>=0;i--){let a=r[i];if(a.role==="user"){s=a.content;break}}return this._responseMetadata.set(o.id,{agent:e,userMessage:s}),!0}}return!1}_parseAgentPickedAndTask(e){let r=Array.from(this._assistantRef.value?.messages||[]),n=e.log||[],o=[...r].sort((u,m)=>m.id-u.id).find(u=>u.role==="user"&&u.id<=e.id)?.content||null,s=n.find(u=>typeof u=="string"&&u.includes("Agent picked:"))??null;if(!s)return{agentPicked:null,taskAssigned:null,userMessage:o};let i=/Agent picked:\s*(.*?)\s*(?:\\n|\r?\n)\s*Task Assigned:\s*([\s\S]*)$/i,a=s.match(i);if(!a)return{agentPicked:null,taskAssigned:null,userMessage:o};let c=a[1].trim(),l=a[2].trim();return{agentPicked:c,taskAssigned:l,userMessage:o}}_emitItemIdFromAI(e){let r=new CustomEvent("solutionIDFromAssistant",{detail:e,bubbles:!0,composed:!0});window.dispatchEvent(r)}};Dl("arcgis-solutions-assistant",wl);return wl},"config","identity/IdentityManager","portal/Portal","portal/Portal","identity/IdentityManager","config","core/reactiveUtils","layers/FeatureLayer","request","layers/FeatureLayer","core/reactiveUtils","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","Graphic","rest/locator","symbols/PictureMarkerSymbol","geometry/Extent","geometry/Point","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type","layers/support/FeatureEffect","layers/support/FeatureFilter","geometry/operators/unionOperator","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/TopFeaturesQuery","rest/support/TopFilter","WebLinkChart","rest/knowledgeGraph/GraphQueryStreaming","views/LinkChartView","rest/knowledgeGraphService","rest/knowledgeGraph/GraphSearchStreaming","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","portal/Portal","portal/PortalItem",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import b from"./CVHZAZLS.js";import"./2LCG2XWX.js";import"./LVYAW6XF.js";import a from"./WDASGI72.js";import"./2B4SGB3I.js";import"./RLSY4VUQ.js";import"./RDRCAA3H.js";import"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./HIPZRG2Q.js";import"./T3EPRHTT.js";import"./EXBEKVP5.js";export default $arcgis.t(([,{c:o}])=>{return o},a,b)
2
+ import b from"./RLMMQ5UC.js";import"./ESJJVBZM.js";import"./LVYAW6XF.js";import a from"./WDASGI72.js";import"./2B4SGB3I.js";import"./RLSY4VUQ.js";import"./RDRCAA3H.js";import"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./HIPZRG2Q.js";import"./T3EPRHTT.js";import"./EXBEKVP5.js";export default $arcgis.t(([,{c:o}])=>{return o},a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- var p=[{name:"blue",fill:[0,121,193],outline:[0,94,149]},{name:"red",fill:[222,41,0],outline:[171,60,22]},{name:"orange",fill:[209,126,33],outline:[173,101,17]},{name:"purple",fill:[144,129,188],outline:[116,97,168]},{name:"green",fill:[90,147,89],outline:[51,128,51]},{name:"black",fill:[89,89,89],outline:[50,50,50]}];function c(l=0){let e=(l%p.length+p.length)%p.length,i=p[e];return{fill:[...i.fill],outline:[...i.outline]}}function g(l=0){let{fill:e,outline:i}=c(l),t=[...e,153],n=[...i,255];return{renderer:{type:"simple",symbol:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,name:"Fill",anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:12,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[0,5],[.87,4.92],[1.71,4.7],[2.5,4.33],[3.21,3.83],[3.83,3.21],[4.33,2.5],[4.7,1.71],[4.92,.87],[5,0],[4.92,-.87],[4.7,-1.71],[4.33,-2.5],[3.83,-3.21],[3.21,-3.83],[2.5,-4.33],[1.71,-4.7],[.87,-4.92],[0,-5],[-.87,-4.92],[-1.71,-4.7],[-2.5,-4.33],[-3.21,-3.83],[-3.83,-3.21],[-4.33,-2.5],[-4.7,-1.71],[-4.92,-.87],[-5,0],[-4.92,.87],[-4.7,1.71],[-4.33,2.5],[-3.83,3.21],[-3.21,3.83],[-2.5,4.33],[-1.71,4.7],[-.87,4.92],[0,5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,name:"Outline",capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:4,width:1.5,height3D:1,anchor3D:"Center",color:n},{type:"CIMSolidFill",enable:!0,name:"Fill",color:t}],angleAlignment:"Map"}}],scaleSymbolsProportionally:!0,respectFrame:!0,rotation:360},{type:"CIMVectorMarker",enable:!0,name:"WhiteOutline",colorLocked:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:15.75,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[0,5],[.87,4.92],[1.71,4.7],[2.5,4.33],[3.21,3.83],[3.83,3.21],[4.33,2.5],[4.7,1.71],[4.92,.87],[5,0],[4.92,-.87],[4.7,-1.71],[4.33,-2.5],[3.83,-3.21],[3.21,-3.83],[2.5,-4.33],[1.71,-4.7],[.87,-4.92],[0,-5],[-.87,-4.92],[-1.71,-4.7],[-2.5,-4.33],[-3.21,-3.83],[-3.83,-3.21],[-4.33,-2.5],[-4.7,-1.71],[-4.92,-.87],[-5,0],[-4.92,.87],[-4.7,1.71],[-4.33,2.5],[-3.83,3.21],[-3.21,3.83],[-2.5,4.33],[-1.71,4.7],[-.87,4.92],[0,5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,name:"WhiteOutline",color:[255,255,255,153]}],angleAlignment:"Map"}}],scaleSymbolsProportionally:!0,respectFrame:!0,rotation:360}],haloSize:.75,scaleX:1,angleAlignment:"Display",angle:360}}}}}function F(l=0){let{fill:e}=c(l);return{renderer:{type:"simple",symbol:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,name:"Fill",capStyle:"Round",joinStyle:"Miter",lineStyle3D:"Strip",miterLimit:4,width:4.5,height3D:1,anchor3D:"Center",color:[...e,255]},{type:"CIMSolidStroke",enable:!0,name:"Outline",colorLocked:!0,capStyle:"Round",joinStyle:"Miter",lineStyle3D:"Strip",miterLimit:4,width:6,height3D:1,anchor3D:"Center",color:[255,255,255,153]}]}}}}}function L(l=0){let{fill:e,outline:i}=c(l),t=[...e,153];return{renderer:{type:"simple",symbol:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,name:"Outline",capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:4,width:1.5,height3D:1,anchor3D:"Center",color:[...i,255]},{type:"CIMSolidFill",enable:!0,name:"Fill",color:t}],angleAlignment:"Map"}}}}}var f=class l{constructor(e){this.llmFsLookup={},this.rendererColorCounters={esriGeometryPoint:0,esriGeometryPolyline:0,esriGeometryPolygon:0},this.structure=e,this.buildSolution=this.structure?.buildSolution}static{this.typeLookup={point:"esriGeometryPoint",polyline:"esriGeometryPolyline",polygon:"esriGeometryPolygon"}}static{this.simpleTypeLookup={esriGeometryPoint:"Point",esriGeometryPolyline:"Polyline",esriGeometryPolygon:"Polygon"}}static{this.drawingToolLookup={esriGeometryPoint:"esriFeatureEditToolPoint",esriGeometryPolyline:"esriFeatureEditToolLine",esriGeometryPolygon:"esriFeatureEditToolPolygon",Table:"esriFeatureEditToolNone"}}static{this.fieldTypeToEsri={string:"esriFieldTypeString",integer:"esriFieldTypeInteger",double:"esriFieldTypeDouble",date:"esriFieldTypeDate",guid:"esriFieldTypeGUID",globalid:"esriFieldTypeGlobalID",oid:"esriFieldTypeOID"}}static{this.fieldTypeToSimple=Object.fromEntries(Object.entries(l.fieldTypeToEsri).map(([e,i])=>[i,e]))}dumpToLlmTemplate(){let e=this.structure?.buildSolution?.solution,i=Object.entries(e?.strings||{}).map(([o,r])=>({key:o,value:r.value,description:r.description})),t={title:e?.title,description:e?.description,tags:e?.tags,strings:i},n=this.structure?.buildSolution?.items,s=Object.entries(n||{}).map(([o,r])=>({id:o,title:r.title,description:r.description,type:r.type})),a=null;for(let[o,r]of Object.entries(n||{})){if(r.type!=="Feature Layer (hosted)")continue;let d=[];for(let y of r.service?.layers||[]){let u=this.getFields(y),m={id:y.id,type:"",typeMutable:!0,name:y.name,customFields:[],requiredFields:u,systemFields:[]};y.geometryType&&(m.type=l.simpleTypeLookup[y.geometryType]||"",m.typeMutable=!1),d.push(m)}for(let y of r.service?.tables||[]){let u=this.getFields(y);d.push({id:y.id,type:"Table",typeMutable:!1,name:y.name,customFields:[],requiredFields:u,systemFields:[]})}a={itemId:o,addLayers:r.addLayers,layers:d};break}return{solution:t,items:s,featureLayer:a??{itemId:"",addLayers:!1,layers:[]}}}getFields(e){let i=[];for(let t of e.fields||[])i.push({name:t.name,type:l.fieldTypeToSimple[t.type]||t.type,alias:t.alias,description:l.getFieldDescription(t.description),choiceList:l.getFieldDomain(t.domain),length:t.length});return i}static getFieldDescription(e){if(e)try{return JSON.parse(e).value||e}catch{return e}}static getFieldDomain(e){if(e)return e.codedValues?.map(i=>i.code)}applyLlmTemplate(e){let i=this.buildSolution.solution;if(this.resetRendererColorCounters(),this.llmFsLookup={},e.featureLayer?.itemId){this.llmFsLookup[e.featureLayer.itemId]={};for(let o of e.featureLayer.layers)this.llmFsLookup[e.featureLayer.itemId][o.id]=o}for(let[o,r]of Object.entries(this.buildSolution.items))r.type==="Feature Layer (hosted, view)"&&(this.llmFsLookup[o]={...this.llmFsLookup[r.source]});i.title=e.solution.title,i.description=e.solution.description,i.tags=e.solution.tags;let t=i.strings;for(let o of e.solution.strings)t[o.key]&&(t[o.key].value=o.value);let n={},s=new Set,a=this.buildSolution.items;for(let o of e.items){let r=a[o.id];if(r)if(r.title=o.title,r.description=o.description,r.type==="Web Map")this.applyWebMap(r);else if(r.type==="Feature Layer (hosted)"){this.applyFeatureService(r,o.id,!1);let d=I(r);r.data=d,n[o.id]=d}else r.type==="Feature Layer (hosted, view)"&&(this.applyFeatureService(r,o.id,!0),s.add(o.id))}for(let o of s){let r=a[o];r.data=n[r.source]}return this.structure}applyWebMap(e){if(!e.layerSources)return;for(let t of[...e.layers||[],...e.tables||[]]){let[n,s]=this.extractIdAndLayerId(t.url),a=this.llmFsLookup[n]?.[s];a&&(t.title=a.name)}if(!(e.layers?.length===0&&e.tables?.length===0))return;let i=crypto.randomUUID().replace(/-/gu,"").substring(0,10);for(let t of e.layerSources){let n=this.llmFsLookup[t];if(n)for(let[s,a]of Object.entries(n)){let o=Number(s),r=a.type.toLowerCase()==="table",d={id:`${i}-layer-${o}`,title:a.name,url:`{{${t}.layer${o}.url}}`,itemId:`{{${t}.layer${o}.itemId}}`};r?e.tables.unshift(d):(d.layerType="ArcGISFeatureLayer",e.layers.unshift(d))}}}extractIdAndLayerId(e){let i=e.replace(/[{}]/gu,"").split("."),t=i[0],n=Number.parseInt(i[1].replace("layer",""));return[t,n]}applyFeatureService(e,i,t=!1){let n=e.source||i,s=this.llmFsLookup[n];for(let o of[...e.service.layers,...e.service.tables])this.applyLayer(o,s,t);e.addLayers&&!t&&this.addNewLayers(e,s);let a=e.service.layers?.length===0&&e.service.tables?.length===0;t&&a&&this.addNewViewLayers(e,i,s)}addNewLayers(e,i){for(let[t,n]of Object.entries(i)){let s={id:Number(t)};this.applyLayer(s,i),n.type.toLowerCase()==="table"?e.service.tables.push(s):e.service.layers.push(s)}}addNewViewLayers(e,i,t){let n=e.source;for(let[s,a]of Object.entries(t)){let o=Number(s),r=a.type.toLowerCase()==="table",d={adminLayerInfo:{geometryField:r?null:{name:"Shape"},viewLayerDefinition:{sourceServiceName:`{{${n}.name}}`,sourceLayerId:o,sourceLayerFields:"*"}},id:o,name:a.name,extent:`{{${i}.solutionExtent}}`,maxRecordCount:2e3};r?e.service.tables.push(d):e.service.layers.push(d)}}applyLayer(e,i,t=!1){let n=i[e.id];if(!n||(e.name=n.name,e.description=n.description||"",t))return;let s=l.typeLookup[n.type.toLowerCase()]||n.type;s.toLowerCase()==="table"?e.type=s:e.geometryType=s,e.editFieldsInfo=this.editFieldsInfo(),e.globalIdField="globalid",e.objectIdField="objectid",e.uniqueIdField={name:"objectid",isSystemMaintained:!0},e.hasAttachments=!0,this.updateRelationships(e,i),this.updateFields(e,n),this.updateTemplates(e),this.updateDrawingInfo(e)}updateRelationships(e,i){let t=e.relationships||[];for(let n of t){let s=i[n.relatedTableId];s&&(n.name=s.name)}}updateFields(e,i){let t=[],n=[[!1,i.customFields],[!0,i.requiredFields],[!0,i.systemFields]];for(let[s,a]of n)if(Array.isArray(a))for(let o of a){let r={name:o.name,alias:o.alias,type:l.fieldTypeToEsri[o.type]||o.type,description:JSON.stringify({value:o.description,fieldValueType:""},null,0),domain:this.createDomain(o.choiceList,o.name),required:s};o.type?.toLowerCase()==="string"&&(r.length=o.length??256),(o.type==="oid"||o.type==="globalid")&&(r.editable=!1,r.nullable=!1),t.push(r)}e.fields=t}updateTemplates(e){let i=l.drawingToolLookup[e.geometryType||e.type];e.templates??=[{name:e.name,description:"",prototype:{attributes:{}}}];for(let t of e.templates)t.drawingTool=i}updateDrawingInfo(e){if(e.geometryType==="esriGeometryPoint")e.drawingInfo=g(this.nextRendererColorIndex(e.geometryType));else if(e.geometryType==="esriGeometryPolyline")e.drawingInfo=F(this.nextRendererColorIndex(e.geometryType));else if(e.geometryType==="esriGeometryPolygon")e.drawingInfo=L(this.nextRendererColorIndex(e.geometryType));else return}nextRendererColorIndex(e){let i=this.rendererColorCounters[e];return i===void 0?0:(this.rendererColorCounters[e]=i+1,i)}resetRendererColorCounters(){this.rendererColorCounters={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:4}}createDomain(e,i){return e?{type:"codedValue",name:`${i}_${crypto.randomUUID().replace(/-/gu,"")}`,codedValues:e.map(t=>({name:t,code:t}))}:null}editFieldsInfo(){return{creationDateField:"created_date",creatorField:"created_user",editDateField:"last_edited_date",editorField:"last_edited_user"}}};function I(l){let e=l.service,i={layers:[],tables:[]};for(let t of e.layers||[])i.layers.push({id:t.id,formInfo:h(t),popupInfo:b(t),layerDefinition:t.drawingInfo});for(let t of e.tables||[])i.tables.push({id:t.id,formInfo:h(t),popupInfo:b(t)});return i}function h(l){let e=[];e.push({label:"{{params.buildSolution.solution.strings.attachments.value||Attachments}}",type:"attachment",allowUserRename:!0,attachmentKeyword:"general",displayFilename:!1,editableExpression:"expr/system/true",filenameExpression:'StandardizeFilename(`${$formElement.attachmentKeyword}_${Text(Now(), "YMMDDHHmmss")}`)',inputType:{type:"attachment",attachmentAssociationType:"any",inputTypes:[{type:"audio",inputMethod:"any"},{type:"document"},{type:"image",inputMethod:"any"},{type:"video",inputMethod:"any"}]},useOriginalFilename:!0});for(let t of l.fields)t.required||e.push({label:t.alias,type:"field",editableExpression:"expr/system/true",fieldName:t.name,inputType:S(t.type,t.domain,t.length)});let i=l.relationships||[];for(let t of i)e.push({description:"",label:t.name,type:"relationship",displayCount:3,displayType:"list",editableExpression:"expr/system/true",orderByFields:[{field:"created_date",order:"asc"}],relationshipId:t.id});return{formElements:e,expressionInfos:[{expression:"false",name:"expr/system/false",returnType:"boolean",title:"False"},{expression:"true",name:"expr/system/true",returnType:"boolean",title:"True"}],title:l.name}}function b(l){let e=[],i=[];for(let n of l.fields)n.required||i.push({fieldName:n.name,isEditable:!0,label:n.alias,visible:!0});e.push({type:"fields",description:"",fieldInfos:i});let t=l.relationships||[];if(t.length&&l.type!=="Table")for(let n of t)e.push({type:"relationship",description:"",displayCount:3,displayType:"list",orderByFields:[{field:"created_date",order:"asc"}],relationshipId:n.id});return e.push({type:"attachments",description:"",displayType:"auto",title:""}),{popupElements:e,showLastEditInfo:!1,title:l.name}}function S(l,e,i){return l==="esriFieldTypeString"&&!e&&i&&i>256?{type:"text-area",maxLength:i}:l==="esriFieldTypeString"&&!e?{type:"text-box",maxLength:i||256,minLength:0}:l==="esriFieldTypeString"&&e?{type:"combo-box",showNoValueOption:!1}:["esriFieldTypeInteger","esriFieldTypeDouble"].includes(l)?{type:"text-box",minLength:0}:l==="esriFieldTypeDate"?{type:"datetime-picker",includeTime:!1}:{type:"text-box",maxLength:i||256,minLength:0}}export{f as a};
2
+ var p=[{name:"blue",fill:[0,121,193],outline:[0,94,149]},{name:"red",fill:[222,41,0],outline:[171,60,22]},{name:"orange",fill:[209,126,33],outline:[173,101,17]},{name:"purple",fill:[144,129,188],outline:[116,97,168]},{name:"green",fill:[90,147,89],outline:[51,128,51]},{name:"black",fill:[89,89,89],outline:[50,50,50]}];function c(l=0){let e=(l%p.length+p.length)%p.length,i=p[e];return{fill:[...i.fill],outline:[...i.outline]}}function g(l=0){let{fill:e,outline:i}=c(l),t=[...e,153],n=[...i,255];return{renderer:{type:"simple",symbol:{type:"CIMSymbolReference",symbol:{type:"CIMPointSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,name:"Fill",anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:12,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[0,5],[.87,4.92],[1.71,4.7],[2.5,4.33],[3.21,3.83],[3.83,3.21],[4.33,2.5],[4.7,1.71],[4.92,.87],[5,0],[4.92,-.87],[4.7,-1.71],[4.33,-2.5],[3.83,-3.21],[3.21,-3.83],[2.5,-4.33],[1.71,-4.7],[.87,-4.92],[0,-5],[-.87,-4.92],[-1.71,-4.7],[-2.5,-4.33],[-3.21,-3.83],[-3.83,-3.21],[-4.33,-2.5],[-4.7,-1.71],[-4.92,-.87],[-5,0],[-4.92,.87],[-4.7,1.71],[-4.33,2.5],[-3.83,3.21],[-3.21,3.83],[-2.5,4.33],[-1.71,4.7],[-.87,4.92],[0,5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,name:"Outline",capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:4,width:1.5,height3D:1,anchor3D:"Center",color:n},{type:"CIMSolidFill",enable:!0,name:"Fill",color:t}],angleAlignment:"Map"}}],scaleSymbolsProportionally:!0,respectFrame:!0,rotation:360},{type:"CIMVectorMarker",enable:!0,name:"WhiteOutline",colorLocked:!0,anchorPointUnits:"Relative",dominantSizeAxis3D:"Y",size:15.75,billboardMode3D:"FaceNearPlane",frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[0,5],[.87,4.92],[1.71,4.7],[2.5,4.33],[3.21,3.83],[3.83,3.21],[4.33,2.5],[4.7,1.71],[4.92,.87],[5,0],[4.92,-.87],[4.7,-1.71],[4.33,-2.5],[3.83,-3.21],[3.21,-3.83],[2.5,-4.33],[1.71,-4.7],[.87,-4.92],[0,-5],[-.87,-4.92],[-1.71,-4.7],[-2.5,-4.33],[-3.21,-3.83],[-3.83,-3.21],[-4.33,-2.5],[-4.7,-1.71],[-4.92,-.87],[-5,0],[-4.92,.87],[-4.7,1.71],[-4.33,2.5],[-3.83,3.21],[-3.21,3.83],[-2.5,4.33],[-1.71,4.7],[-.87,4.92],[0,5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,name:"WhiteOutline",color:[255,255,255,153]}],angleAlignment:"Map"}}],scaleSymbolsProportionally:!0,respectFrame:!0,rotation:360}],haloSize:.75,scaleX:1,angleAlignment:"Display",angle:360}}}}}function F(l=0){let{fill:e}=c(l);return{renderer:{type:"simple",symbol:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,name:"Fill",capStyle:"Round",joinStyle:"Miter",lineStyle3D:"Strip",miterLimit:4,width:4.5,height3D:1,anchor3D:"Center",color:[...e,255]},{type:"CIMSolidStroke",enable:!0,name:"Outline",colorLocked:!0,capStyle:"Round",joinStyle:"Miter",lineStyle3D:"Strip",miterLimit:4,width:6,height3D:1,anchor3D:"Center",color:[255,255,255,153]}]}}}}}function L(l=0){let{fill:e,outline:i}=c(l),t=[...e,153];return{renderer:{type:"simple",symbol:{type:"CIMSymbolReference",symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,name:"Outline",capStyle:"Round",joinStyle:"Round",lineStyle3D:"Strip",miterLimit:4,width:1.5,height3D:1,anchor3D:"Center",color:[...i,255]},{type:"CIMSolidFill",enable:!0,name:"Fill",color:t}],angleAlignment:"Map"}}}}}var f=class l{constructor(e){this.llmFsLookup={},this.rendererColorCounters={esriGeometryPoint:0,esriGeometryPolyline:0,esriGeometryPolygon:0},this.structure=e,this.buildSolution=this.structure?.buildSolution}static{this.typeLookup={point:"esriGeometryPoint",polyline:"esriGeometryPolyline",polygon:"esriGeometryPolygon"}}static{this.simpleTypeLookup={esriGeometryPoint:"Point",esriGeometryPolyline:"Polyline",esriGeometryPolygon:"Polygon"}}static{this.drawingToolLookup={esriGeometryPoint:"esriFeatureEditToolPoint",esriGeometryPolyline:"esriFeatureEditToolLine",esriGeometryPolygon:"esriFeatureEditToolPolygon",Table:"esriFeatureEditToolNone"}}static{this.fieldTypeToEsri={string:"esriFieldTypeString",integer:"esriFieldTypeInteger",double:"esriFieldTypeDouble",date:"esriFieldTypeDate",guid:"esriFieldTypeGUID",globalid:"esriFieldTypeGlobalID",oid:"esriFieldTypeOID"}}static{this.fieldTypeToSimple=Object.fromEntries(Object.entries(l.fieldTypeToEsri).map(([e,i])=>[i,e]))}dumpToLlmTemplate(){let e=this.structure?.buildSolution?.solution,i=Object.entries(e?.strings||{}).map(([o,r])=>({key:o,value:r.value,description:r.description})),t={title:e?.title,description:e?.description,tags:e?.tags,strings:i},n=this.structure?.buildSolution?.items,s=Object.entries(n||{}).map(([o,r])=>({id:o,title:r.title,description:r.description,type:r.type})),a=null;for(let[o,r]of Object.entries(n||{})){if(r.type!=="Feature Layer (hosted)")continue;let d=[];for(let y of r.service?.layers||[]){let u=this.getFields(y),m={id:y.id,type:"",typeMutable:!0,name:y.name,customFields:[],requiredFields:u,systemFields:[]};y.geometryType&&(m.type=l.simpleTypeLookup[y.geometryType]||"",m.typeMutable=!1),d.push(m)}for(let y of r.service?.tables||[]){let u=this.getFields(y);d.push({id:y.id,type:"Table",typeMutable:!1,name:y.name,customFields:[],requiredFields:u,systemFields:[]})}a={itemId:o,addLayers:r.addLayers,layers:d};break}return{solution:t,items:s,featureLayer:a??{itemId:"",addLayers:!1,layers:[]}}}getFields(e){let i=[];for(let t of e.fields||[])i.push({name:t.name,type:l.fieldTypeToSimple[t.type]||t.type,alias:t.alias,description:l.getFieldDescription(t.description),choiceList:l.getFieldDomain(t.domain),length:t.length});return i}static getFieldDescription(e){if(e)try{return JSON.parse(e).value||e}catch{return e}}static getFieldDomain(e){if(e)return e.codedValues?.map(i=>i.code)}applyLlmTemplate(e){let i=this.buildSolution.solution;if(this.resetRendererColorCounters(),this.llmFsLookup={},e.featureLayer?.itemId){this.llmFsLookup[e.featureLayer.itemId]={};for(let o of e.featureLayer.layers)this.llmFsLookup[e.featureLayer.itemId][o.id]=o}for(let[o,r]of Object.entries(this.buildSolution.items))r.type==="Feature Layer (hosted, view)"&&(this.llmFsLookup[o]={...this.llmFsLookup[r.source]});i.title=e.solution.title,i.description=e.solution.description,i.tags=e.solution.tags;let t=i.strings;for(let o of e.solution.strings)t[o.key]&&(t[o.key].value=o.value);let n={},s=new Set,a=this.buildSolution.items;for(let o of e.items){let r=a[o.id];if(r)if(r.title=o.title,r.description=o.description,r.type==="Web Map")this.applyWebMap(r);else if(r.type==="Feature Layer (hosted)"){this.applyFeatureService(r,o.id,!1);let d=I(r);r.data=d,n[o.id]=d}else r.type==="Feature Layer (hosted, view)"&&(this.applyFeatureService(r,o.id,!0),s.add(o.id))}for(let o of s){let r=a[o];r.data=n[r.source]}return this.structure}applyWebMap(e){if(!e.layerSources)return;for(let t of[...e.layers||[],...e.tables||[]]){let[n,s]=this.extractIdAndLayerId(t.url),a=this.llmFsLookup[n]?.[s];a&&(t.title=a.name)}if(!(e.layers?.length===0&&e.tables?.length===0))return;let i=crypto.randomUUID().replace(/-/gu,"").substring(0,10);for(let t of e.layerSources){let n=this.llmFsLookup[t];if(n)for(let[s,a]of Object.entries(n)){let o=Number(s),r=a.type.toLowerCase()==="table",d={id:`${i}-layer-${o}`,title:a.name,url:`{{${t}.layer${o}.url}}`,itemId:`{{${t}.layer${o}.itemId}}`};r?e.tables.unshift(d):(d.layerType="ArcGISFeatureLayer",e.layers.unshift(d))}}}extractIdAndLayerId(e){let i=e.replace(/[{}]/gu,"").split("."),t=i[0],n=Number.parseInt(i[1].replace("layer",""));return[t,n]}applyFeatureService(e,i,t=!1){let n=e.source||i,s=this.llmFsLookup[n];for(let o of[...e.service.layers,...e.service.tables])this.applyLayer(o,s,t);e.addLayers&&!t&&this.addNewLayers(e,s);let a=e.service.layers?.length===0&&e.service.tables?.length===0;t&&a&&this.addNewViewLayers(e,i,s)}addNewLayers(e,i){for(let[t,n]of Object.entries(i)){let s={id:Number(t)};this.applyLayer(s,i),n.type.toLowerCase()==="table"?e.service.tables.push(s):e.service.layers.push(s)}}addNewViewLayers(e,i,t){let n=e.source;for(let[s,a]of Object.entries(t)){let o=Number(s),r=a.type.toLowerCase()==="table",d={adminLayerInfo:{geometryField:r?null:{name:"Shape"},viewLayerDefinition:{sourceServiceName:`{{${n}.name}}`,sourceLayerId:o,sourceLayerFields:"*"}},id:o,name:a.name,extent:`{{${i}.solutionExtent}}`,maxRecordCount:2e3};r?e.service.tables.push(d):e.service.layers.push(d)}}applyLayer(e,i,t=!1){let n=i[e.id];if(!n||(e.name=n.name,e.description=n.description||"",t))return;let s=l.typeLookup[n.type.toLowerCase()]||n.type;s.toLowerCase()==="table"?e.type=s:e.geometryType=s,e.editFieldsInfo=this.editFieldsInfo(),e.globalIdField="globalid",e.objectIdField="objectid",e.uniqueIdField={name:"objectid",isSystemMaintained:!0},e.hasAttachments=!0,this.updateRelationships(e,i),this.updateFields(e,n),this.updateTemplates(e),this.updateDrawingInfo(e)}updateRelationships(e,i){let t=e.relationships||[];for(let n of t){let s=i[n.relatedTableId];s&&(n.name=s.name)}}updateFields(e,i){let t=[],n=[[!1,i.customFields],[!0,i.requiredFields],[!0,i.systemFields]];for(let[s,a]of n)if(Array.isArray(a))for(let o of a){let r={name:o.name,alias:o.alias,type:l.fieldTypeToEsri[o.type]||o.type,description:JSON.stringify({value:o.description,fieldValueType:""},null,0),domain:this.createDomain(o.choiceList,o.name),required:s};o.type?.toLowerCase()==="string"&&(r.length=o.length??256),(o.type==="oid"||o.type==="globalid")&&(r.editable=!1,r.nullable=!1),t.push(r)}e.fields=t}updateTemplates(e){let i=l.drawingToolLookup[e.geometryType||e.type];e.templates??=[{name:e.name,description:"",prototype:{attributes:{}}}];for(let t of e.templates)t.drawingTool=i}updateDrawingInfo(e){if(e.geometryType==="esriGeometryPoint")e.drawingInfo=g(this.nextRendererColorIndex(e.geometryType));else if(e.geometryType==="esriGeometryPolyline")e.drawingInfo=F(this.nextRendererColorIndex(e.geometryType));else if(e.geometryType==="esriGeometryPolygon")e.drawingInfo=L(this.nextRendererColorIndex(e.geometryType));else return}nextRendererColorIndex(e){let i=this.rendererColorCounters[e];return i===void 0?0:(this.rendererColorCounters[e]=i+1,i)}resetRendererColorCounters(){this.rendererColorCounters={esriGeometryPoint:0,esriGeometryPolyline:2,esriGeometryPolygon:4}}createDomain(e,i){return e?{type:"codedValue",name:`${i}_${crypto.randomUUID().replace(/-/gu,"")}`,codedValues:e.map(t=>({name:t,code:t}))}:null}editFieldsInfo(){return{creationDateField:"created_date",creatorField:"created_user",editDateField:"last_edited_date",editorField:"last_edited_user"}}};function I(l){let e=l.service,i={layers:[],tables:[]};for(let t of e.layers||[])i.layers.push({id:t.id,formInfo:h(t),popupInfo:b(t),layerDefinition:t.drawingInfo});for(let t of e.tables||[])i.tables.push({id:t.id,formInfo:h(t),popupInfo:b(t)});return i}function h(l){let e=[];e.push({label:"{{params.buildSolution.solution.strings.attachments.value||Attachments}}",type:"attachment",allowUserRename:!0,attachmentKeyword:"general",displayFilename:!1,editableExpression:"expr/system/true",filenameExpression:'StandardizeFilename(`${$formElement.attachmentKeyword}_${Text(Now(), "YMMDDHHmmss")}`)',inputType:{type:"attachment",attachmentAssociationType:"any",inputTypes:[{type:"audio",inputMethod:"any"},{type:"document"},{type:"image",inputMethod:"any"},{type:"video",inputMethod:"any"}]},useOriginalFilename:!0});for(let t of l.fields)t.required||e.push({label:t.alias,type:"field",editableExpression:"expr/system/true",fieldName:t.name,inputType:S(t.type,t.domain,t.length)});let i=l.relationships||[];for(let t of i)e.push({description:"",label:t.name,type:"relationship",displayCount:3,displayType:"list",editableExpression:"expr/system/true",orderByFields:[{field:"created_date",order:"asc"}],relationshipId:t.id});return{formElements:e,expressionInfos:[{expression:"false",name:"expr/system/false",returnType:"boolean",title:"False"},{expression:"true",name:"expr/system/true",returnType:"boolean",title:"True"}],title:l.name}}function b(l){let e=[],i=[];for(let n of l.fields)n.required||i.push({fieldName:n.name,isEditable:!0,label:n.alias,visible:!0});e.push({type:"fields",description:"",fieldInfos:i});let t=l.relationships||[];if(t.length&&l.type!=="Table")for(let n of t)e.push({type:"relationship",description:"",displayCount:3,displayType:"list",orderByFields:[{field:"created_date",order:"asc"}],relationshipId:n.id});return e.push({type:"attachments",description:"",displayType:"auto",title:""}),{popupElements:e,showLastEditInfo:!1,title:l.name}}function S(l,e,i){return l==="esriFieldTypeString"&&!e&&i&&i>256?{type:"text-area",maxLength:i}:l==="esriFieldTypeString"&&!e?{type:"text-box",maxLength:i||256,minLength:0}:l==="esriFieldTypeString"&&e?{type:"combo-box",showNoValueOption:!1}:["esriFieldTypeInteger","esriFieldTypeDouble"].includes(l)?{type:"text-box",minLength:0}:l==="esriFieldTypeDate"?{type:"datetime-picker",includeTime:!0}:{type:"text-box",maxLength:i||256,minLength:0}}export{f as a};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import e from"./LXGPZJIZ.js";import d from"./VJBL5ZUX.js";import"./HYQVSB6C.js";import c from"./CVHZAZLS.js";import"./2TEBTKD4.js";import"./YUWXPLTE.js";import"./2LCG2XWX.js";import"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import"./2B4SGB3I.js";import"./RLSY4VUQ.js";import"./RDRCAA3H.js";import"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./HIPZRG2Q.js";import"./T3EPRHTT.js";import"./EXBEKVP5.js";export default $arcgis.t(([,,,,a])=>{return a},a,b,c,d,e)
2
+ import e from"./S7HFWITF.js";import d from"./VJBL5ZUX.js";import"./HYQVSB6C.js";import c from"./RLMMQ5UC.js";import"./2TEBTKD4.js";import"./YUWXPLTE.js";import"./ESJJVBZM.js";import"./LVYAW6XF.js";import b from"./JJLYSRRX.js";import a from"./WDASGI72.js";import"./2B4SGB3I.js";import"./RLSY4VUQ.js";import"./RDRCAA3H.js";import"./DIBK4RSG.js";import"./QMAV4UTN.js";import"./Y2AUIXNK.js";import"./TEHBW75B.js";import"./IHG7KTNC.js";import"./ZCU2WWVN.js";import"./WGO4EVOV.js";import"./YKB6256M.js";import"./N22MFQSQ.js";import"./N7BXCDA3.js";import"./ZX3UHK6P.js";import"./Z4F2NZOT.js";import"./KOIDWEP3.js";import"./3KXMYZCU.js";import"./LP2JYX4X.js";import"./GF4QELNV.js";import"./AYSQIO6L.js";import"./YQHYMLC7.js";import"./DKD2EGQP.js";import"./5O53T3SW.js";import"./AJZDBHB6.js";import"./FES7B3SJ.js";import"./HIPZRG2Q.js";import"./T3EPRHTT.js";import"./EXBEKVP5.js";export default $arcgis.t(([,,,,a])=>{return a},a,b,c,d,e)