@arcgis/map-components 6.0.0-next.41 → 6.0.0-next.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{HOMM5T7F.js → 23FQMZEJ.js} +1 -1
- package/dist/cdn/{OT4D3TVG.js → 2KGJ7SZH.js} +1 -1
- package/dist/cdn/{GTQOMGD7.js → 2MIHLZFT.js} +1 -1
- package/dist/cdn/{NF426VVG.js → 3L2QSX64.js} +1 -1
- package/dist/cdn/{IH2T7XRU.js → 3VLSPKTJ.js} +1 -1
- package/dist/cdn/3ZRVPLIZ.js +2 -0
- package/dist/cdn/{TII37L6V.js → 4FBPT5MA.js} +1 -1
- package/dist/cdn/{6WT5CUW4.js → 4IPFHL7W.js} +1 -1
- package/dist/cdn/{5XZKVLHC.js → 5ATTOWK4.js} +1 -1
- package/dist/cdn/{HUZLTULW.js → 5MRT5VRJ.js} +1 -1
- package/dist/cdn/6E4PVTTN.js +2 -0
- package/dist/cdn/{JBD7Q5YD.js → 6NCSWYYX.js} +1 -1
- package/dist/cdn/{5VK56DPB.js → 6NY67VW5.js} +1 -1
- package/dist/cdn/{RX7LVZ5V.js → 6P7V62WJ.js} +1 -1
- package/dist/cdn/{2BKWAHTD.js → 6TLX4R5A.js} +1 -1
- package/dist/cdn/6YPY3QWH.js +2 -0
- package/dist/cdn/72KS3TKM.js +2 -0
- package/dist/cdn/{5IWCWL2Q.js → 7FB4DOVH.js} +1 -1
- package/dist/cdn/{DYKRS7YX.js → 7GXJ6HJZ.js} +1 -1
- package/dist/cdn/7WUY57GO.js +2 -0
- package/dist/cdn/{DVLTVCIH.js → 7YSYI32G.js} +1 -1
- package/dist/cdn/{AMRGLUBB.js → AKSCONMP.js} +1 -1
- package/dist/cdn/{FTRRLFYT.js → B6VGTQ4L.js} +1 -1
- package/dist/cdn/BQCOYIEH.js +2 -0
- package/dist/cdn/{Y6MM3GUE.js → BVWTI63V.js} +1 -1
- package/dist/cdn/{4DRKK3S6.js → CBCAUSDJ.js} +1 -1
- package/dist/cdn/{CX23L4OX.js → CPK3PMBE.js} +1 -1
- package/dist/cdn/CSVVXWVY.js +2 -0
- package/dist/cdn/{Y4GL4RZF.js → CX5AZKYT.js} +1 -1
- package/dist/cdn/{2J6WEB6T.js → DEICCDP4.js} +1 -1
- package/dist/cdn/DJAFLMKA.js +2 -0
- package/dist/cdn/DSINA62N.js +4 -0
- package/dist/cdn/{NYIKMTKG.js → E4ZUESKS.js} +1 -1
- package/dist/cdn/{UJBFSJDF.js → E5BLQ5FK.js} +1 -1
- package/dist/cdn/{KKSTZRNG.js → EDGXY4OL.js} +1 -1
- package/dist/cdn/{YEPFWDQQ.js → EL5AFBNE.js} +1 -1
- package/dist/cdn/{GEZIZQV6.js → EN5NCDOJ.js} +1 -1
- package/dist/cdn/{QNQOBXLM.js → EQA4WO3H.js} +1 -1
- package/dist/cdn/{JILA7S66.js → FLSEDKWU.js} +1 -1
- package/dist/cdn/{625O4F4L.js → GQVCBPZS.js} +1 -1
- package/dist/cdn/{I7XTEFQP.js → GSGFAJCR.js} +1 -1
- package/dist/cdn/{BXBPEOE3.js → GSU7GNNP.js} +1 -1
- package/dist/cdn/{IZFEOYED.js → H2PXK4AT.js} +1 -1
- package/dist/cdn/{RCJ3GROZ.js → HBQAYD5H.js} +1 -1
- package/dist/cdn/{D7RGMUI2.js → IAJNBAC5.js} +1 -1
- package/dist/cdn/{JPQ5ELDQ.js → INMMQJOE.js} +1 -1
- package/dist/cdn/{OMDFAKMT.js → IQYLP2H7.js} +1 -1
- package/dist/cdn/{DVH35LZL.js → J2K2LRII.js} +1 -1
- package/dist/cdn/JUTSSJJF.js +2 -0
- package/dist/cdn/JZYDXRQ6.js +4 -0
- package/dist/cdn/{Y6ZJNJZ7.js → KSOO3XZ2.js} +1 -1
- package/dist/cdn/{KLSIUZNN.js → MKL4YXDU.js} +1 -1
- package/dist/cdn/{EMOYKTQL.js → O2BFE6NY.js} +1 -1
- package/dist/cdn/OUFB4LJK.js +2 -0
- package/dist/cdn/{GFC6LS4L.js → OYG42YJL.js} +1 -1
- package/dist/cdn/{O2RCWKKW.js → PD2BELF2.js} +1 -1
- package/dist/cdn/{T2JBUILX.js → PFYEJDRJ.js} +1 -1
- package/dist/cdn/{JWCEHGEZ.js → PNMBUGPD.js} +1 -1
- package/dist/cdn/QEAEEU72.js +2 -0
- package/dist/cdn/{U53HTVZS.js → RUJLTSDR.js} +1 -1
- package/dist/cdn/{IH7XQCY4.js → SA7B3XQG.js} +1 -1
- package/dist/cdn/{CNUAMIZQ.js → T5RX6NXT.js} +2 -2
- package/dist/cdn/T7PDMEAD.js +2 -0
- package/dist/cdn/{7PMJ7HCH.js → U5BYZI4G.js} +1 -1
- package/dist/cdn/UPXNXNTT.js +2 -0
- package/dist/cdn/{MG2HQ3FT.js → UW3FYQWG.js} +1 -1
- package/dist/cdn/V34ZYXUI.js +2 -0
- package/dist/cdn/{WRB2DEQ6.js → W6ILOTBW.js} +1 -1
- package/dist/cdn/{EZFBYRI4.js → WYX6WXW4.js} +1 -1
- package/dist/cdn/{JFE63ANJ.js → X27EW2YC.js} +1 -1
- package/dist/cdn/{6GFNMSM4.js → XHHVIWXO.js} +1 -1
- package/dist/cdn/{7P24CQF4.js → XOWOMVSW.js} +1 -1
- package/dist/cdn/{CRJB272X.js → XURPEC42.js} +1 -1
- package/dist/cdn/{WVRIR3PK.js → YB6AHPU5.js} +1 -1
- package/dist/cdn/{LQYTLVCL.js → YRQXG7GX.js} +1 -1
- package/dist/cdn/{LHH3PS5H.js → ZVGWUEUE.js} +1 -1
- package/dist/cdn/assets/time-zone-chip/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/AnalysisViewModel.js +1 -1
- package/dist/chunks/async-utils.js +1 -1
- package/dist/chunks/slots.js +1 -1
- package/dist/components/arcgis-daylight/customElement.d.ts +43 -50
- package/dist/components/arcgis-daylight/customElement.js +231 -225
- package/dist/components/arcgis-editor/customElement.d.ts +0 -1
- package/dist/components/arcgis-elevation-profile/customElement.d.ts +8 -0
- package/dist/components/arcgis-elevation-profile/customElement.js +39 -38
- package/dist/components/arcgis-line-of-sight/customElement.d.ts +4 -1
- package/dist/components/arcgis-link-chart/customElement.d.ts +0 -1
- package/dist/components/arcgis-map/customElement.d.ts +0 -1
- package/dist/components/arcgis-scene/customElement.d.ts +0 -1
- package/dist/components/arcgis-shadow-cast/customElement.d.ts +36 -24
- package/dist/components/arcgis-shadow-cast/customElement.js +105 -128
- package/dist/components/arcgis-sketch/customElement.d.ts +0 -1
- package/dist/components/arcgis-time-zone-chip/customElement.d.ts +8 -0
- package/dist/components/arcgis-time-zone-chip/customElement.js +27 -18
- package/dist/components/arcgis-utility-network-trace-locations/customElement.js +34 -34
- package/dist/components/types.d.ts +7 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +0 -10
- package/dist/loader.js +3 -4
- package/dist/types/lumina.d.ts +6 -11
- package/dist/types/preact.d.ts +6 -12
- package/dist/types/react.d.ts +6 -13
- package/dist/types/stencil.d.ts +6 -11
- package/package.json +7 -7
- package/dist/cdn/27TSPXYV.js +0 -2
- package/dist/cdn/2JSC2QUL.js +0 -2
- package/dist/cdn/43IGD6V3.js +0 -2
- package/dist/cdn/4JR57ZIQ.js +0 -2
- package/dist/cdn/6BT6RP22.js +0 -2
- package/dist/cdn/6KYZMT4A.js +0 -2
- package/dist/cdn/BJUFDQGX.js +0 -2
- package/dist/cdn/DFNH6YRR.js +0 -2
- package/dist/cdn/GOMR7D5M.js +0 -2
- package/dist/cdn/HKKNU4CX.js +0 -2
- package/dist/cdn/LZUAJU6O.js +0 -2
- package/dist/cdn/PYBUTNHM.js +0 -2
- package/dist/cdn/SKV3CQSZ.js +0 -2
- package/dist/cdn/TXVB6WRV.js +0 -2
- package/dist/cdn/UYDXI4AK.js +0 -4
- package/dist/cdn/YAWLVMV6.js +0 -2
- package/dist/cdn/YGBYB3BZ.js +0 -2
- package/dist/components/arcgis-utility-network-validate-topology/customElement.d.ts +0 -100
- package/dist/components/arcgis-utility-network-validate-topology/customElement.js +0 -44
- package/dist/components/arcgis-utility-network-validate-topology/index.d.ts +0 -1
- package/dist/components/arcgis-utility-network-validate-topology/index.js +0 -1
- /package/dist/cdn/{SLQPDAGN.js → 237ZYFAI.js} +0 -0
- /package/dist/cdn/{AYQJ2LTV.js → 4LNUUNTS.js} +0 -0
- /package/dist/cdn/{OLSESBZ7.js → 4RG2L4NX.js} +0 -0
- /package/dist/cdn/{N2YWWQOS.js → 6F6UDFL6.js} +0 -0
- /package/dist/cdn/{62HMPABL.js → 6FZQAFDW.js} +0 -0
- /package/dist/cdn/{RTDY3HLR.js → 6RNYBJQG.js} +0 -0
- /package/dist/cdn/{ZCL4XHIZ.js → 6YT2MRU6.js} +0 -0
- /package/dist/cdn/{XQ2WXTW7.js → AAF7U7C7.js} +0 -0
- /package/dist/cdn/{IRFIHD5X.js → AZFQTGM4.js} +0 -0
- /package/dist/cdn/{XCSF7KJK.js → BVR6RYPL.js} +0 -0
- /package/dist/cdn/{DPEWQQEB.js → C3VCBV5R.js} +0 -0
- /package/dist/cdn/{ZSKO7HLH.js → COJJ4ST7.js} +0 -0
- /package/dist/cdn/{NVN2CATF.js → CSLBASOL.js} +0 -0
- /package/dist/cdn/{2P5AJORF.js → DDUJHOQ5.js} +0 -0
- /package/dist/cdn/{DLUFAV4S.js → F25B6VFT.js} +0 -0
- /package/dist/cdn/{PWZHB6VD.js → FC4U5FYO.js} +0 -0
- /package/dist/cdn/{SLNXNVPI.js → H3SNBMDP.js} +0 -0
- /package/dist/cdn/{QWMDZDQA.js → HDNFEQXP.js} +0 -0
- /package/dist/cdn/{FJMXBIN5.js → HMAEKQ63.js} +0 -0
- /package/dist/cdn/{T34W3GKP.js → HRKFC3ZC.js} +0 -0
- /package/dist/cdn/{5GTPIPN7.js → ID3JLPN6.js} +0 -0
- /package/dist/cdn/{KOMTNQPT.js → IKNNVF57.js} +0 -0
- /package/dist/cdn/{OFBWNR54.js → J3U6IFQO.js} +0 -0
- /package/dist/cdn/{CHMBPPHS.js → JUG5VVPL.js} +0 -0
- /package/dist/cdn/{MEISDI2H.js → KYUDUFNZ.js} +0 -0
- /package/dist/cdn/{4LWSF6AI.js → L63YJ5AF.js} +0 -0
- /package/dist/cdn/{LVIYMA67.js → LGPNCTTW.js} +0 -0
- /package/dist/cdn/{LS4U4GD5.js → LH4SQVC2.js} +0 -0
- /package/dist/cdn/{XGWYQ7FU.js → LNUFIKD5.js} +0 -0
- /package/dist/cdn/{7YT5W57B.js → NIASADUV.js} +0 -0
- /package/dist/cdn/{UDXDE3LW.js → NJ3CJS46.js} +0 -0
- /package/dist/cdn/{6SL7YNKF.js → NXC47WWQ.js} +0 -0
- /package/dist/cdn/{ZNIMZP5R.js → O527UXXI.js} +0 -0
- /package/dist/cdn/{G4IKO2R6.js → OXZOWO5A.js} +0 -0
- /package/dist/cdn/{SFDCS6A2.js → PHFJU5KL.js} +0 -0
- /package/dist/cdn/{TP2KQRW6.js → QHK5I5OO.js} +0 -0
- /package/dist/cdn/{IAYL44LK.js → RB3QNSQJ.js} +0 -0
- /package/dist/cdn/{ECA47Z37.js → T4CJDMMZ.js} +0 -0
- /package/dist/cdn/{AKTIOEYM.js → TAU22PX7.js} +0 -0
- /package/dist/cdn/{ZHYXFOYU.js → VP47DYTR.js} +0 -0
- /package/dist/cdn/{NVKOZL7X.js → WMP77MLQ.js} +0 -0
- /package/dist/cdn/{5GGAWGSN.js → WMRMVZHH.js} +0 -0
- /package/dist/cdn/{GCPR7XFU.js → YEEPGAEP.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import c from"./F5JYYT42.js";import b from"./D73SZKP6.js";import{a as he,b as ce,c as me}from"./DFUR3C3D.js";import a from"./SKV3CQSZ.js";import"./WJQUE4DR.js";import{a as se}from"./SAI7K4OO.js";import"./FY7P5YLX.js";import"./IRDDLVT2.js";import"./LXME6MU5.js";import{P as H,Q as U,R as ie,_ as oe,a as ee,b as O,p as te}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([K,ue,ye,{on:be,when:Me,watch:G},{once:Y,on:de},_e,xe,ze,Se,Te,{property:S,subclass:Ce},Ie,Pe,Ae,pe,Z,W,Le,X,{createSphere:Re},Fe,Ne,$e,{b:I,c:ae,d:re},ne,{a:le}])=>{var ke=ee`:host{height:100%;--arcgis-view-color-focus: none}`;function Be(a,e=!0){let t=((e?a:a*180/Math.PI)%360+360)%360;return e?t:t*Math.PI/180}function Ee(a,e=!0){let t=e?a:a*180/Math.PI,o=Math.max(.5,Math.min(179.5,t));return e?o:o*Math.PI/180}function Ge(a,e){return new Promise((t,o)=>{if(a.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){t();return}e(Y(a,"canplay",t)),e(Y(a,"error",o))})}function De(a){return new ue({geometry:a,symbol:new ze({symbolLayers:new _e([new xe])})})}function V({data:a,center:e=Ve(),size:t=Ke,horizonPitch:o=0,horizonYaw:i=0,horizonRoll:s=0}){let r=e.clone();r.z=-t/2;let n=Re(r,{size:t,densificationFactor:2,vertexSpace:"georeferenced",material:new Z({colorTexture:new W({data:a}),unlit:!0})});if(n.components?.at(0)?.set({trustSourceNormals:!0}),n.vertexAttributes.uv){let l=n.vertexAttributes.uv.length??0;for(let d=0;d<l;d++)n.vertexAttributes.uv[d*2+0]=1-n.vertexAttributes.uv[d*2+0]}return n.rotate(o,s,i,{origin:n.extent.center}),n.centerAt(r),n}var Ve=()=>new X({x:0,y:0,z:0,spatialReference:K.WebMercator}),Ke=1e3,Oe=114;function He(a,e,t){let o=new Map,i=Array.from(a.keys()).sort((h,u)=>h-u)[0],{maxCol:s,minCol:r,maxRow:n,minRow:l}=a.get(i),d=s-r+1,m=n-l+1,c=d*(t-1)+1;return Ue({maximumPyramidLevel:e,blockBoundary:a,baseCols:d,baseRows:m,vertexPerEdge:t,baseVertexPerRow:c},o),o}function Ue(a,e){let{maximumPyramidLevel:t,blockBoundary:o,baseCols:i,baseRows:s,vertexPerEdge:r,baseVertexPerRow:n}=a;for(let l=0;l<=t;l+=1){let{maxCol:d,minCol:m,maxRow:c,minRow:h}=o.get(l),u=d-m+1,p=c-h+1,f=i/u,v=s/p,g=r-1;Ye({minRow:h,minCol:m,numberOfRows:p,numberOfColumns:u,vertexLimit:g,rowStep:v,colStep:f,baseVertexPerRow:n,level:l},e)}}function Ye(a,e){let{minRow:t,minCol:o,numberOfRows:i,numberOfColumns:s,vertexLimit:r,rowStep:n,colStep:l,baseVertexPerRow:d,level:m}=a;for(let c=0;c<i;c+=1)for(let h=0;h<s;h+=1){let u=2*r*r,p=new Uint32Array(u*3),f=0,v=o+(s-1-h),g=t+c;for(let w=0;w<r;w+=1)for(let y=0;y<r;y+=1){let _=c*n*r+w*n,C=h*l*r+y*l,N=Math.round(_*d+C),P=Math.round(N+l),T=Math.round(N+n*d),$=Math.round(T+l);p[f++]=N,p[f++]=T,p[f++]=P,p[f++]=P,p[f++]=T,p[f++]=$}e.set(`${m}/${g}/${v}`,p)}}function Ze(a,e){let t=new Map,{lods:o,origin:i,size:[s,r]}=a,{xmin:n,ymin:l,xmax:d,ymax:m}=e;for(let{resolution:c,level:h}of o){let u=Math.floor((i.y-m)/(r*c)),p=Math.floor((i.y-l)/(r*c))-1,f=Math.floor((n-i.x)/(s*c)),v=Math.ceil((d-i.x)/(s*c))-1,g=p-u+1,w=v-f+1;if(g<=0||w<=0)continue;let y=360/w,_=180/g,C=Math.max(y/s,_/r);Number.isFinite(C)&&t.set(o.length-1-h,{minRow:u,maxRow:p,minCol:f,maxCol:v,resolution:c,pixelAngle:C})}return t}function We(a){return typeof a=="string"?Number.parseInt(a,10):a}function je(a){a.set("premultiplyAlpha",!0);let e=a.getAsRGBA();return new ImageData(e,a.width,a.height)}function Je(a,e,t){return(a*(t-1)+1)*(e*(t-1)+1)}var j=class{constructor(e){this._componentCache=new Map,this._tileAnchorMap=new Map,this._attachedComponentKeys=new Set,this._remappedFaceMap=new Map,this._levels=[],this._blockBoundaryMap=new Map,this.radius=500,this.vertexPerEdge=25,this.imageSize=[0,0],this.layer=e.layer}get _meshResolutionLevel(){let e=this._levels[0],t=Number.POSITIVE_INFINITY;for(let o of this._levels){let i=this._blockBoundaryMap.get(o);i&&i.pixelAngle<t&&(t=i.pixelAngle,e=o)}return e}get blockBoundaryMap(){return this._blockBoundaryMap}get levels(){return this._levels}get baseLevel(){let e=this._levels[0],t=Number.NEGATIVE_INFINITY;for(let o of this._levels){let i=this._blockBoundaryMap.get(o);i&&i.pixelAngle>t&&(t=i.pixelAngle,e=o)}return e}get maxLevel(){return Math.max(...this._levels)}async load(e){if(await this.layer.load(e),this._blockBoundaryMap=Ze(this.layer.tileInfo,this.layer.fullExtent),this._levels=[...this._blockBoundaryMap.keys()].sort((t,o)=>t-o),this._levels.length===0)throw new Error("No valid tile levels found for panoramic mesh generation.");return this.imageSize=[this.layer.fullExtent.width,this.layer.fullExtent.height],this._baseMesh=this._createBaseMesh(this.radius,this.vertexPerEdge),this}get baseMesh(){if(!this._baseMesh)throw new Error("Base mesh is not created yet.");return this._baseMesh}destroy(){this._faceMap?.clear(),this._remappedFaceMap.clear(),this._componentCache.clear(),this._attachedComponentKeys.clear(),this._tileAnchorMap.clear(),this._baseMesh?.destroy()}_createBaseMesh(e,t){if(!this._blockBoundaryMap.has(this._meshResolutionLevel))throw new Error(`No block boundaries found for mesh resolution level ${this._meshResolutionLevel}`);let{maxCol:o,minCol:i,maxRow:s,minRow:r}=this._blockBoundaryMap.get(this._meshResolutionLevel),n=s-r+1,l=o-i+1,d=Je(n,l,t),m=new Float64Array(d*3),c=new Float32Array(d*3),h=new Float32Array(d*2),u=l*(t-1)+1,p=l*(t-1);for(let _=0;_<d;_+=1){let C=Math.floor(_/u),N=_%u,P=1-N/(l*(t-1)),T=C/(n*(t-1)),$=180*(1-T),E=360*(P-.5),A=[Math.sin($*Math.PI/180)*Math.sin(E*Math.PI/180),Math.cos(E*Math.PI/180)*Math.sin($*Math.PI/180),-Math.cos($*Math.PI/180)];m[_*3]=e*A[0],m[_*3+1]=e*A[1],m[_*3+2]=e*A[2],c[_*3]=-A[0],c[_*3+1]=-A[1],c[_*3+2]=-A[2];let k=C*u;N===p&&(m[_*3]=m[k*3],m[_*3+1]=m[k*3+1],m[_*3+2]=m[k*3+2],c[_*3]=c[k*3],c[_*3+1]=c[k*3+1],c[_*3+2]=c[k*3+2]),h[_*2]=P,h[_*2+1]=T}this._faceMap=He(this._blockBoundaryMap,Math.max(...this._levels),t);let{remappedFaceMap:f,splitPosition:v,splitNormals:g,splitUv:w}=this._preSplitTileGeometry(m,c,h);this._remappedFaceMap=f;let y=new pe({faces:new Uint32Array([0,1,2]),name:"__placeholder__"});return y.set({trustSourceNormals:!0}),this._baseMesh=new Ae({components:[y],vertexAttributes:new Le({position:v,normal:g,uv:w}),spatialReference:{wkid:3857}}),this._baseMesh}_preSplitTileGeometry(e,t,o){let i=0;for(let c of this._faceMap.values()){let h=new Set;for(let u=0;u<c.length;u+=1)h.add(c[u]);i+=h.size}let s=new Float64Array(i*3),r=new Float32Array(i*3),n=new Float32Array(i*2),l=new Map,d=1e-8,m=0;for(let[c,h]of this._faceMap){let u=new Map,p=0,f=0,v=0,g=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY;for(let L=0;L<h.length;L+=1){let R=h[L];if(u.has(R))continue;let x=R*2,z=o[x],F=o[x+1];z<g&&(g=z),z>w&&(w=z),F<y&&(y=F),F>_&&(_=F);let B=R*3;p+=e[B],f+=e[B+1],v+=e[B+2],u.set(R,m),m+=1}let C=w-g,N=_-y,P=Math.hypot(p,f,v),T=this.radius*1.01,[$,E]=this.layer.tileInfo?.size??[256,256],A=.5/$,k=.5/E;this._tileAnchorMap.set(c,P>0?[p/P*T,f/P*T,v/P*T]:[0,0,T]);for(let[L,R]of u){let x=L*3,z=R*3;s[z]=e[x],s[z+1]=e[x+1],s[z+2]=e[x+2],r[z]=t[x],r[z+1]=t[x+1],r[z+2]=t[x+2];let F=L*2,B=R*2,fe=o[F],ge=o[F+1],ve=C<d?.5:(fe-g)/C,we=N<d?.5:(ge-y)/N;n[B]=A+ve*(1-2*A),n[B+1]=k+we*(1-2*k)}let D=new Uint32Array(h.length);for(let L=0;L<h.length;L+=1){let R=u.get(h[L]);if(R==null)throw new Error(`Failed to remap face index for tile ${c}`);D[L]=R}l.set(c,D)}return{remappedFaceMap:l,splitPosition:s,splitNormals:r,splitUv:n}}getTileAnchor(e,t,o){let i=this._tileAnchorMap.get(`${e}/${t}/${o}`);if(!i)throw new Error(`No tile anchor found for level ${e}, row ${t}, column ${o}`);return i}loadComponent(e,t,o,i){let s=`${e}/${t}/${o}`;if(this._attachedComponentKeys.has(s))return;let r=this._componentCache.get(s);if(r)r.material=new Z({unlit:!0,colorTexture:new W({data:i})});else{let l=this._remappedFaceMap.get(s);if(!l)throw new Error(`No faces found for level ${e}, row ${t}, column ${o}`);r=new pe({faces:l,name:s,material:new Z({unlit:!0,colorTexture:new W({data:i})})}),r.set({trustSourceNormals:!0}),this._componentCache.set(`${e}/${t}/${o}`,r)}r.name=s,this.baseMesh.addComponent(r);let n=this.baseMesh.components?.find(l=>l.name==="__placeholder__");n&&this.baseMesh.removeComponent(n),this._attachedComponentKeys.add(s),this.baseMesh.vertexAttributesChanged()}getFacesForTile(e,t,o){let i=this._remappedFaceMap.get(`${e}/${t}/${o}`);if(!i)throw new Error(`No faces found for level ${e}, row ${t}, column ${o}`);return i}unloadComponent(e,t,o){let i=`${e}/${t}/${o}`,s=this._componentCache.get(i);s&&this._attachedComponentKeys.has(i)&&(this.baseMesh.removeComponent(s),this._attachedComponentKeys.delete(i),this.baseMesh.vertexAttributesChanged())}},J=class{constructor(e){this._baseLevel=e.baseLevel,this._levels=[...e.levels],this._blockBoundaryMap=e.blockBoundaryMap}plan(e,t,o){let i=this._selectLevel(e);this._lastStableLevel=i;let s=this._createHybridDesiredSet(i,e);this._retainActiveLevelDetails(s,t,i);let r=this._prioritizeDesiredKeys(s,i),n=new Set([...t,...o]),l=r.filter(c=>!n.has(c)),d=r.filter(c=>t.has(c)),m=[...t].filter(c=>!s.has(c));return{stableLevel:i,desiredKeySet:s,toFetch:l,toKeep:d,toDrop:m}}_retainActiveLevelDetails(e,t,o){if(o!==this._baseLevel)for(let i of t){let s=this._parseTileKey(i);s&&s.level===o&&e.add(i)}}_createHybridDesiredSet(e,t){let o=new Set,i=this._blockBoundaryMap.get(this._baseLevel);if(!i)return o;for(let r=i.minRow;r<=i.maxRow;r+=1)for(let n=i.minCol;n<=i.maxCol;n+=1)o.add(`${this._baseLevel}/${r}/${n}`);if(e===this._baseLevel)return o;let s=this._getViewTileKeys(e,t.heading,t.pitch,t.hfov,t.vfov);for(let r of s)o.add(r);return o}_getViewTileKeys(e,t,o,i,s){let r=this._blockBoundaryMap.get(e);if(!r)return[];let{minRow:n,maxRow:l,minCol:d,maxCol:m}=r,c=l-n+1,h=m-d+1,u=Math.max(.1,Math.min(179.9,o))-90,p=Math.max(.01,Math.min(360,i)),f=Math.max(.01,Math.min(180,s)),v=360/h,g=180/c,w=Math.min(12,v*.35),y=Math.min(8,g*.35),_=Math.min(360,p+w*2),C=Math.min(180,f+y*2),N=Math.max(-89.9,Math.min(89.9,u-C/2)),P=Math.max(-89.9,Math.min(89.9,u+C/2)),T=x=>{let z=(90-x)/180,F=Math.floor(z*c);return n+Math.max(0,Math.min(c-1,F))},$=x=>{let z=this._normalizeHeading(x)/360,F=(Math.floor(z*h)%h+h)%h;return d+F},E=this._normalizeHeading(t-_/2),A=this._normalizeHeading(t+_/2),k=Math.min(T(P),T(N)),D=Math.max(T(P),T(N)),L=_>=360?[[d,m]]:E<=A?[[$(E),$(A)]]:[[d,$(A)],[$(E),m]],R=new Set;for(let x=k;x<=D;x+=1)for(let[z,F]of L)for(let B=z;B<=F;B+=1)R.add(`${e}/${x}/${B}`);return[...R]}_normalizeHeading(e){let t=e%360;return t<0?t+360:t}_prioritizeDesiredKeys(e,t){let o=[...e],i=s=>{let r=this._parseTileKey(s);return r?r.level===t?0:r.level===this._baseLevel?2:1:Number.POSITIVE_INFINITY};return o.sort((s,r)=>{let n=i(s)-i(r);if(n!==0)return n;let l=this._parseTileKey(s),d=this._parseTileKey(r);return!l||!d?s.localeCompare(r):l.level!==d.level?l.level-d.level:l.row!==d.row?l.row-d.row:l.col-d.col}),o}_parseTileKey(e){let[t,o,i]=e.split("/"),s=Number(t),r=Number(o),n=Number(i);if(!(!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(n)))return{level:s,row:r,col:n}}_selectLevel(e){let[t,o]=e.viewportSize,i=Math.max(1,t),s=Math.max(1,o),r=Math.max(e.hfov/i,e.vfov/s),n=.25,l=this._levels.map(h=>({level:h,boundary:this._blockBoundaryMap.get(h)})).filter(h=>h.boundary!=null).sort((h,u)=>u.boundary.pixelAngle-h.boundary.pixelAngle);if(l.length===0)return this._baseLevel;let d=new Map;for(let h of l)d.set(h.level,r/h.boundary.pixelAngle);let m=new Map;l.forEach((h,u)=>{m.set(h.level,u)});let c=l[l.length-1].level;for(let h of l)if((d.get(h.level)??0)>=n){c=h.level;break}if(this._lastStableLevel!=null&&m.has(this._lastStableLevel)){let h=m.get(this._lastStableLevel),u=m.get(c);if(u>h&&(d.get(this._lastStableLevel)??0)>=.2)return this._lastStableLevel;if(u<h)return this._lastStableLevel}return c}},q=class{constructor(e){this._layer=e,this._inflightControllers=new Map,this._inflightSet=new Set,this._loadedSet=new Set,this.fetchTileImageData=async(t,o,i,s)=>{let r=We(t),n=s?{signal:s}:void 0,l=this._meshBuilder.blockBoundaryMap.get(r);if(!l)throw new Error(`No tile boundary found for level ${t}`);let{maxCol:d,maxRow:m,minCol:c,minRow:h}=l,u=d-c+1,p=m-h+1,f=i-c,v=o-h,g=f*this._meshBuilder.imageSize[0]/u,w=v*this._meshBuilder.imageSize[1]/p,y=Math.min((f+1)*this._meshBuilder.imageSize[0]/u,this._meshBuilder.imageSize[0]),_=Math.min((v+1)*this._meshBuilder.imageSize[1]/p,this._meshBuilder.imageSize[1]),C=await this._layer.fetchPixels(new Pe({xmin:g-.5,ymin:.5-_,xmax:y-.5,ymax:.5-w,spatialReference:this._layer.fullExtent.spatialReference}),y-g,_-w,n);return je(C.pixelBlock)},this.loadComponent=(t,o,i,s)=>this._meshBuilder.loadComponent(t,o,i,s),this.unloadComponent=(t,o,i)=>this._meshBuilder.unloadComponent(t,o,i),this._meshBuilder=new j({layer:e})}get imageSize(){return this._meshBuilder.imageSize}get baseMesh(){return this._meshBuilder.baseMesh}get currentLevel(){return this._currentLevel}getTileAnchor(e,t,o){return this._meshBuilder.getTileAnchor(e,t,o)}async load(){return await this._meshBuilder.load(),this._tilePlanner=new J({blockBoundaryMap:this._meshBuilder.blockBoundaryMap,baseLevel:this._meshBuilder.baseLevel,levels:[...this._meshBuilder.levels]}),this}destroy(){for(let e of this._inflightControllers.values())e.abort();this._inflightControllers.clear(),this._inflightSet.clear(),this._loadedSet.clear(),this._tilePlanner=void 0,this._meshBuilder.destroy()}planTiles(e){if(!this._tilePlanner)throw new Error("PanoramicTileSource is not loaded yet.");let t=this._tilePlanner.plan(e,this._loadedSet,this._inflightSet);return this._currentLevel=t.stableLevel,t}markTileInflight(e,t){this._inflightSet.add(e),this._inflightControllers.set(e,t)}markTileLoaded(e){this._inflightSet.delete(e),this._inflightControllers.delete(e),this._loadedSet.add(e)}markTileInflightResolved(e){this._inflightSet.delete(e),this._inflightControllers.delete(e)}markTileDropped(e){this._loadedSet.delete(e)}cancelStaleInflight(e){for(let t of this._inflightSet)e.has(t)||(this._inflightControllers.get(t)?.abort(),this._inflightControllers.delete(t),this._inflightSet.delete(t))}},qe=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,M=(a,e,t,o)=>{for(var i=o>1?void 0:o?Qe(e,t):e,s=a.length-1,r;s>=0;s--)(r=a[s])&&(i=(o?r(e,t,i):r(i))||i);return o&&i&&qe(e,t,i),i},Xe=0,et=0,tt=0,it=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),ot=new Set(["MRF","TIFF","TIF"]),b=class extends Te{constructor(a){super(a),this._size=[0,0],this.autoLoad=!1,this.type="image",this.uiStrings={},this._resolveMedia=async e=>{let t=Promise.withResolvers(),o=e?.signal?Y(e?.signal,"abort",t.resolve):null,i=this.type==="video"?document.createElement("video"):document.createElement("img");this.type==="video"&&(i.setAttribute("playsinline","true"),i.setAttribute("muted","true"),i.setAttribute("autoplay","true")),i.crossOrigin="anonymous",i.src=this.url;let s=null,r=this.type==="video"?Ge(i,m=>this.addHandles(m)):await new Promise((m,c)=>{s=[de(i,"error",h=>{c(h)}),de(i,"load",m)]}).finally(()=>{s?.forEach(m=>m.remove()),s=null}),n=Promise.race([r,t.promise]);try{await n}finally{o?.remove()}I(e);let l=i,d=await V({data:i,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(e);return I(e),{media:l,mesh:d}}}static isPanoramicMedia(a){return!!a&&typeof a=="object"&&"declaredClass"in a&&typeof a.declaredClass=="string"&&a.declaredClass==="components.oriented-imagery-viewer-panoramic-viewer.support.PanoramicMedia"}destroy(){this._cache=void 0}get horizonPitch(){let{matrix:a}=this;return a?180*Math.asin(-a[6])/Math.PI:Xe}get horizonRoll(){let{matrix:a}=this;return a?180*Math.atan(a[7]/a[8])/Math.PI:tt}get horizonYaw(){let{matrix:a,cameraHeading:e}=this;return a?180*Math.atan2(a[3],a[0])/Math.PI:e?-e:et}get panoramicTileSource(){return this._panoramicTileSource}get element(){return this._cache}get size(){return this._size}async load(a){if(this.type==="video")return await this.loadVideoMesh(a);let e=this.extension;if(e||(e=le(this.url)),!e||!it.has(e))throw new Ie("unsupported-format",this.uiStrings["unsupported-format"]??"Unsupported image format: {extension}",{datasetFormat:e??"UNKNOWN FORMAT"});return ot.has(e)?await this.loadOptimizedImageMesh(a):await this.loadImageMesh(a)}async loadOptimizedImageMesh(a){this._panoramicTileSource?.destroy();let e=new Fe({url:this.url,datasetFormat:this.extension,skipMapInfo:!0,skipExtensions:["aux.xml","jgw"],tileGeneration:"immediate"});this._panoramicTileSource=new q(e);let{imageSize:t,baseMesh:o}=await this._panoramicTileSource.load();return I(a),{mesh:o,size:t}}async loadVideoMesh(a){if(I(a),this._cache){let o=await V({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(a);return I(a),{mesh:o,size:this._size}}let e=await this._resolveMedia(a);I(a),this._cache=e.media,this._size=[this._cache.videoWidth,this._cache.videoHeight];let t=await V({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(a);return I(a),{mesh:t,size:this._size}}async loadImageMesh(a){if(this._cache){let o=await V({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(a);return I(a),{mesh:o,size:this._size}}let e=await this._resolveMedia(a);I(a),this._cache=e.media;let t=e.mesh;return this._size=[e.media.width,e.media.height],{mesh:t,size:this._size}}};M([S()],b.prototype,"_size",2);M([S()],b.prototype,"_cache",2);M([S()],b.prototype,"autoLoad",2);M([S()],b.prototype,"cameraHeading",2);M([S()],b.prototype,"extension",2);M([S()],b.prototype,"horizonPitch",1);M([S()],b.prototype,"horizonRoll",1);M([S()],b.prototype,"horizonYaw",1);M([S()],b.prototype,"id",2);M([S()],b.prototype,"_panoramicTileSource",2);M([S()],b.prototype,"panoramicTileSource",1);M([S()],b.prototype,"element",1);M([S()],b.prototype,"matrix",2);M([S()],b.prototype,"size",1);M([S()],b.prototype,"type",2);M([S()],b.prototype,"uiStrings",2);M([S()],b.prototype,"url",2);b=M([Ce("components.oriented-imagery-viewer-panoramic-viewer.support.PanoramicMedia")],b);var at=()=>new ye({atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}}),rt=()=>new Se({opacity:0,navigationConstraint:null}),st=()=>new X({x:0,y:0,z:0,spatialReference:K.WebMercator}),Q=class extends ie{constructor(){super(...arguments),this.#e=at(),this._graphicsController=new ne(this),this._ground=rt(),this._messages=se(),this._startPosition=null,this.tileCache=new Set,this._currentGraphicsStore=new _e,this._tileLabelGraphics=new Map,this._handleMouseWheel=e=>{e.detail.stopPropagation(),e.detail.deltaY<0?this._internalZoom.value?.zoomIn():this._internalZoom.value?.zoomOut()},this._handleDrag=e=>{e.stopPropagation();let{x:t,y:o,action:i}=e,s=null,r=null;switch(i){case"start":this._startPosition={x:t,y:o};break;case"update":if(!this._startPosition)return;let n=l=>{if(!this._startPosition||!this.camera)return;if(r||(r=l),l-r<16){s=requestAnimationFrame(n);return}let d=t-this._startPosition.x,m=o-this._startPosition.y,c=Be(this.camera?.heading-d*.1),h=Ee(this.camera.tilt+m*.1);this.yaw=c,this.pitch=h,this._startPosition={x:t,y:o},r=null};s=requestAnimationFrame(n);break;case"end":s!==null&&cancelAnimationFrame(s),this._startPosition=null;break}},this._internalMap=H(),this._internalZoom=H(),this._loading=!1,this.yaw=0,this.pitch=90,this.hideLoader=!1,this.hideTitle=!1,this.hideZoomControls=!1,this.hideVideoControls=!1,this.messageOverrides=this._messages._overrides}static{this.properties={_media:16,_internalMap:16,_internalZoom:16,_loading:16,_base:16,yaw:9,pitch:9,hideLoader:5,hideTitle:7,hideZoomControls:5,hideVideoControls:5,imageSize:32,media:0,messageOverrides:0,hfov:32,base:32}}static{this.styles=[ke]}#e;get view(){return this._internalMap?.value?.view}get camera(){if(!this.view?.destroyed)return this.view?.camera}set camera(e){!e||!this.view||this.view.destroyed||(e.position=st(),this.view.camera=e.clone())}get map(){return this._internalMap.value?.view?.map}get _fov(){return this.camera?.fov}set _fov(e){typeof e!="number"||!this._internalZoom.value||this._internalZoom.value?.zoomFOV(e)}get imageSize(){return this._media?.size}get media(){return this._media}set media(e){if(!e){this._mediaAbortController?.abort(),this._media=void 0,this._clearImage();return}this._media=b.isPanoramicMedia(e)?e:new b(e)}get hfov(){return this._internalZoom.value?.hfov}get base(){return this._base?.geometry}addGraphic(e){this._graphicsController.addGraphic(e)}addGraphics(e){this._graphicsController.addGraphics(e)}clearGraphics(){this._graphicsController.clearGraphics()}async mediaOnLoad(){return this._mediaPromise&&await this._mediaPromise,this._media}removeGraphic(e){this._graphicsController.removeGraphic(e)}removeGraphics(e){this._graphicsController.removeGraphics(e)}zoomIn(){this._internalZoom.value?.zoomIn()}zoomOut(){this._internalZoom.value?.zoomOut()}loaded(){this.manager.onLifecycle(()=>[be(()=>this.view,"drag",this._handleDrag),Me(()=>this.camera!=null,()=>{this.camera&&(this.camera.heading=this.yaw,this.camera.tilt=this.pitch,this._reloadCamera())}),G(()=>this.yaw,()=>{this.camera&&(this.camera.heading=this.yaw,this._reloadCamera())},{sync:!0,initial:!0}),G(()=>this.pitch,()=>{this.camera&&(this.camera.tilt=this.pitch,this._reloadCamera())},{sync:!0,initial:!0}),G(()=>this._fov,()=>{this._reloadCamera()},{sync:!0,initial:!0}),G(()=>this._media,e=>{this._mediaAbortController?.abort(),e&&(this._mediaAbortController=new AbortController,this._mediaPromise=this._loadMediaInternal(e,this._mediaAbortController))},{initial:!0,sync:!0}),G(()=>{if(!this.view?.ready||!this.base)return;let e=this._media?.panoramicTileSource;if(!e)return;let{camera:{heading:t,tilt:o,fov:i},width:s,height:r}=this.view,n=s/r;return{panoramicTileSource:e,heading:t,pitch:o,hfov:ce(i,n),vfov:me(i,n)}},e=>{e&&(this._tileUpdateDebounceHandle!=null&&clearTimeout(this._tileUpdateDebounceHandle),this._tileUpdateDebounceHandle=window.setTimeout(()=>{this._tileUpdateTask?.abort(),this._tileUpdateTask=re(async t=>{await this._updateTilesForCurrentView(e,t)}),this._tileUpdateDebounceHandle=void 0},150))},{initial:!0,sync:!0})])}_reloadCamera(){this.camera=this.camera?.clone()}_clearImage(){this._tileUpdateDebounceHandle!=null&&(clearTimeout(this._tileUpdateDebounceHandle),this._tileUpdateDebounceHandle=void 0),this._tileUpdateTask?.abort(),this._tileUpdateTask=void 0,this.tileCache.clear();for(let e of this._tileLabelGraphics.values())this.removeGraphic(e);this._tileLabelGraphics.clear(),this.clearGraphics(),this._base=void 0,this._currentGraphicsStore.removeAll()}_parseTileKey(e){let[t,o,i]=e.split("/").map(Number);return{level:t,row:o,col:i}}_createTileLabelGraphic(e,t){let{level:o,row:i,col:s}=this._parseTileKey(t),[r,n,l]=e.getTileAnchor(o,i,s);return new ue({attributes:{tileKey:t},geometry:new X({x:r,y:n,z:l,spatialReference:K.WebMercator}),symbol:new $e({color:[255,255,255,.95],font:new Ne({family:"Avenir Next",size:8,weight:"bold"}),haloColor:[0,0,0,.9],haloSize:1,horizontalAlignment:"center",text:t,verticalAlignment:"middle"})})}_attachTileLabel(e,t){if(this._tileLabelGraphics.has(t))return;let o=this._createTileLabelGraphic(e,t);this._tileLabelGraphics.set(t,o),this._currentGraphicsStore.add(o),this.addGraphic(o)}_detachTileLabel(e){let t=this._tileLabelGraphics.get(e);t&&(this.removeGraphic(t),this._currentGraphicsStore.remove(t),this._tileLabelGraphics.delete(e))}async _updateTilesForCurrentView(e,t){let{base:o}=this;if(!o)return;let{panoramicTileSource:i,heading:s,pitch:r,hfov:n,vfov:l}=e,d=[Math.max(1,this.view?.width??1),Math.max(1,this.view?.height??1)],m=i.planTiles({heading:s,pitch:r,hfov:n,vfov:l,imageSize:i.imageSize,viewportSize:d});if(I(t),i.cancelStaleInflight(m.desiredKeySet),m.toDrop.length>0){let u=new Set(m.toDrop);for(let p of u){let{level:f,row:v,col:g}=this._parseTileKey(p);i.unloadComponent(f,v,g),i.markTileDropped(p),this._detachTileLabel(p),this.tileCache.delete(p)}}let c=async u=>{if(u>=m.toFetch.length)return;let p=m.toFetch[u];if(I(t),!this.tileCache.has(p)){let{level:f,row:v,col:g}=this._parseTileKey(p),w=new AbortController,y=()=>{w.abort()};t.addEventListener("abort",y,{once:!0}),i.markTileInflight(p,w);try{let _=await i.fetchTileImageData(f,v,g,w.signal);I(t),m.desiredKeySet.has(p)&&!this.tileCache.has(p)&&(i.loadComponent(f,v,g,_),i.markTileLoaded(p),this._attachTileLabel(i,p),this.tileCache.add(p))}catch(_){ae(_)||te("error",this,"Failed loading panoramic tile component",{detail:{key:p,error:_}})}finally{t.removeEventListener("abort",y),i.markTileInflightResolved(p)}}await c(u+1)};await c(0);let h=i.planTiles({heading:s,pitch:r,hfov:n,vfov:l,imageSize:i.imageSize,viewportSize:d});if(I(t),h.toDrop.length>0){let u=new Set(h.toDrop);for(let p of u){let{level:f,row:v,col:g}=this._parseTileKey(p);i.unloadComponent(f,v,g),i.markTileDropped(p),this._detachTileLabel(p),this.tileCache.delete(p)}}}async _loadMediaInternal(e,t){if(this._loading=!0,this._clearImage(),!e)throw new Error("No media provided");let{mesh:o}=await e.load(t).finally(()=>{this._loading=!1});I(t),this._fov=he(Oe,this.el.clientWidth/this.el.clientHeight),this._base=De(o),this.addGraphic(this._base)}render(){return O`<calcite-panel .loading=${this.hideLoader?void 0:this._loading} .heading=${this.hideTitle?void 0:this._messages.title}><arcgis-scene .environment=${this.#e} hide-attribution .spatialReference=${K.WebMercator} viewing-mode=local .ground=${this._ground} @arcgisViewMouseWheel=${this._handleMouseWheel} ${U(this._internalMap)}><arcgis-oriented-imagery-viewer-panoramic-viewer-zoom .hidden=${this.hideZoomControls} slot=top-left ${U(this._internalZoom)}></arcgis-oriented-imagery-viewer-panoramic-viewer-zoom></arcgis-scene>${this.hideVideoControls||this.media?.type!=="video"?null:O`<arcgis-oriented-imagery-viewer-video-controls .videoRef=${this._media?.element}></arcgis-oriented-imagery-viewer-video-controls>`}</calcite-panel>`}};oe("arcgis-oriented-imagery-viewer-panoramic-viewer",Q);return Q},"geometry/SpatialReference","Graphic","views/3d/environment/Environment","core/reactiveUtils","applications/Components/baUtils","core/Collection","symbols/FillSymbol3DLayer","symbols/MeshSymbol3D","Ground","core/Accessor","core/accessorSupport/decorators","core/Error","geometry/Extent","geometry/Mesh","geometry/support/MeshComponent","geometry/support/MeshMaterialMetallicRoughness","geometry/support/MeshTexture","geometry/support/MeshVertexAttributes","geometry/Point","geometry/support/meshUtils","layers/ImageryTileLayer","symbols/Font","symbols/TextSymbol",a,b,c)
|
|
2
|
+
import c from"./F5JYYT42.js";import b from"./D73SZKP6.js";import{a as he,b as ce,c as me}from"./DFUR3C3D.js";import a from"./3ZRVPLIZ.js";import"./WJQUE4DR.js";import{a as se}from"./SAI7K4OO.js";import"./FY7P5YLX.js";import"./IRDDLVT2.js";import"./LXME6MU5.js";import{P as H,Q as U,R as ie,_ as oe,a as ee,b as O,p as te}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([K,ue,ye,{on:be,when:Me,watch:G},{once:Y,on:de},_e,xe,ze,Se,Te,{property:S,subclass:Ce},Ie,Pe,Ae,pe,Z,W,Le,X,{createSphere:Re},Fe,Ne,$e,{b:I,c:ae,d:re},ne,{a:le}])=>{var ke=ee`:host{height:100%;--arcgis-view-color-focus: none}`;function Be(a,e=!0){let t=((e?a:a*180/Math.PI)%360+360)%360;return e?t:t*Math.PI/180}function Ee(a,e=!0){let t=e?a:a*180/Math.PI,o=Math.max(.5,Math.min(179.5,t));return e?o:o*Math.PI/180}function Ge(a,e){return new Promise((t,o)=>{if(a.readyState>=HTMLMediaElement.HAVE_CURRENT_DATA){t();return}e(Y(a,"canplay",t)),e(Y(a,"error",o))})}function De(a){return new ue({geometry:a,symbol:new ze({symbolLayers:new _e([new xe])})})}function V({data:a,center:e=Ve(),size:t=Ke,horizonPitch:o=0,horizonYaw:i=0,horizonRoll:s=0}){let r=e.clone();r.z=-t/2;let n=Re(r,{size:t,densificationFactor:2,vertexSpace:"georeferenced",material:new Z({colorTexture:new W({data:a}),unlit:!0})});if(n.components?.at(0)?.set({trustSourceNormals:!0}),n.vertexAttributes.uv){let l=n.vertexAttributes.uv.length??0;for(let d=0;d<l;d++)n.vertexAttributes.uv[d*2+0]=1-n.vertexAttributes.uv[d*2+0]}return n.rotate(o,s,i,{origin:n.extent.center}),n.centerAt(r),n}var Ve=()=>new X({x:0,y:0,z:0,spatialReference:K.WebMercator}),Ke=1e3,Oe=114;function He(a,e,t){let o=new Map,i=Array.from(a.keys()).sort((h,u)=>h-u)[0],{maxCol:s,minCol:r,maxRow:n,minRow:l}=a.get(i),d=s-r+1,m=n-l+1,c=d*(t-1)+1;return Ue({maximumPyramidLevel:e,blockBoundary:a,baseCols:d,baseRows:m,vertexPerEdge:t,baseVertexPerRow:c},o),o}function Ue(a,e){let{maximumPyramidLevel:t,blockBoundary:o,baseCols:i,baseRows:s,vertexPerEdge:r,baseVertexPerRow:n}=a;for(let l=0;l<=t;l+=1){let{maxCol:d,minCol:m,maxRow:c,minRow:h}=o.get(l),u=d-m+1,p=c-h+1,f=i/u,v=s/p,g=r-1;Ye({minRow:h,minCol:m,numberOfRows:p,numberOfColumns:u,vertexLimit:g,rowStep:v,colStep:f,baseVertexPerRow:n,level:l},e)}}function Ye(a,e){let{minRow:t,minCol:o,numberOfRows:i,numberOfColumns:s,vertexLimit:r,rowStep:n,colStep:l,baseVertexPerRow:d,level:m}=a;for(let c=0;c<i;c+=1)for(let h=0;h<s;h+=1){let u=2*r*r,p=new Uint32Array(u*3),f=0,v=o+(s-1-h),g=t+c;for(let w=0;w<r;w+=1)for(let y=0;y<r;y+=1){let _=c*n*r+w*n,C=h*l*r+y*l,N=Math.round(_*d+C),P=Math.round(N+l),T=Math.round(N+n*d),$=Math.round(T+l);p[f++]=N,p[f++]=T,p[f++]=P,p[f++]=P,p[f++]=T,p[f++]=$}e.set(`${m}/${g}/${v}`,p)}}function Ze(a,e){let t=new Map,{lods:o,origin:i,size:[s,r]}=a,{xmin:n,ymin:l,xmax:d,ymax:m}=e;for(let{resolution:c,level:h}of o){let u=Math.floor((i.y-m)/(r*c)),p=Math.floor((i.y-l)/(r*c))-1,f=Math.floor((n-i.x)/(s*c)),v=Math.ceil((d-i.x)/(s*c))-1,g=p-u+1,w=v-f+1;if(g<=0||w<=0)continue;let y=360/w,_=180/g,C=Math.max(y/s,_/r);Number.isFinite(C)&&t.set(o.length-1-h,{minRow:u,maxRow:p,minCol:f,maxCol:v,resolution:c,pixelAngle:C})}return t}function We(a){return typeof a=="string"?Number.parseInt(a,10):a}function je(a){a.set("premultiplyAlpha",!0);let e=a.getAsRGBA();return new ImageData(e,a.width,a.height)}function Je(a,e,t){return(a*(t-1)+1)*(e*(t-1)+1)}var j=class{constructor(e){this._componentCache=new Map,this._tileAnchorMap=new Map,this._attachedComponentKeys=new Set,this._remappedFaceMap=new Map,this._levels=[],this._blockBoundaryMap=new Map,this.radius=500,this.vertexPerEdge=25,this.imageSize=[0,0],this.layer=e.layer}get _meshResolutionLevel(){let e=this._levels[0],t=Number.POSITIVE_INFINITY;for(let o of this._levels){let i=this._blockBoundaryMap.get(o);i&&i.pixelAngle<t&&(t=i.pixelAngle,e=o)}return e}get blockBoundaryMap(){return this._blockBoundaryMap}get levels(){return this._levels}get baseLevel(){let e=this._levels[0],t=Number.NEGATIVE_INFINITY;for(let o of this._levels){let i=this._blockBoundaryMap.get(o);i&&i.pixelAngle>t&&(t=i.pixelAngle,e=o)}return e}get maxLevel(){return Math.max(...this._levels)}async load(e){if(await this.layer.load(e),this._blockBoundaryMap=Ze(this.layer.tileInfo,this.layer.fullExtent),this._levels=[...this._blockBoundaryMap.keys()].sort((t,o)=>t-o),this._levels.length===0)throw new Error("No valid tile levels found for panoramic mesh generation.");return this.imageSize=[this.layer.fullExtent.width,this.layer.fullExtent.height],this._baseMesh=this._createBaseMesh(this.radius,this.vertexPerEdge),this}get baseMesh(){if(!this._baseMesh)throw new Error("Base mesh is not created yet.");return this._baseMesh}destroy(){this._faceMap?.clear(),this._remappedFaceMap.clear(),this._componentCache.clear(),this._attachedComponentKeys.clear(),this._tileAnchorMap.clear(),this._baseMesh?.destroy()}_createBaseMesh(e,t){if(!this._blockBoundaryMap.has(this._meshResolutionLevel))throw new Error(`No block boundaries found for mesh resolution level ${this._meshResolutionLevel}`);let{maxCol:o,minCol:i,maxRow:s,minRow:r}=this._blockBoundaryMap.get(this._meshResolutionLevel),n=s-r+1,l=o-i+1,d=Je(n,l,t),m=new Float64Array(d*3),c=new Float32Array(d*3),h=new Float32Array(d*2),u=l*(t-1)+1,p=l*(t-1);for(let _=0;_<d;_+=1){let C=Math.floor(_/u),N=_%u,P=1-N/(l*(t-1)),T=C/(n*(t-1)),$=180*(1-T),E=360*(P-.5),A=[Math.sin($*Math.PI/180)*Math.sin(E*Math.PI/180),Math.cos(E*Math.PI/180)*Math.sin($*Math.PI/180),-Math.cos($*Math.PI/180)];m[_*3]=e*A[0],m[_*3+1]=e*A[1],m[_*3+2]=e*A[2],c[_*3]=-A[0],c[_*3+1]=-A[1],c[_*3+2]=-A[2];let k=C*u;N===p&&(m[_*3]=m[k*3],m[_*3+1]=m[k*3+1],m[_*3+2]=m[k*3+2],c[_*3]=c[k*3],c[_*3+1]=c[k*3+1],c[_*3+2]=c[k*3+2]),h[_*2]=P,h[_*2+1]=T}this._faceMap=He(this._blockBoundaryMap,Math.max(...this._levels),t);let{remappedFaceMap:f,splitPosition:v,splitNormals:g,splitUv:w}=this._preSplitTileGeometry(m,c,h);this._remappedFaceMap=f;let y=new pe({faces:new Uint32Array([0,1,2]),name:"__placeholder__"});return y.set({trustSourceNormals:!0}),this._baseMesh=new Ae({components:[y],vertexAttributes:new Le({position:v,normal:g,uv:w}),spatialReference:{wkid:3857}}),this._baseMesh}_preSplitTileGeometry(e,t,o){let i=0;for(let c of this._faceMap.values()){let h=new Set;for(let u=0;u<c.length;u+=1)h.add(c[u]);i+=h.size}let s=new Float64Array(i*3),r=new Float32Array(i*3),n=new Float32Array(i*2),l=new Map,d=1e-8,m=0;for(let[c,h]of this._faceMap){let u=new Map,p=0,f=0,v=0,g=Number.POSITIVE_INFINITY,w=Number.NEGATIVE_INFINITY,y=Number.POSITIVE_INFINITY,_=Number.NEGATIVE_INFINITY;for(let L=0;L<h.length;L+=1){let R=h[L];if(u.has(R))continue;let x=R*2,z=o[x],F=o[x+1];z<g&&(g=z),z>w&&(w=z),F<y&&(y=F),F>_&&(_=F);let B=R*3;p+=e[B],f+=e[B+1],v+=e[B+2],u.set(R,m),m+=1}let C=w-g,N=_-y,P=Math.hypot(p,f,v),T=this.radius*1.01,[$,E]=this.layer.tileInfo?.size??[256,256],A=.5/$,k=.5/E;this._tileAnchorMap.set(c,P>0?[p/P*T,f/P*T,v/P*T]:[0,0,T]);for(let[L,R]of u){let x=L*3,z=R*3;s[z]=e[x],s[z+1]=e[x+1],s[z+2]=e[x+2],r[z]=t[x],r[z+1]=t[x+1],r[z+2]=t[x+2];let F=L*2,B=R*2,fe=o[F],ge=o[F+1],ve=C<d?.5:(fe-g)/C,we=N<d?.5:(ge-y)/N;n[B]=A+ve*(1-2*A),n[B+1]=k+we*(1-2*k)}let D=new Uint32Array(h.length);for(let L=0;L<h.length;L+=1){let R=u.get(h[L]);if(R==null)throw new Error(`Failed to remap face index for tile ${c}`);D[L]=R}l.set(c,D)}return{remappedFaceMap:l,splitPosition:s,splitNormals:r,splitUv:n}}getTileAnchor(e,t,o){let i=this._tileAnchorMap.get(`${e}/${t}/${o}`);if(!i)throw new Error(`No tile anchor found for level ${e}, row ${t}, column ${o}`);return i}loadComponent(e,t,o,i){let s=`${e}/${t}/${o}`;if(this._attachedComponentKeys.has(s))return;let r=this._componentCache.get(s);if(r)r.material=new Z({unlit:!0,colorTexture:new W({data:i})});else{let l=this._remappedFaceMap.get(s);if(!l)throw new Error(`No faces found for level ${e}, row ${t}, column ${o}`);r=new pe({faces:l,name:s,material:new Z({unlit:!0,colorTexture:new W({data:i})})}),r.set({trustSourceNormals:!0}),this._componentCache.set(`${e}/${t}/${o}`,r)}r.name=s,this.baseMesh.addComponent(r);let n=this.baseMesh.components?.find(l=>l.name==="__placeholder__");n&&this.baseMesh.removeComponent(n),this._attachedComponentKeys.add(s),this.baseMesh.vertexAttributesChanged()}getFacesForTile(e,t,o){let i=this._remappedFaceMap.get(`${e}/${t}/${o}`);if(!i)throw new Error(`No faces found for level ${e}, row ${t}, column ${o}`);return i}unloadComponent(e,t,o){let i=`${e}/${t}/${o}`,s=this._componentCache.get(i);s&&this._attachedComponentKeys.has(i)&&(this.baseMesh.removeComponent(s),this._attachedComponentKeys.delete(i),this.baseMesh.vertexAttributesChanged())}},J=class{constructor(e){this._baseLevel=e.baseLevel,this._levels=[...e.levels],this._blockBoundaryMap=e.blockBoundaryMap}plan(e,t,o){let i=this._selectLevel(e);this._lastStableLevel=i;let s=this._createHybridDesiredSet(i,e);this._retainActiveLevelDetails(s,t,i);let r=this._prioritizeDesiredKeys(s,i),n=new Set([...t,...o]),l=r.filter(c=>!n.has(c)),d=r.filter(c=>t.has(c)),m=[...t].filter(c=>!s.has(c));return{stableLevel:i,desiredKeySet:s,toFetch:l,toKeep:d,toDrop:m}}_retainActiveLevelDetails(e,t,o){if(o!==this._baseLevel)for(let i of t){let s=this._parseTileKey(i);s&&s.level===o&&e.add(i)}}_createHybridDesiredSet(e,t){let o=new Set,i=this._blockBoundaryMap.get(this._baseLevel);if(!i)return o;for(let r=i.minRow;r<=i.maxRow;r+=1)for(let n=i.minCol;n<=i.maxCol;n+=1)o.add(`${this._baseLevel}/${r}/${n}`);if(e===this._baseLevel)return o;let s=this._getViewTileKeys(e,t.heading,t.pitch,t.hfov,t.vfov);for(let r of s)o.add(r);return o}_getViewTileKeys(e,t,o,i,s){let r=this._blockBoundaryMap.get(e);if(!r)return[];let{minRow:n,maxRow:l,minCol:d,maxCol:m}=r,c=l-n+1,h=m-d+1,u=Math.max(.1,Math.min(179.9,o))-90,p=Math.max(.01,Math.min(360,i)),f=Math.max(.01,Math.min(180,s)),v=360/h,g=180/c,w=Math.min(12,v*.35),y=Math.min(8,g*.35),_=Math.min(360,p+w*2),C=Math.min(180,f+y*2),N=Math.max(-89.9,Math.min(89.9,u-C/2)),P=Math.max(-89.9,Math.min(89.9,u+C/2)),T=x=>{let z=(90-x)/180,F=Math.floor(z*c);return n+Math.max(0,Math.min(c-1,F))},$=x=>{let z=this._normalizeHeading(x)/360,F=(Math.floor(z*h)%h+h)%h;return d+F},E=this._normalizeHeading(t-_/2),A=this._normalizeHeading(t+_/2),k=Math.min(T(P),T(N)),D=Math.max(T(P),T(N)),L=_>=360?[[d,m]]:E<=A?[[$(E),$(A)]]:[[d,$(A)],[$(E),m]],R=new Set;for(let x=k;x<=D;x+=1)for(let[z,F]of L)for(let B=z;B<=F;B+=1)R.add(`${e}/${x}/${B}`);return[...R]}_normalizeHeading(e){let t=e%360;return t<0?t+360:t}_prioritizeDesiredKeys(e,t){let o=[...e],i=s=>{let r=this._parseTileKey(s);return r?r.level===t?0:r.level===this._baseLevel?2:1:Number.POSITIVE_INFINITY};return o.sort((s,r)=>{let n=i(s)-i(r);if(n!==0)return n;let l=this._parseTileKey(s),d=this._parseTileKey(r);return!l||!d?s.localeCompare(r):l.level!==d.level?l.level-d.level:l.row!==d.row?l.row-d.row:l.col-d.col}),o}_parseTileKey(e){let[t,o,i]=e.split("/"),s=Number(t),r=Number(o),n=Number(i);if(!(!Number.isFinite(s)||!Number.isFinite(r)||!Number.isFinite(n)))return{level:s,row:r,col:n}}_selectLevel(e){let[t,o]=e.viewportSize,i=Math.max(1,t),s=Math.max(1,o),r=Math.max(e.hfov/i,e.vfov/s),n=.25,l=this._levels.map(h=>({level:h,boundary:this._blockBoundaryMap.get(h)})).filter(h=>h.boundary!=null).sort((h,u)=>u.boundary.pixelAngle-h.boundary.pixelAngle);if(l.length===0)return this._baseLevel;let d=new Map;for(let h of l)d.set(h.level,r/h.boundary.pixelAngle);let m=new Map;l.forEach((h,u)=>{m.set(h.level,u)});let c=l[l.length-1].level;for(let h of l)if((d.get(h.level)??0)>=n){c=h.level;break}if(this._lastStableLevel!=null&&m.has(this._lastStableLevel)){let h=m.get(this._lastStableLevel),u=m.get(c);if(u>h&&(d.get(this._lastStableLevel)??0)>=.2)return this._lastStableLevel;if(u<h)return this._lastStableLevel}return c}},q=class{constructor(e){this._layer=e,this._inflightControllers=new Map,this._inflightSet=new Set,this._loadedSet=new Set,this.fetchTileImageData=async(t,o,i,s)=>{let r=We(t),n=s?{signal:s}:void 0,l=this._meshBuilder.blockBoundaryMap.get(r);if(!l)throw new Error(`No tile boundary found for level ${t}`);let{maxCol:d,maxRow:m,minCol:c,minRow:h}=l,u=d-c+1,p=m-h+1,f=i-c,v=o-h,g=f*this._meshBuilder.imageSize[0]/u,w=v*this._meshBuilder.imageSize[1]/p,y=Math.min((f+1)*this._meshBuilder.imageSize[0]/u,this._meshBuilder.imageSize[0]),_=Math.min((v+1)*this._meshBuilder.imageSize[1]/p,this._meshBuilder.imageSize[1]),C=await this._layer.fetchPixels(new Pe({xmin:g-.5,ymin:.5-_,xmax:y-.5,ymax:.5-w,spatialReference:this._layer.fullExtent.spatialReference}),y-g,_-w,n);return je(C.pixelBlock)},this.loadComponent=(t,o,i,s)=>this._meshBuilder.loadComponent(t,o,i,s),this.unloadComponent=(t,o,i)=>this._meshBuilder.unloadComponent(t,o,i),this._meshBuilder=new j({layer:e})}get imageSize(){return this._meshBuilder.imageSize}get baseMesh(){return this._meshBuilder.baseMesh}get currentLevel(){return this._currentLevel}getTileAnchor(e,t,o){return this._meshBuilder.getTileAnchor(e,t,o)}async load(){return await this._meshBuilder.load(),this._tilePlanner=new J({blockBoundaryMap:this._meshBuilder.blockBoundaryMap,baseLevel:this._meshBuilder.baseLevel,levels:[...this._meshBuilder.levels]}),this}destroy(){for(let e of this._inflightControllers.values())e.abort();this._inflightControllers.clear(),this._inflightSet.clear(),this._loadedSet.clear(),this._tilePlanner=void 0,this._meshBuilder.destroy()}planTiles(e){if(!this._tilePlanner)throw new Error("PanoramicTileSource is not loaded yet.");let t=this._tilePlanner.plan(e,this._loadedSet,this._inflightSet);return this._currentLevel=t.stableLevel,t}markTileInflight(e,t){this._inflightSet.add(e),this._inflightControllers.set(e,t)}markTileLoaded(e){this._inflightSet.delete(e),this._inflightControllers.delete(e),this._loadedSet.add(e)}markTileInflightResolved(e){this._inflightSet.delete(e),this._inflightControllers.delete(e)}markTileDropped(e){this._loadedSet.delete(e)}cancelStaleInflight(e){for(let t of this._inflightSet)e.has(t)||(this._inflightControllers.get(t)?.abort(),this._inflightControllers.delete(t),this._inflightSet.delete(t))}},qe=Object.defineProperty,Qe=Object.getOwnPropertyDescriptor,M=(a,e,t,o)=>{for(var i=o>1?void 0:o?Qe(e,t):e,s=a.length-1,r;s>=0;s--)(r=a[s])&&(i=(o?r(e,t,i):r(i))||i);return o&&i&&qe(e,t,i),i},Xe=0,et=0,tt=0,it=new Set(["JPG","JPEG","TIFF","TIF","MRF"]),ot=new Set(["MRF","TIFF","TIF"]),b=class extends Te{constructor(a){super(a),this._size=[0,0],this.autoLoad=!1,this.type="image",this.uiStrings={},this._resolveMedia=async e=>{let t=Promise.withResolvers(),o=e?.signal?Y(e?.signal,"abort",t.resolve):null,i=this.type==="video"?document.createElement("video"):document.createElement("img");this.type==="video"&&(i.setAttribute("playsinline","true"),i.setAttribute("muted","true"),i.setAttribute("autoplay","true")),i.crossOrigin="anonymous",i.src=this.url;let s=null,r=this.type==="video"?Ge(i,m=>this.addHandles(m)):await new Promise((m,c)=>{s=[de(i,"error",h=>{c(h)}),de(i,"load",m)]}).finally(()=>{s?.forEach(m=>m.remove()),s=null}),n=Promise.race([r,t.promise]);try{await n}finally{o?.remove()}I(e);let l=i,d=await V({data:i,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(e);return I(e),{media:l,mesh:d}}}static isPanoramicMedia(a){return!!a&&typeof a=="object"&&"declaredClass"in a&&typeof a.declaredClass=="string"&&a.declaredClass==="components.oriented-imagery-viewer-panoramic-viewer.support.PanoramicMedia"}destroy(){this._cache=void 0}get horizonPitch(){let{matrix:a}=this;return a?180*Math.asin(-a[6])/Math.PI:Xe}get horizonRoll(){let{matrix:a}=this;return a?180*Math.atan(a[7]/a[8])/Math.PI:tt}get horizonYaw(){let{matrix:a,cameraHeading:e}=this;return a?180*Math.atan2(a[3],a[0])/Math.PI:e?-e:et}get panoramicTileSource(){return this._panoramicTileSource}get element(){return this._cache}get size(){return this._size}async load(a){if(this.type==="video")return await this.loadVideoMesh(a);let e=this.extension;if(e||(e=le(this.url)),!e||!it.has(e))throw new Ie("unsupported-format",this.uiStrings["unsupported-format"]??"Unsupported image format: {extension}",{datasetFormat:e??"UNKNOWN FORMAT"});return ot.has(e)?await this.loadOptimizedImageMesh(a):await this.loadImageMesh(a)}async loadOptimizedImageMesh(a){this._panoramicTileSource?.destroy();let e=new Fe({url:this.url,datasetFormat:this.extension,skipMapInfo:!0,skipExtensions:["aux.xml","jgw"],tileGeneration:"immediate"});this._panoramicTileSource=new q(e);let{imageSize:t,baseMesh:o}=await this._panoramicTileSource.load();return I(a),{mesh:o,size:t}}async loadVideoMesh(a){if(I(a),this._cache){let o=await V({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(a);return I(a),{mesh:o,size:this._size}}let e=await this._resolveMedia(a);I(a),this._cache=e.media,this._size=[this._cache.videoWidth,this._cache.videoHeight];let t=await V({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(a);return I(a),{mesh:t,size:this._size}}async loadImageMesh(a){if(this._cache){let o=await V({data:this._cache,horizonPitch:this.horizonPitch,horizonRoll:this.horizonRoll,horizonYaw:this.horizonYaw}).load(a);return I(a),{mesh:o,size:this._size}}let e=await this._resolveMedia(a);I(a),this._cache=e.media;let t=e.mesh;return this._size=[e.media.width,e.media.height],{mesh:t,size:this._size}}};M([S()],b.prototype,"_size",2);M([S()],b.prototype,"_cache",2);M([S()],b.prototype,"autoLoad",2);M([S()],b.prototype,"cameraHeading",2);M([S()],b.prototype,"extension",2);M([S()],b.prototype,"horizonPitch",1);M([S()],b.prototype,"horizonRoll",1);M([S()],b.prototype,"horizonYaw",1);M([S()],b.prototype,"id",2);M([S()],b.prototype,"_panoramicTileSource",2);M([S()],b.prototype,"panoramicTileSource",1);M([S()],b.prototype,"element",1);M([S()],b.prototype,"matrix",2);M([S()],b.prototype,"size",1);M([S()],b.prototype,"type",2);M([S()],b.prototype,"uiStrings",2);M([S()],b.prototype,"url",2);b=M([Ce("components.oriented-imagery-viewer-panoramic-viewer.support.PanoramicMedia")],b);var at=()=>new ye({atmosphereEnabled:!1,starsEnabled:!1,lighting:{type:"virtual"}}),rt=()=>new Se({opacity:0,navigationConstraint:null}),st=()=>new X({x:0,y:0,z:0,spatialReference:K.WebMercator}),Q=class extends ie{constructor(){super(...arguments),this.#e=at(),this._graphicsController=new ne(this),this._ground=rt(),this._messages=se(),this._startPosition=null,this.tileCache=new Set,this._currentGraphicsStore=new _e,this._tileLabelGraphics=new Map,this._handleMouseWheel=e=>{e.detail.stopPropagation(),e.detail.deltaY<0?this._internalZoom.value?.zoomIn():this._internalZoom.value?.zoomOut()},this._handleDrag=e=>{e.stopPropagation();let{x:t,y:o,action:i}=e,s=null,r=null;switch(i){case"start":this._startPosition={x:t,y:o};break;case"update":if(!this._startPosition)return;let n=l=>{if(!this._startPosition||!this.camera)return;if(r||(r=l),l-r<16){s=requestAnimationFrame(n);return}let d=t-this._startPosition.x,m=o-this._startPosition.y,c=Be(this.camera?.heading-d*.1),h=Ee(this.camera.tilt+m*.1);this.yaw=c,this.pitch=h,this._startPosition={x:t,y:o},r=null};s=requestAnimationFrame(n);break;case"end":s!==null&&cancelAnimationFrame(s),this._startPosition=null;break}},this._internalMap=H(),this._internalZoom=H(),this._loading=!1,this.yaw=0,this.pitch=90,this.hideLoader=!1,this.hideTitle=!1,this.hideZoomControls=!1,this.hideVideoControls=!1,this.messageOverrides=this._messages._overrides}static{this.properties={_media:16,_internalMap:16,_internalZoom:16,_loading:16,_base:16,yaw:9,pitch:9,hideLoader:5,hideTitle:7,hideZoomControls:5,hideVideoControls:5,imageSize:32,media:0,messageOverrides:0,hfov:32,base:32}}static{this.styles=[ke]}#e;get view(){return this._internalMap?.value?.view}get camera(){if(!this.view?.destroyed)return this.view?.camera}set camera(e){!e||!this.view||this.view.destroyed||(e.position=st(),this.view.camera=e.clone())}get map(){return this._internalMap.value?.view?.map}get _fov(){return this.camera?.fov}set _fov(e){typeof e!="number"||!this._internalZoom.value||this._internalZoom.value?.zoomFOV(e)}get imageSize(){return this._media?.size}get media(){return this._media}set media(e){if(!e){this._mediaAbortController?.abort(),this._media=void 0,this._clearImage();return}this._media=b.isPanoramicMedia(e)?e:new b(e)}get hfov(){return this._internalZoom.value?.hfov}get base(){return this._base?.geometry}addGraphic(e){this._graphicsController.addGraphic(e)}addGraphics(e){this._graphicsController.addGraphics(e)}clearGraphics(){this._graphicsController.clearGraphics()}async mediaOnLoad(){return this._mediaPromise&&await this._mediaPromise,this._media}removeGraphic(e){this._graphicsController.removeGraphic(e)}removeGraphics(e){this._graphicsController.removeGraphics(e)}zoomIn(){this._internalZoom.value?.zoomIn()}zoomOut(){this._internalZoom.value?.zoomOut()}loaded(){this.manager.onLifecycle(()=>[be(()=>this.view,"drag",this._handleDrag),Me(()=>this.camera!=null,()=>{this.camera&&(this.camera.heading=this.yaw,this.camera.tilt=this.pitch,this._reloadCamera())}),G(()=>this.yaw,()=>{this.camera&&(this.camera.heading=this.yaw,this._reloadCamera())},{sync:!0,initial:!0}),G(()=>this.pitch,()=>{this.camera&&(this.camera.tilt=this.pitch,this._reloadCamera())},{sync:!0,initial:!0}),G(()=>this._fov,()=>{this._reloadCamera()},{sync:!0,initial:!0}),G(()=>this._media,e=>{this._mediaAbortController?.abort(),e&&(this._mediaAbortController=new AbortController,this._mediaPromise=this._loadMediaInternal(e,this._mediaAbortController))},{initial:!0,sync:!0}),G(()=>{if(!this.view?.ready||!this.base)return;let e=this._media?.panoramicTileSource;if(!e)return;let{camera:{heading:t,tilt:o,fov:i},width:s,height:r}=this.view,n=s/r;return{panoramicTileSource:e,heading:t,pitch:o,hfov:ce(i,n),vfov:me(i,n)}},e=>{e&&(this._tileUpdateDebounceHandle!=null&&clearTimeout(this._tileUpdateDebounceHandle),this._tileUpdateDebounceHandle=window.setTimeout(()=>{this._tileUpdateTask?.abort(),this._tileUpdateTask=re(async t=>{await this._updateTilesForCurrentView(e,t)}),this._tileUpdateDebounceHandle=void 0},150))},{initial:!0,sync:!0})])}_reloadCamera(){this.camera=this.camera?.clone()}_clearImage(){this._tileUpdateDebounceHandle!=null&&(clearTimeout(this._tileUpdateDebounceHandle),this._tileUpdateDebounceHandle=void 0),this._tileUpdateTask?.abort(),this._tileUpdateTask=void 0,this.tileCache.clear();for(let e of this._tileLabelGraphics.values())this.removeGraphic(e);this._tileLabelGraphics.clear(),this.clearGraphics(),this._base=void 0,this._currentGraphicsStore.removeAll()}_parseTileKey(e){let[t,o,i]=e.split("/").map(Number);return{level:t,row:o,col:i}}_createTileLabelGraphic(e,t){let{level:o,row:i,col:s}=this._parseTileKey(t),[r,n,l]=e.getTileAnchor(o,i,s);return new ue({attributes:{tileKey:t},geometry:new X({x:r,y:n,z:l,spatialReference:K.WebMercator}),symbol:new $e({color:[255,255,255,.95],font:new Ne({family:"Avenir Next",size:8,weight:"bold"}),haloColor:[0,0,0,.9],haloSize:1,horizontalAlignment:"center",text:t,verticalAlignment:"middle"})})}_attachTileLabel(e,t){if(this._tileLabelGraphics.has(t))return;let o=this._createTileLabelGraphic(e,t);this._tileLabelGraphics.set(t,o),this._currentGraphicsStore.add(o),this.addGraphic(o)}_detachTileLabel(e){let t=this._tileLabelGraphics.get(e);t&&(this.removeGraphic(t),this._currentGraphicsStore.remove(t),this._tileLabelGraphics.delete(e))}async _updateTilesForCurrentView(e,t){let{base:o}=this;if(!o)return;let{panoramicTileSource:i,heading:s,pitch:r,hfov:n,vfov:l}=e,d=[Math.max(1,this.view?.width??1),Math.max(1,this.view?.height??1)],m=i.planTiles({heading:s,pitch:r,hfov:n,vfov:l,imageSize:i.imageSize,viewportSize:d});if(I(t),i.cancelStaleInflight(m.desiredKeySet),m.toDrop.length>0){let u=new Set(m.toDrop);for(let p of u){let{level:f,row:v,col:g}=this._parseTileKey(p);i.unloadComponent(f,v,g),i.markTileDropped(p),this._detachTileLabel(p),this.tileCache.delete(p)}}let c=async u=>{if(u>=m.toFetch.length)return;let p=m.toFetch[u];if(I(t),!this.tileCache.has(p)){let{level:f,row:v,col:g}=this._parseTileKey(p),w=new AbortController,y=()=>{w.abort()};t.addEventListener("abort",y,{once:!0}),i.markTileInflight(p,w);try{let _=await i.fetchTileImageData(f,v,g,w.signal);I(t),m.desiredKeySet.has(p)&&!this.tileCache.has(p)&&(i.loadComponent(f,v,g,_),i.markTileLoaded(p),this._attachTileLabel(i,p),this.tileCache.add(p))}catch(_){ae(_)||te("error",this,"Failed loading panoramic tile component",{detail:{key:p,error:_}})}finally{t.removeEventListener("abort",y),i.markTileInflightResolved(p)}}await c(u+1)};await c(0);let h=i.planTiles({heading:s,pitch:r,hfov:n,vfov:l,imageSize:i.imageSize,viewportSize:d});if(I(t),h.toDrop.length>0){let u=new Set(h.toDrop);for(let p of u){let{level:f,row:v,col:g}=this._parseTileKey(p);i.unloadComponent(f,v,g),i.markTileDropped(p),this._detachTileLabel(p),this.tileCache.delete(p)}}}async _loadMediaInternal(e,t){if(this._loading=!0,this._clearImage(),!e)throw new Error("No media provided");let{mesh:o}=await e.load(t).finally(()=>{this._loading=!1});I(t),this._fov=he(Oe,this.el.clientWidth/this.el.clientHeight),this._base=De(o),this.addGraphic(this._base)}render(){return O`<calcite-panel .loading=${this.hideLoader?void 0:this._loading} .heading=${this.hideTitle?void 0:this._messages.title}><arcgis-scene .environment=${this.#e} hide-attribution .spatialReference=${K.WebMercator} viewing-mode=local .ground=${this._ground} @arcgisViewMouseWheel=${this._handleMouseWheel} ${U(this._internalMap)}><arcgis-oriented-imagery-viewer-panoramic-viewer-zoom .hidden=${this.hideZoomControls} slot=top-left ${U(this._internalZoom)}></arcgis-oriented-imagery-viewer-panoramic-viewer-zoom></arcgis-scene>${this.hideVideoControls||this.media?.type!=="video"?null:O`<arcgis-oriented-imagery-viewer-video-controls .videoRef=${this._media?.element}></arcgis-oriented-imagery-viewer-video-controls>`}</calcite-panel>`}};oe("arcgis-oriented-imagery-viewer-panoramic-viewer",Q);return Q},"geometry/SpatialReference","Graphic","views/3d/environment/Environment","core/reactiveUtils","applications/Components/baUtils","core/Collection","symbols/FillSymbol3DLayer","symbols/MeshSymbol3D","Ground","core/Accessor","core/accessorSupport/decorators","core/Error","geometry/Extent","geometry/Mesh","geometry/support/MeshComponent","geometry/support/MeshMaterialMetallicRoughness","geometry/support/MeshTexture","geometry/support/MeshVertexAttributes","geometry/Point","geometry/support/meshUtils","layers/ImageryTileLayer","symbols/Font","symbols/TextSymbol",a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as M}from"./UZLEFNJL.js";import e from"./SKV3CQSZ.js";import"./WJQUE4DR.js";import d from"./ZRT4RJ62.js";import{a as U}from"./SAI7K4OO.js";import{a as x}from"./L5IRXOCJ.js";import c from"./3VFPLRD3.js";import b from"./E3RBRDUV.js";import{h as S}from"./FY7P5YLX.js";import"./IRDDLVT2.js";import a from"./TJHVEY7T.js";import{a as f}from"./LXME6MU5.js";import{P as z,Q as A,R as H,T as m,U as L,X as O,_ as E,a as R,b as v,x as w}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([j,u,I,{property:g,subclass:B},{watch:$},,,,K,{a:V,c:k,d:C}])=>{var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,h=(t,i,e,r)=>{for(var a=r>1?void 0:r?Y(i,e):i,n=t.length-1,s;n>=0;n--)(s=t[n])&&(a=(r?s(i,e,a):s(a))||a);return r&&a&&X(i,e,a),a},_={left:0,right:0,top:0,bottom:0},D={leading:Symbol("leading-clips"),trailing:Symbol("trailing-clips")};function T(t){return"clips"in t}function F(t,i){let e=10**i;return Math.round(t*e)/e}var l=class extends j{constructor(t){super(t),this._leadingClips=new Map,this._trailingClips=new Map,this.direction="horizontal",this.max=100,this.min=0,this.precision=4,this.step=.5,this.stepMultiplier=10,this.leadingLayers=new u,this.trailingLayers=new u}initialize(){this.addHandles([$(()=>[this.view,this.view?.ready,this.position,this.direction],()=>this._clipLayers(),{initial:!0}),$(()=>this.leadingLayers.toArray(),()=>this._clipLeadingLayers(),{initial:!0}),$(()=>this.trailingLayers.toArray(),()=>this._clipTrailingLayers(),{initial:!0})])}destroy(){this._removeExistingClips()}get leadingLayers(){return this._get("leadingLayers")}set leadingLayers(t){this._set("leadingLayers",t instanceof u?t:new u(t))}get position(){return 25}set position(t){let{precision:i,min:e,max:r}=this;this._set("position",F(Math.max(Math.min(t,r),e),i))}get state(){return this.view?.ready?"ready":"disabled"}get trailingLayers(){return this._get("trailingLayers")}set trailingLayers(t){this._set("trailingLayers",t instanceof u?t:new u(t))}_clipLayers(){this._clipLeadingLayers(),this._clipTrailingLayers()}_clipLeadingLayers(){this._removeClips("leading");let{leadingLayers:t}=this;t.forEach(i=>{this.addHandles(C(e=>this._clipLayer({layer:i,type:"leading"},e)),D.leading)})}_clipTrailingLayers(){this._removeClips("trailing");let{trailingLayers:t}=this;t.forEach(i=>{this.addHandles(C(e=>this._clipLayer({layer:i,type:"trailing"},e)),D.trailing)})}async _getLayerView(t){let{view:i}=this;if(!t||!i)return null;let e=await i.whenLayerView(t);return T(e)?e:null}_getVerticalClipRect(t){let{position:i}=this;return t==="leading"?{type:"rect",..._,bottom:`${100-i}%`}:t==="trailing"?{type:"rect",..._,top:`${i}%`}:null}_getHorizontalClipRect(t){let{position:i}=this;return t==="leading"?{type:"rect",..._,right:`${100-i}%`}:t==="trailing"?{type:"rect",..._,left:`${i}%`}:null}_getClipRect(t){let{direction:i}=this;return i==="vertical"?this._getVerticalClipRect(t):i==="horizontal"?this._getHorizontalClipRect(t):null}async _clipLayer(t,i){let{_leadingClips:e,_trailingClips:r,view:a}=this,{layer:n,type:s}=t,c=s==="trailing"?r:s==="leading"?e:null;try{let o=await this._getLayerView(n);if(i.aborted||this.destroyed||a!==this.view||!o||!c||!(s==="leading"?this.leadingLayers:this.trailingLayers).includes(n))return;let d=c.get(o);d&&o.clips.remove(d);let p=this._getClipRect(s);if(p){let b=o.clips.length;o.clips.add(p);let y=o.clips.at(b);y&&c.set(o,y)}}catch(o){if(i.aborted||k(o)||o instanceof I&&o.name==="view:no-layerview-for-layer")return;V(o,this.declaredClass,"Failed to clip layer")}}_removeClips(t){this.removeHandles(D[t]);let{_leadingClips:i,_trailingClips:e}=this,r=t==="trailing"?e:t==="leading"?i:null;r&&(r.forEach((a,n)=>{T(n)&&n.clips.remove(a)}),r.clear())}_removeExistingClips(){this._removeClips("leading"),this._removeClips("trailing")}};h([g()],l.prototype,"direction",2);h([g()],l.prototype,"leadingLayers",1);h([g({readOnly:!0})],l.prototype,"max",2);h([g({readOnly:!0})],l.prototype,"min",2);h([g()],l.prototype,"position",1);h([g()],l.prototype,"precision",2);h([g({readOnly:!0})],l.prototype,"state",1);h([g()],l.prototype,"step",2);h([g()],l.prototype,"stepMultiplier",2);h([g()],l.prototype,"trailingLayers",1);h([g()],l.prototype,"view",2);l=h([B("map-components.swipe.SwipeViewModel")],l);var N=R`:host{position:absolute;margin:0;background:transparent!important;padding:0;width:100%;height:100%;overflow:hidden;user-select:none;--arcgis-internal-swipe-handle-color-background: var(--calcite-color-surface-1);--arcgis-internal-swipe-divider-color-background: var(--calcite-color-surface-1)}.root{width:100%;height:100%;overflow:hidden;user-select:none}.root,.arcgis-ui .root{pointer-events:none!important}.container{position:absolute;z-index:1;margin:0;outline:0;border:0;padding:0;overflow:hidden;pointer-events:auto;touch-action:none;outline-color:transparent}.horizontal .container{margin-left:calc(var(--calcite-space-3xl) / 2 * -1);cursor:col-resize;height:100%}.vertical .container{margin-top:calc(var(--calcite-space-3xl) / 2 * -1);cursor:row-resize;width:100%}.disabled .container{cursor:default;pointer-events:none}.divider{position:absolute;background-color:var(--arcgis-internal-swipe-divider-color-background)}.horizontal .divider{top:0;left:calc(var(--calcite-space-3xl) / 2);margin-left:calc(var(--calcite-border-width-lg) * .5 * -1);border-right:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);border-left:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);width:var(--calcite-border-width-lg);height:100%}.vertical .divider{top:calc(var(--calcite-space-3xl) / 2);left:0;margin-top:calc(var(--calcite-border-width-lg) * .5 * -1);border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);width:100%;height:var(--calcite-border-width-lg)}.handle{display:flex;position:relative;align-items:center;justify-content:center;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);border-radius:var(--calcite-corner-radius-sm);background-color:var(--arcgis-internal-swipe-handle-color-background);width:var(--calcite-space-3xl);height:var(--calcite-space-3xl);color:var(--calcite-color-text-3)}.handle-hidden{visibility:hidden}.vertical .handle{rotate:90deg}.handle-icon{position:relative;z-index:2}.handle-icon:before{content:"|||";color:inherit}.horizontal .handle{top:calc(50% - calc(var(--calcite-space-3xl) / 2))}.vertical .handle{left:calc(50% - calc(var(--calcite-space-3xl) / 2))}.container:focus .handle,.container:focus .divider{outline:inset 2px var(--calcite-color-focus, var(--calcite-color-focus, var(--calcite-color-brand)))}.container:focus .handle{outline-offset:calc(-2px*(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}`,W=K(l),P=class extends H{constructor(){super(...arguments),this._containerRef=z(),this._swiping=!1,this._positionChanged=!1,this.messages=U({}),this._pointerOffset=0,this.viewModel=W(this),this._onContainerPointerDown=i=>{i.preventDefault();let e=this._containerRef.value;e&&document.activeElement!==this.el&&e.focus(),this._swiping=!0,this._calculatePointerOffset(i)},this.view=this.viewModel.view,this.autoDestroyDisabled=!1,this.direction=this.viewModel.direction,this.disabled=!1,this.hideDivider=!1,this.hideHandle=!1,this.icon="compare",this.label=this.messages.componentLabel,this.position=this.viewModel.position,this.state=this.viewModel.state,this.arcgisPropertyChange=S()("state"),this.arcgisReady=w(),this.arcgisSwipeChange=w(),this.arcgisSwipeInput=w()}static{this.properties={view:0,autoDestroyDisabled:5,direction:3,disabled:7,endLayers:0,hideDivider:7,hideHandle:7,icon:1,label:1,messageOverrides:0,position:9,startLayers:0,referenceElement:1,state:32}}static{this.styles=N}get endLayers(){return this.viewModel.trailingLayers}set endLayers(i){this.viewModel.trailingLayers=i}get startLayers(){return this.viewModel.leadingLayers}set startLayers(i){this.viewModel.leadingLayers=i}async destroy(){await this.manager.destroy()}loaded(){this.listenOn(document,"pointermove",this._onContainerPointerMove),this.listenOn(document,"pointerup",this._onContainerPointerUp)}_calculatePointerOffset(i){let{direction:e}=this,r=this._containerRef.value,a=(e==="vertical"?r.clientHeight:r.clientWidth)/2,n=r.getBoundingClientRect(),s=i.clientX-n.left,c=i.clientY-n.top;this._pointerOffset=e==="vertical"?c-a:s-a}_onContainerPointerUp(i){this._swiping&&(i.preventDefault(),this._positionChanged&&(this.arcgisSwipeChange.emit(),this._positionChanged=!1),this._swiping=!1)}_onContainerPointerMove(i){if(!this._swiping)return;i.preventDefault();let{_pointerOffset:e,el:r,direction:a}=this,{clientX:n,clientY:s}=i,{top:c,left:o,width:d,height:p}=r.getBoundingClientRect(),b=a==="vertical"?p:d,y=(a==="vertical"?s-c-e:n-o-e)/b*100;this.position!==y&&(this.position=y,this._positionChanged=!0,this.arcgisSwipeInput.emit())}_getKeyPosition(i){let{key:e}=i,{position:r}=this,{max:a,min:n,step:s,stepMultiplier:c,direction:o}=this.viewModel,d=s*c;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(e)&&(i.preventDefault(),i.stopPropagation()),o==="vertical"?e==="ArrowDown"||e==="ArrowRight":e==="ArrowUp"||e==="ArrowRight"){let p=i.shiftKey?d:s;return r+p}if(o==="vertical"?e==="ArrowUp"||e==="ArrowLeft":e==="ArrowDown"||e==="ArrowLeft"){let p=i.shiftKey?d:s;return r-p}return e==="Home"?n:e==="End"?a:(o==="vertical"?e==="PageDown":e==="PageUp")?r+d:(o==="vertical"?e==="PageUp":e==="PageDown")?r-d:null}_onContainerKeyDown(i){let e=this._getKeyPosition(i);typeof e=="number"&&this.position!==e&&(this.position=e,this.arcgisSwipeInput.emit(),this.arcgisSwipeChange.emit())}render(){let{state:i,direction:e}=this.viewModel,r=i==="disabled"||this.disabled,a={[x.disabled]:r,disabled:r,vertical:e==="vertical",horizontal:e==="horizontal"};return v`<div class=${m(f("root",x.widget,a))}>${i==="disabled"?null:this._renderContainer()}</div>`}_renderHandle(){let{direction:i}=this.viewModel,{hideHandle:e}=this,r={[M.dragHorizontal]:i==="vertical",[M.dragVertical]:i==="horizontal"},a=f("handle",!!e&&"handle-hidden");return v`<div class=${m(a)} role=presentation><span aria-hidden=true class=${m(f("handle-icon",r))}></span></div>`}_renderDivider(){return this.hideDivider?null:v`<div class="divider" role=presentation></div>`}_renderContent(){return[this._renderDivider(),this._renderHandle()]}_renderContainer(){let{disabled:i,viewModel:e}=this,{max:r,min:a,direction:n,position:s}=e,c=this.label??this.messages.dragLabel??"",o=`${s}%`,d={top:n==="vertical"?o:void 0,left:n==="vertical"?void 0:o},p=this._renderContent();return i?v`<div class="container" role=presentation style=${L(d)}>${p}</div>`:v`<div @pointerdown=${this._onContainerPointerDown} .ariaLabel=${c} .ariaOrientation=${n} .ariaValueMax=${`${r}`} .ariaValueMin=${`${a}`} .ariaValueNow=${`${s}`} .ariaValueText=${o} class="container" @keydown=${this._onContainerKeyDown} role=slider style=${L(d)} tabindex=0 title=${c??O} touch-action=none ${A(this._containerRef)}>${p}</div>`}};E("arcgis-swipe",P);return P},"core/Accessor","core/Collection","core/Error","core/accessorSupport/decorators","core/reactiveUtils",a,b,c,d,e)
|
|
2
|
+
import{a as M}from"./UZLEFNJL.js";import e from"./3ZRVPLIZ.js";import"./WJQUE4DR.js";import d from"./ZRT4RJ62.js";import{a as U}from"./SAI7K4OO.js";import{a as x}from"./L5IRXOCJ.js";import c from"./3VFPLRD3.js";import b from"./E3RBRDUV.js";import{h as S}from"./FY7P5YLX.js";import"./IRDDLVT2.js";import a from"./TJHVEY7T.js";import{a as f}from"./LXME6MU5.js";import{P as z,Q as A,R as H,T as m,U as L,X as O,_ as E,a as R,b as v,x as w}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([j,u,I,{property:g,subclass:B},{watch:$},,,,K,{a:V,c:k,d:C}])=>{var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,h=(t,i,e,r)=>{for(var a=r>1?void 0:r?Y(i,e):i,n=t.length-1,s;n>=0;n--)(s=t[n])&&(a=(r?s(i,e,a):s(a))||a);return r&&a&&X(i,e,a),a},_={left:0,right:0,top:0,bottom:0},D={leading:Symbol("leading-clips"),trailing:Symbol("trailing-clips")};function T(t){return"clips"in t}function F(t,i){let e=10**i;return Math.round(t*e)/e}var l=class extends j{constructor(t){super(t),this._leadingClips=new Map,this._trailingClips=new Map,this.direction="horizontal",this.max=100,this.min=0,this.precision=4,this.step=.5,this.stepMultiplier=10,this.leadingLayers=new u,this.trailingLayers=new u}initialize(){this.addHandles([$(()=>[this.view,this.view?.ready,this.position,this.direction],()=>this._clipLayers(),{initial:!0}),$(()=>this.leadingLayers.toArray(),()=>this._clipLeadingLayers(),{initial:!0}),$(()=>this.trailingLayers.toArray(),()=>this._clipTrailingLayers(),{initial:!0})])}destroy(){this._removeExistingClips()}get leadingLayers(){return this._get("leadingLayers")}set leadingLayers(t){this._set("leadingLayers",t instanceof u?t:new u(t))}get position(){return 25}set position(t){let{precision:i,min:e,max:r}=this;this._set("position",F(Math.max(Math.min(t,r),e),i))}get state(){return this.view?.ready?"ready":"disabled"}get trailingLayers(){return this._get("trailingLayers")}set trailingLayers(t){this._set("trailingLayers",t instanceof u?t:new u(t))}_clipLayers(){this._clipLeadingLayers(),this._clipTrailingLayers()}_clipLeadingLayers(){this._removeClips("leading");let{leadingLayers:t}=this;t.forEach(i=>{this.addHandles(C(e=>this._clipLayer({layer:i,type:"leading"},e)),D.leading)})}_clipTrailingLayers(){this._removeClips("trailing");let{trailingLayers:t}=this;t.forEach(i=>{this.addHandles(C(e=>this._clipLayer({layer:i,type:"trailing"},e)),D.trailing)})}async _getLayerView(t){let{view:i}=this;if(!t||!i)return null;let e=await i.whenLayerView(t);return T(e)?e:null}_getVerticalClipRect(t){let{position:i}=this;return t==="leading"?{type:"rect",..._,bottom:`${100-i}%`}:t==="trailing"?{type:"rect",..._,top:`${i}%`}:null}_getHorizontalClipRect(t){let{position:i}=this;return t==="leading"?{type:"rect",..._,right:`${100-i}%`}:t==="trailing"?{type:"rect",..._,left:`${i}%`}:null}_getClipRect(t){let{direction:i}=this;return i==="vertical"?this._getVerticalClipRect(t):i==="horizontal"?this._getHorizontalClipRect(t):null}async _clipLayer(t,i){let{_leadingClips:e,_trailingClips:r,view:a}=this,{layer:n,type:s}=t,c=s==="trailing"?r:s==="leading"?e:null;try{let o=await this._getLayerView(n);if(i.aborted||this.destroyed||a!==this.view||!o||!c||!(s==="leading"?this.leadingLayers:this.trailingLayers).includes(n))return;let d=c.get(o);d&&o.clips.remove(d);let p=this._getClipRect(s);if(p){let b=o.clips.length;o.clips.add(p);let y=o.clips.at(b);y&&c.set(o,y)}}catch(o){if(i.aborted||k(o)||o instanceof I&&o.name==="view:no-layerview-for-layer")return;V(o,this.declaredClass,"Failed to clip layer")}}_removeClips(t){this.removeHandles(D[t]);let{_leadingClips:i,_trailingClips:e}=this,r=t==="trailing"?e:t==="leading"?i:null;r&&(r.forEach((a,n)=>{T(n)&&n.clips.remove(a)}),r.clear())}_removeExistingClips(){this._removeClips("leading"),this._removeClips("trailing")}};h([g()],l.prototype,"direction",2);h([g()],l.prototype,"leadingLayers",1);h([g({readOnly:!0})],l.prototype,"max",2);h([g({readOnly:!0})],l.prototype,"min",2);h([g()],l.prototype,"position",1);h([g()],l.prototype,"precision",2);h([g({readOnly:!0})],l.prototype,"state",1);h([g()],l.prototype,"step",2);h([g()],l.prototype,"stepMultiplier",2);h([g()],l.prototype,"trailingLayers",1);h([g()],l.prototype,"view",2);l=h([B("map-components.swipe.SwipeViewModel")],l);var N=R`:host{position:absolute;margin:0;background:transparent!important;padding:0;width:100%;height:100%;overflow:hidden;user-select:none;--arcgis-internal-swipe-handle-color-background: var(--calcite-color-surface-1);--arcgis-internal-swipe-divider-color-background: var(--calcite-color-surface-1)}.root{width:100%;height:100%;overflow:hidden;user-select:none}.root,.arcgis-ui .root{pointer-events:none!important}.container{position:absolute;z-index:1;margin:0;outline:0;border:0;padding:0;overflow:hidden;pointer-events:auto;touch-action:none;outline-color:transparent}.horizontal .container{margin-left:calc(var(--calcite-space-3xl) / 2 * -1);cursor:col-resize;height:100%}.vertical .container{margin-top:calc(var(--calcite-space-3xl) / 2 * -1);cursor:row-resize;width:100%}.disabled .container{cursor:default;pointer-events:none}.divider{position:absolute;background-color:var(--arcgis-internal-swipe-divider-color-background)}.horizontal .divider{top:0;left:calc(var(--calcite-space-3xl) / 2);margin-left:calc(var(--calcite-border-width-lg) * .5 * -1);border-right:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);border-left:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);width:var(--calcite-border-width-lg);height:100%}.vertical .divider{top:calc(var(--calcite-space-3xl) / 2);left:0;margin-top:calc(var(--calcite-border-width-lg) * .5 * -1);border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);width:100%;height:var(--calcite-border-width-lg)}.handle{display:flex;position:relative;align-items:center;justify-content:center;border:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);border-radius:var(--calcite-corner-radius-sm);background-color:var(--arcgis-internal-swipe-handle-color-background);width:var(--calcite-space-3xl);height:var(--calcite-space-3xl);color:var(--calcite-color-text-3)}.handle-hidden{visibility:hidden}.vertical .handle{rotate:90deg}.handle-icon{position:relative;z-index:2}.handle-icon:before{content:"|||";color:inherit}.horizontal .handle{top:calc(50% - calc(var(--calcite-space-3xl) / 2))}.vertical .handle{left:calc(50% - calc(var(--calcite-space-3xl) / 2))}.container:focus .handle,.container:focus .divider{outline:inset 2px var(--calcite-color-focus, var(--calcite-color-focus, var(--calcite-color-brand)))}.container:focus .handle{outline-offset:calc(-2px*(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}`,W=K(l),P=class extends H{constructor(){super(...arguments),this._containerRef=z(),this._swiping=!1,this._positionChanged=!1,this.messages=U({}),this._pointerOffset=0,this.viewModel=W(this),this._onContainerPointerDown=i=>{i.preventDefault();let e=this._containerRef.value;e&&document.activeElement!==this.el&&e.focus(),this._swiping=!0,this._calculatePointerOffset(i)},this.view=this.viewModel.view,this.autoDestroyDisabled=!1,this.direction=this.viewModel.direction,this.disabled=!1,this.hideDivider=!1,this.hideHandle=!1,this.icon="compare",this.label=this.messages.componentLabel,this.position=this.viewModel.position,this.state=this.viewModel.state,this.arcgisPropertyChange=S()("state"),this.arcgisReady=w(),this.arcgisSwipeChange=w(),this.arcgisSwipeInput=w()}static{this.properties={view:0,autoDestroyDisabled:5,direction:3,disabled:7,endLayers:0,hideDivider:7,hideHandle:7,icon:1,label:1,messageOverrides:0,position:9,startLayers:0,referenceElement:1,state:32}}static{this.styles=N}get endLayers(){return this.viewModel.trailingLayers}set endLayers(i){this.viewModel.trailingLayers=i}get startLayers(){return this.viewModel.leadingLayers}set startLayers(i){this.viewModel.leadingLayers=i}async destroy(){await this.manager.destroy()}loaded(){this.listenOn(document,"pointermove",this._onContainerPointerMove),this.listenOn(document,"pointerup",this._onContainerPointerUp)}_calculatePointerOffset(i){let{direction:e}=this,r=this._containerRef.value,a=(e==="vertical"?r.clientHeight:r.clientWidth)/2,n=r.getBoundingClientRect(),s=i.clientX-n.left,c=i.clientY-n.top;this._pointerOffset=e==="vertical"?c-a:s-a}_onContainerPointerUp(i){this._swiping&&(i.preventDefault(),this._positionChanged&&(this.arcgisSwipeChange.emit(),this._positionChanged=!1),this._swiping=!1)}_onContainerPointerMove(i){if(!this._swiping)return;i.preventDefault();let{_pointerOffset:e,el:r,direction:a}=this,{clientX:n,clientY:s}=i,{top:c,left:o,width:d,height:p}=r.getBoundingClientRect(),b=a==="vertical"?p:d,y=(a==="vertical"?s-c-e:n-o-e)/b*100;this.position!==y&&(this.position=y,this._positionChanged=!0,this.arcgisSwipeInput.emit())}_getKeyPosition(i){let{key:e}=i,{position:r}=this,{max:a,min:n,step:s,stepMultiplier:c,direction:o}=this.viewModel,d=s*c;if(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown"].includes(e)&&(i.preventDefault(),i.stopPropagation()),o==="vertical"?e==="ArrowDown"||e==="ArrowRight":e==="ArrowUp"||e==="ArrowRight"){let p=i.shiftKey?d:s;return r+p}if(o==="vertical"?e==="ArrowUp"||e==="ArrowLeft":e==="ArrowDown"||e==="ArrowLeft"){let p=i.shiftKey?d:s;return r-p}return e==="Home"?n:e==="End"?a:(o==="vertical"?e==="PageDown":e==="PageUp")?r+d:(o==="vertical"?e==="PageUp":e==="PageDown")?r-d:null}_onContainerKeyDown(i){let e=this._getKeyPosition(i);typeof e=="number"&&this.position!==e&&(this.position=e,this.arcgisSwipeInput.emit(),this.arcgisSwipeChange.emit())}render(){let{state:i,direction:e}=this.viewModel,r=i==="disabled"||this.disabled,a={[x.disabled]:r,disabled:r,vertical:e==="vertical",horizontal:e==="horizontal"};return v`<div class=${m(f("root",x.widget,a))}>${i==="disabled"?null:this._renderContainer()}</div>`}_renderHandle(){let{direction:i}=this.viewModel,{hideHandle:e}=this,r={[M.dragHorizontal]:i==="vertical",[M.dragVertical]:i==="horizontal"},a=f("handle",!!e&&"handle-hidden");return v`<div class=${m(a)} role=presentation><span aria-hidden=true class=${m(f("handle-icon",r))}></span></div>`}_renderDivider(){return this.hideDivider?null:v`<div class="divider" role=presentation></div>`}_renderContent(){return[this._renderDivider(),this._renderHandle()]}_renderContainer(){let{disabled:i,viewModel:e}=this,{max:r,min:a,direction:n,position:s}=e,c=this.label??this.messages.dragLabel??"",o=`${s}%`,d={top:n==="vertical"?o:void 0,left:n==="vertical"?void 0:o},p=this._renderContent();return i?v`<div class="container" role=presentation style=${L(d)}>${p}</div>`:v`<div @pointerdown=${this._onContainerPointerDown} .ariaLabel=${c} .ariaOrientation=${n} .ariaValueMax=${`${r}`} .ariaValueMin=${`${a}`} .ariaValueNow=${`${s}`} .ariaValueText=${o} class="container" @keydown=${this._onContainerKeyDown} role=slider style=${L(d)} tabindex=0 title=${c??O} touch-action=none ${A(this._containerRef)}>${p}</div>`}};E("arcgis-swipe",P);return P},"core/Accessor","core/Collection","core/Error","core/accessorSupport/decorators","core/reactiveUtils",a,b,c,d,e)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as k}from"./GUL7EIJ4.js";import{a as C}from"./YEPGUNSV.js";import b from"./HU57LQOA.js";import a from"./SKV3CQSZ.js";import"./WJQUE4DR.js";import{a as I}from"./SAI7K4OO.js";import"./FY7P5YLX.js";import"./IRDDLVT2.js";import"./LXME6MU5.js";import{R as L,Y as F,_ as N,a as q,b as p}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([{createReactiveMap:v,findUtilityNetwork:x,getOrCreateMapValue:P},{stripHTML:S},f,{ignoreAbortErrors:D},{watch:T},U,Q,B,O,,{d:E,h:A}])=>{var G=q`.list-container{min-height:var(--calcite-spacing-xxxl)}.loading-container{display:flex;justify-content:center;padding:var(--calcite-space-md) 0;width:100%}.sticky-loading-container{display:flex;position:sticky;bottom:var(--calcite-space-sm);align-items:center;justify-content:center;z-index:2;margin:0;padding:0;height:var(--calcite-spacing-xxxl);pointer-events:none;height:500px}`,M=100,j={assetGroup:"assetgroup",assetType:"assettype"},V="{00000000-0000-0000-0000-000000000000}",$=class extends L{constructor(){super(...arguments),this._addFlowItem=e=>{e&&this.flowItems?.push(e)},this._attachmentAssociations=new f,this._attachmentFeatureCount=0,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._connectivityAssociations=new f,this._connectivityFeatureCount=0,this._containerAssociations=new f,this._containerFeatureCount=0,this._contentAssociations=new f,this._contentFeatureCount=0,this._messages=I({name:"utility-network-associations",blocking:!0}),this._messagesFeature=I({name:"feature",blocking:!0}),this._networkSourceIdsInUse=new Set,this._query=async e=>{if(!e)return;await this._loadUtilityNetworks();let{_queryAbortController:t}=this;this._destroyAssociatedFeatureViewModels(),this._clearFeatures(),this._featureCount&&await this._queryAssociatedFeatures(e,{signal:t?.signal})},this._queryController=async e=>{this._cancelQuery();let t=new AbortController;this._queryAbortController=t,await D(this._query(e)),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();let e=new AbortController;this._queryFeatureCountAbortController=e,await D(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryDebounced=k(this._queryController,M),this._queryFeatureCountDebounced=k(this._queryFeatureCountController,M),this._structureAssociations=new f,this._structureFeatureCount=0,this._queryAssociationType=async()=>{this._activeAssociationType&&this._queryDebounced(this._activeAssociationType)},this._associationFeatures=v(),this._associationViewModels=v(),this._featureCount=0,this._loaded=!1,this._queryAbortController=null,this._queryFeatureCountAbortController=null,this._queryPageAbortController=null,this.associationTypes=null,this.autoDestroyDisabled=!1,this.useFeatureNextFlowItem=!1,this.includeDefaultActions=!1,this.flowType="feature-utility-network-associations",this.headingLevel=2,this.source="popup"}static{this.properties={_activeAssociationType:16,_associationFeatures:16,_associationViewModels:16,_canLoad:16,_canQuery:16,_featureCount:16,_loaded:16,_queryAbortController:16,_queryFeatureCountAbortController:16,_queryPageAbortController:16,_state:16,associationTypes:0,autoDestroyDisabled:5,description:1,flowItems:0,useFeatureNextFlowItem:5,actions:0,includeDefaultActions:5,flowType:1,graphic:0,heading:1,headingLevel:9,layer:0,map:0,messageOverrides:0,messages:0,parentFeatureViewModel:0,referenceElement:1,source:1,spatialReference:0,timeZone:1,view:0}}static{this.styles=G}get _globalId(){return(this._globalIdField&&this.graphic?.attributes?.[this._globalIdField])??null}get _globalIdField(){return this.layer?.globalIdField}get _objectId(){return(this._objectIdField&&this.graphic?.attributes?.[this._objectIdField])??null}get _objectIdField(){return this.layer?.objectIdField}get _supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get _utilityNetwork(){let{layer:e,map:t}=this;if(!e?.loaded||!t)return null;let s=A(e)?e.parent:e;return x(t,s)}get _canLoad(){return!!this.map}get _canQuery(){return!!this.layer?.capabilities?.query?.supportsPagination}get _state(){let{_canLoad:e,_canQuery:t,_featureCount:s,_loaded:i,_queryAbortController:a,_queryFeatureCountAbortController:r,_queryPageAbortController:o,associationTypes:l}=this;return r||e&&!i?"loading":a||o?"querying":!this._globalId||!l||!t||!s?"disabled":"ready"}get heading(){return this._heading}set heading(e){this._heading=e}async destroy(){await this.manager.destroy()}loaded(){this.manager.onLifecycle(()=>[T(()=>[this.graphic,this.layer,this.map,this.associationTypes,this._canQuery,this._objectId,this._globalId],()=>{this._queryFeatureCountDebounced(),this._queryAssociationType()},{initial:!0}),T(()=>this._activeAssociationType,e=>{this._queryDebounced(e)}),T(()=>this._associationFeatures.values(),()=>{this._setUpUtilityNetworkAssociationsViewModels()})]),this.manager.onDestroy(()=>{this._cancelQuery(),this._cancelQueryFeatureCount()})}_addAssociationTypeFlowItem(e){let t=this.useFeatureNextFlowItem?F(p`<arcgis-feature-utility-network-association-list .actions=${this.actions} .autoDestroyDisabled=${this.autoDestroyDisabled} .associationViewModels=${this._associationViewModels} .description=${this._getParentFeatureDescription()} .flowItems=${this.flowItems} .flowType=${this.flowType} .heading=${this._getAssociationTypeTitle(e)} .includeDefaultActions=${this.includeDefaultActions} .map=${this.map} .messageOverrides=${this.messageOverrides} .parentFeatureViewModel=${this.parentFeatureViewModel} .referenceElement=${this.referenceElement} .state=${this._state} .spatialReference=${this.spatialReference} .timeZone=${this.timeZone} use-feature-next-flow-item .view=${this.view}></arcgis-feature-utility-network-association-list>`):F(p`<arcgis-feature-utility-network-association-list .actions=${this.actions} .autoDestroyDisabled=${this.autoDestroyDisabled} .associationViewModels=${this._associationViewModels} .description=${this._getParentFeatureDescription()} .flowItems=${this.flowItems} .flowType=${this.flowType} .heading=${this._getAssociationTypeTitle(e)} .includeDefaultActions=${this.includeDefaultActions} .map=${this.map} .messageOverrides=${this.messageOverrides} .parentFeatureViewModel=${this.parentFeatureViewModel} .referenceElement=${this.referenceElement} .state=${this._state} .spatialReference=${this.spatialReference} .timeZone=${this.timeZone} .view=${this.view}></arcgis-feature-utility-network-association-list>`);this._addFlowItem(t)}_clearAssociations(){this._attachmentAssociations.removeAll(),this._connectivityAssociations.removeAll(),this._containerAssociations.removeAll(),this._contentAssociations.removeAll(),this._structureAssociations.removeAll()}_clearFeatures(){this._associationFeatures.forEach(e=>e.removeAll()),this._associationFeatures.clear()}_compareByFeatureTitle(e,t){return e.title.localeCompare(t.title,void 0,{numeric:!0})}async _countAssociatedFeatureCount(e,t,s,i,a){let r=this._getFeatureQueryWhereClause(e,t,s,i),o=e.createQuery();return o.where=r,o.outFields=["*"],o.returnGeometry=!1,await e.queryFeatureCount(o,{signal:a?.signal})}async _countAssociatedFeatures(e,t,s,i,a){if(!t.length)return 0;let r=await this._findLayersBySourceId(e);await this._loadLayers(r);let o=r.map(l=>this._countAssociatedFeatureCount(l,t,s,i,a));return(await Promise.all(o)).reduce((l,c)=>l+c,0)}async _createAssociationFeatureObjects(e,t,s,i,a){if(!e.length)return[];let r=new Map,o=Array.from(t.entries()).map(async([c,d])=>{let u=await this._findLayersBySourceId(c);await this._loadLayers(u);let h=u.map(m=>this._queryLayer(m,d,s,i,a));(await Promise.all(h)).forEach(m=>{m.forEach(n=>{if(this.source==="popup"?n.sourceLayer&&n.getEffectivePopupTemplate():n.sourceLayer){let _=n.layer.globalIdField??"",y=n.getAttribute(_),w=r.get(y)??[];w.push(n),r.set(y,w)}})})});await Promise.all(o);let l=[];return await Promise.all(e.toArray().map(async c=>{let{fromNetworkElement:d,toNetworkElement:u}=c,h=d.globalId===this._globalId?u:d,m=r.get(h.globalId)??[];await Promise.all(m.map(async n=>{let _=this._utilityNetwork?.getTerminalById(h?.terminalId??void 0)?.name,y=await n.sourceLayer.getFeatureTitle(n)||this._getFeatureTitle(n);l.push({title:y,feature:n,association:c,terminalName:_})}))})),l}_destroyAssociatedFeatureViewModels(){this._associationViewModels.forEach(e=>e.destroyAll())}_equals(e,t){if(e.globalId===V&&t.globalId===V){let s=function(d,u){return d.networkSourceId===u.networkSourceId&&d.globalId===u.globalId&&d.terminalId===u.terminalId&&d.firstUnit===u.firstUnit&&d.numUnits===u.numUnits},i=e.fromNetworkElement,a=e.toNetworkElement,r=t.fromNetworkElement,o=t.toNetworkElement,l=s(i,r),c=s(a,o);return l&&c&&e.associationType===t.associationType}return e.globalId!=null&&t.globalId!=null&&e.globalId===t.globalId}async _findLayersBySourceId(e){let{_utilityNetwork:t,map:s}=this;t?.loaded||await t?.load();let i=t.getLayerIdBySourceId(e),a=s.allLayers.filter(o=>!!t?.isUtilityLayer(o)&&o.layerId===i),r=s.allTables.filter(o=>!!t?.isUtilityLayer(o)&&o.layerId===i);return a.concat(r).toArray()}_getAssociationsByType(e){switch(e){case"attachment":return this._attachmentAssociations;case"structure":return this._structureAssociations;case"connectivity":return this._connectivityAssociations;case"container":return this._containerAssociations;case"content":return this._contentAssociations}}_getAssociationTypeTitle(e){let{_messages:t}=this;if(e.title)return e.title;switch(e.type){case"attachment":return t.associationsAttachments??this.messages?.noTitle??"";case"connectivity":return t.associationsConnectivity??this.messages?.noTitle??"";case"structure":return t.associationsStructure??this.messages?.noTitle??"";case"content":return t.associationsContents??this.messages?.noTitle??"";case"container":return t.associationsContainer??this.messages?.noTitle??""}}_getFeatureCountForAssociationType(e){switch(e){case"attachment":return this._attachmentFeatureCount;case"structure":return this._structureFeatureCount;case"content":return this._contentFeatureCount;case"container":return this._containerFeatureCount;case"connectivity":return this._connectivityFeatureCount}}_getFeatureQueryWhereClause(e,t,s,i){let a=e.globalIdField,r=e.fieldsIndex.get(j.assetGroup),o=e.fieldsIndex.get(j.assetType),l=s!=null,c=i!=null,d=a?U.sqlIn(a,t):null,u=l?`(${r?.name} = ${s})`:null,h=l&&c?`(${o?.name} = ${i})`:null;return[d,u,h].filter(Boolean).join(" AND ")}_getFeatureTitle(e){let t=e.attributes,s=e.sourceLayer;if(!t||!s)return"";let i="displayField"in s?s.displayField:null,a=i!=null?t[i.toString()]:null,r=a!=null?a.toString():null,o=e.getObjectId()?.toString();return r||o||""}_getParentFeatureDescription(){let{parentFeatureViewModel:e}=this;if(e){if("heading"in e)return e.heading;if("title"in e)return e.title}}async _loadUtilityNetworks(){let e=this.map;if(!e)return;e.utilityNetworks&&await Promise.allSettled(e.utilityNetworks.map(s=>s.load()));let t=this._utilityNetwork;if(t){let s=i=>{if("layerId"in i&&t.isUtilityLayer(i)){let a=i.layerId!=null?t.getSourceIdByLayerId(i.layerId):null;a!=null&&this._networkSourceIdsInUse.add(a)}};this._networkSourceIdsInUse=new Set,e.allLayers.forEach(s),e.allTables.forEach(s)}}async _loadLayers(e){let t=e.filter(s=>!s.loaded).map(s=>s.load());t.length&&await Promise.allSettled(t)}_matchesGlobalFeature(e,t){return this._equals(e.association,t.association)}async _queryAssociatedFeatures(e,t){let{layer:s,_globalId:i,associationTypes:a,_utilityNetwork:r,_canQuery:o,_associationFeatures:l}=this;if(await Promise.allSettled([s?.load(),r?.load()]),!o||!s||!a||!r)return;let c=this._getAssociationsByType(e.type),{associatedAssetGroup:d,associatedAssetType:u}=e,h=new Map;c.forEach(n=>{let{fromNetworkElement:_,toNetworkElement:y}=n,{networkSourceId:w,elementGlobalId:b}=_.globalId===i?{networkSourceId:y.networkSourceId,elementGlobalId:y.globalId}:{networkSourceId:_.networkSourceId,elementGlobalId:_.globalId},g=h.get(w)||[];g.push(b),h.set(w,g)});let m=await this._createAssociationFeatureObjects(c,h,d,u,t);this._parseFeatureObjects(m,l)}async _queryAssociations(e){let{layer:t,_globalId:s,associationTypes:i,_utilityNetwork:a,_canQuery:r}=this;if(await Promise.allSettled([t?.load(),a?.load()]),this._clearAssociations(),!r||!t||!i||!a||!s)return;let o=A(t)?t.parent:t,l=new Q({globalId:s,networkSourceId:a.getSourceIdByLayerId(o.layerId)}),c=new Set;i.forEach(n=>{switch(n.type){case"attachment":case"structure":c.add("attachment");break;case"container":case"content":c.add("containment");break;case"connectivity":c.add("connectivity"),c.add("junction-junction-connectivity"),c.add("junction-edge-from-connectivity"),c.add("junction-edge-midspan-connectivity"),c.add("junction-edge-to-connectivity");break}});let d=await a?.queryAssociations(new B({elements:[l],types:Array.from(c)}),{signal:e?.signal}),u=new Map,h=new Map;i.forEach(n=>{h.set(n.type,n),u.set(n.type,[])}),d.forEach(n=>{let{toNetworkElement:_,fromNetworkElement:y}=n;switch(n.associationType){case"attachment":if(y?.globalId===s){if(this._shouldDiscardNetworkElement(_,"attachment",h))break;u.get("attachment")?.push(_.globalId),this._attachmentAssociations.add(n)}else{if(this._shouldDiscardNetworkElement(y,"structure",h))break;u.get("structure")?.push(y.globalId),this._structureAssociations.add(n)}break;case"connectivity":case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":case"junction-junction-connectivity":if(y?.globalId===s){if(this._shouldDiscardNetworkElement(_,"connectivity",h))break;u.get("connectivity")?.push(_.globalId)}else{if(this._shouldDiscardNetworkElement(y,"connectivity",h))break;u.get("connectivity")?.push(y.globalId)}this._connectivityAssociations.add(n);break;case"containment":if(y?.globalId===s){if(this._shouldDiscardNetworkElement(_,"content",h))break;u.get("content")?.push(_.globalId),this._contentAssociations.add(n)}else{if(this._shouldDiscardNetworkElement(y,"container",h))break;u.get("container")?.push(y.globalId),this._containerAssociations.add(n)}break}});let m=i.map(async n=>{let{associatedNetworkSourceId:_,associatedAssetGroup:y,associatedAssetType:w}=n,b=u.get(n.type),g=y!=null?await this._countAssociatedFeatures(_,b,y,w,e):b.length;switch(n.type){case"attachment":this._attachmentFeatureCount=g;break;case"connectivity":this._connectivityFeatureCount=g;break;case"container":this._containerFeatureCount=g;break;case"content":this._contentFeatureCount=g;break;case"structure":this._structureFeatureCount=g;break}});await Promise.allSettled(m)}async _queryFeatureCount(){await this._loadUtilityNetworks();let{_queryFeatureCountAbortController:e,_canQuery:t}=this;if(!t){this._featureCount=0;return}await this._queryAssociations(e),this._featureCount=this._attachmentFeatureCount+this._connectivityFeatureCount+this._containerFeatureCount+this._contentFeatureCount+this._structureFeatureCount}async _queryLayer(e,t,s,i,a){let r=this._getFeatureQueryWhereClause(e,t,s,i),o=e.createQuery();o.where=r,o.outFields=["*"],o.returnGeometry=!1,o.cacheHint=this._supportsCacheHint;let{features:l}=await E(e,o,a);return l}_parseFeatureObjects(e,t){let s=v();e.forEach(i=>{let a=(i?.feature).sourceLayer;P(s,a,()=>new f).add(i)});for(let[i,a]of s)this._sortFeatureObjectsByTitle(a),t.set(i,a)}_selectAssociationType(e){let{flowItems:t}=this;t&&(this._activeAssociationType=e,this._setUpUtilityNetworkAssociationsViewModels(),this._addAssociationTypeFlowItem(e))}_setUpUtilityNetworkAssociationsViewModels(){this._associationViewModels.forEach((a,r)=>{let o=this._associationFeatures.get(r);o?a.forEach(l=>{o.find(c=>this._matchesGlobalFeature(l,c))||(a.remove(l),a.length||this._associationViewModels.delete(r))}):(a.removeAll(),this._associationViewModels.delete(r))});let{map:e,view:t,spatialReference:s,timeZone:i}=this;this._associationFeatures.forEach((a,r)=>{let o=this._associationViewModels.get(r)||new f;a?.filter(Boolean).forEach((l,c)=>{if(!o.some(d=>this._matchesGlobalFeature(d,l))){let{association:d,feature:u,terminalName:h,title:m}=l;o.add({title:m,association:d,featureViewModel:new O({abilities:{utilityNetworkAssociationsContent:!1},map:e,view:t,spatialReference:s,timeZone:i,graphic:u}),terminalName:h},c)}}),this._associationViewModels.set(r,o)})}_shouldDiscardNetworkElement(e,t,s){if(!e)return!1;let{networkSourceId:i}=e,a=s.get(t)?.associatedNetworkSourceId,r=this._networkSourceIdsInUse.has(i);return a!=null&&a!==i||!r}_sortFeatureObjectsByTitle(e){e.sort(this._compareByFeatureTitle)}render(){let{_state:e}=this;return p`<div class="root"><arcgis-feature-element-info .heading=${this.heading} .headingLevel=${this.headingLevel} .description=${this.description}></arcgis-feature-element-info>${e==="loading"?this._renderLoading():e==="disabled"?this._renderAssociationNotFound():this._renderContent()}</div>`}_renderAssociationNotFound(){return p`<calcite-notice icon=information kind=info open scale=s width=full><div slot=message>${this._messages.noAssociations}</div></calcite-notice>`}_renderAssociationTypeList(e){return this._getFeatureCountForAssociationType(e.type)>0?this._renderAssociationTypeListItem(e):null}_renderAssociationTypeListItem(e){let t=this._getAssociationTypeTitle(e);return C(`association-type-${e.type}`,p`<calcite-list-item .description=${S(e.description)} .label=${S(t)} .value=${e.type} @calciteListItemSelect=${()=>this._selectAssociationType(e)}><calcite-icon flip-rtl icon=chevron-right scale=s slot=content-end></calcite-icon></calcite-list-item>`)}_renderContent(){let{_state:e,associationTypes:t}=this,s=this._messages.associationsList??this._messagesFeature.noTitle??"";return C("list-container",p`<div class="list-container">${e==="ready"?p`<div><calcite-list display-mode=flat .label=${s}>${t.map(i=>this._renderAssociationTypeList(i))}</calcite-list></div>`:null}${this._renderStickyLoading()}</div>`)}_renderLoading(){return p`<div class="loading-container">${this._renderLoadingIcon()}${this._renderStickyLoading()}</div>`}_renderLoadingIcon(){return p`<calcite-loader inline label></calcite-loader>`}_renderStickyLoading(){return this._state==="querying"?p`<div class="sticky-loading-container">${this._renderLoadingIcon()}</div>`:null}};N("arcgis-feature-utility-network-associations",$);return $},"applications/Components/featureUtils","applications/Components/stringUtils","core/Collection","core/promiseUtils","core/reactiveUtils","core/sql","rest/networks/support/NetworkElement","rest/networks/support/QueryAssociationsParameters","popup/FeatureModel",a,b)
|
|
2
|
+
import{a as k}from"./GUL7EIJ4.js";import{a as C}from"./YEPGUNSV.js";import b from"./HU57LQOA.js";import a from"./3ZRVPLIZ.js";import"./WJQUE4DR.js";import{a as I}from"./SAI7K4OO.js";import"./FY7P5YLX.js";import"./IRDDLVT2.js";import"./LXME6MU5.js";import{R as L,Y as F,_ as N,a as q,b as p}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([{createReactiveMap:v,findUtilityNetwork:x,getOrCreateMapValue:P},{stripHTML:S},f,{ignoreAbortErrors:D},{watch:T},U,Q,B,O,,{d:E,h:A}])=>{var G=q`.list-container{min-height:var(--calcite-spacing-xxxl)}.loading-container{display:flex;justify-content:center;padding:var(--calcite-space-md) 0;width:100%}.sticky-loading-container{display:flex;position:sticky;bottom:var(--calcite-space-sm);align-items:center;justify-content:center;z-index:2;margin:0;padding:0;height:var(--calcite-spacing-xxxl);pointer-events:none;height:500px}`,M=100,j={assetGroup:"assetgroup",assetType:"assettype"},V="{00000000-0000-0000-0000-000000000000}",$=class extends L{constructor(){super(...arguments),this._addFlowItem=e=>{e&&this.flowItems?.push(e)},this._attachmentAssociations=new f,this._attachmentFeatureCount=0,this._cancelQuery=()=>{let{_queryAbortController:e}=this;e&&e.abort(),this._queryAbortController=null},this._cancelQueryFeatureCount=()=>{let{_queryFeatureCountAbortController:e}=this;e&&e.abort(),this._queryFeatureCountAbortController=null},this._connectivityAssociations=new f,this._connectivityFeatureCount=0,this._containerAssociations=new f,this._containerFeatureCount=0,this._contentAssociations=new f,this._contentFeatureCount=0,this._messages=I({name:"utility-network-associations",blocking:!0}),this._messagesFeature=I({name:"feature",blocking:!0}),this._networkSourceIdsInUse=new Set,this._query=async e=>{if(!e)return;await this._loadUtilityNetworks();let{_queryAbortController:t}=this;this._destroyAssociatedFeatureViewModels(),this._clearFeatures(),this._featureCount&&await this._queryAssociatedFeatures(e,{signal:t?.signal})},this._queryController=async e=>{this._cancelQuery();let t=new AbortController;this._queryAbortController=t,await D(this._query(e)),this._queryAbortController===t&&(this._queryAbortController=null)},this._queryFeatureCountController=async()=>{this._loaded=!1,this._cancelQueryFeatureCount();let e=new AbortController;this._queryFeatureCountAbortController=e,await D(this._queryFeatureCount()),this._queryFeatureCountAbortController===e&&(this._queryFeatureCountAbortController=null),this._loaded=!0},this._queryDebounced=k(this._queryController,M),this._queryFeatureCountDebounced=k(this._queryFeatureCountController,M),this._structureAssociations=new f,this._structureFeatureCount=0,this._queryAssociationType=async()=>{this._activeAssociationType&&this._queryDebounced(this._activeAssociationType)},this._associationFeatures=v(),this._associationViewModels=v(),this._featureCount=0,this._loaded=!1,this._queryAbortController=null,this._queryFeatureCountAbortController=null,this._queryPageAbortController=null,this.associationTypes=null,this.autoDestroyDisabled=!1,this.useFeatureNextFlowItem=!1,this.includeDefaultActions=!1,this.flowType="feature-utility-network-associations",this.headingLevel=2,this.source="popup"}static{this.properties={_activeAssociationType:16,_associationFeatures:16,_associationViewModels:16,_canLoad:16,_canQuery:16,_featureCount:16,_loaded:16,_queryAbortController:16,_queryFeatureCountAbortController:16,_queryPageAbortController:16,_state:16,associationTypes:0,autoDestroyDisabled:5,description:1,flowItems:0,useFeatureNextFlowItem:5,actions:0,includeDefaultActions:5,flowType:1,graphic:0,heading:1,headingLevel:9,layer:0,map:0,messageOverrides:0,messages:0,parentFeatureViewModel:0,referenceElement:1,source:1,spatialReference:0,timeZone:1,view:0}}static{this.styles=G}get _globalId(){return(this._globalIdField&&this.graphic?.attributes?.[this._globalIdField])??null}get _globalIdField(){return this.layer?.globalIdField}get _objectId(){return(this._objectIdField&&this.graphic?.attributes?.[this._objectIdField])??null}get _objectIdField(){return this.layer?.objectIdField}get _supportsCacheHint(){return!!this.layer?.capabilities?.queryRelated?.supportsCacheHint}get _utilityNetwork(){let{layer:e,map:t}=this;if(!e?.loaded||!t)return null;let s=A(e)?e.parent:e;return x(t,s)}get _canLoad(){return!!this.map}get _canQuery(){return!!this.layer?.capabilities?.query?.supportsPagination}get _state(){let{_canLoad:e,_canQuery:t,_featureCount:s,_loaded:i,_queryAbortController:a,_queryFeatureCountAbortController:r,_queryPageAbortController:o,associationTypes:l}=this;return r||e&&!i?"loading":a||o?"querying":!this._globalId||!l||!t||!s?"disabled":"ready"}get heading(){return this._heading}set heading(e){this._heading=e}async destroy(){await this.manager.destroy()}loaded(){this.manager.onLifecycle(()=>[T(()=>[this.graphic,this.layer,this.map,this.associationTypes,this._canQuery,this._objectId,this._globalId],()=>{this._queryFeatureCountDebounced(),this._queryAssociationType()},{initial:!0}),T(()=>this._activeAssociationType,e=>{this._queryDebounced(e)}),T(()=>this._associationFeatures.values(),()=>{this._setUpUtilityNetworkAssociationsViewModels()})]),this.manager.onDestroy(()=>{this._cancelQuery(),this._cancelQueryFeatureCount()})}_addAssociationTypeFlowItem(e){let t=this.useFeatureNextFlowItem?F(p`<arcgis-feature-utility-network-association-list .actions=${this.actions} .autoDestroyDisabled=${this.autoDestroyDisabled} .associationViewModels=${this._associationViewModels} .description=${this._getParentFeatureDescription()} .flowItems=${this.flowItems} .flowType=${this.flowType} .heading=${this._getAssociationTypeTitle(e)} .includeDefaultActions=${this.includeDefaultActions} .map=${this.map} .messageOverrides=${this.messageOverrides} .parentFeatureViewModel=${this.parentFeatureViewModel} .referenceElement=${this.referenceElement} .state=${this._state} .spatialReference=${this.spatialReference} .timeZone=${this.timeZone} use-feature-next-flow-item .view=${this.view}></arcgis-feature-utility-network-association-list>`):F(p`<arcgis-feature-utility-network-association-list .actions=${this.actions} .autoDestroyDisabled=${this.autoDestroyDisabled} .associationViewModels=${this._associationViewModels} .description=${this._getParentFeatureDescription()} .flowItems=${this.flowItems} .flowType=${this.flowType} .heading=${this._getAssociationTypeTitle(e)} .includeDefaultActions=${this.includeDefaultActions} .map=${this.map} .messageOverrides=${this.messageOverrides} .parentFeatureViewModel=${this.parentFeatureViewModel} .referenceElement=${this.referenceElement} .state=${this._state} .spatialReference=${this.spatialReference} .timeZone=${this.timeZone} .view=${this.view}></arcgis-feature-utility-network-association-list>`);this._addFlowItem(t)}_clearAssociations(){this._attachmentAssociations.removeAll(),this._connectivityAssociations.removeAll(),this._containerAssociations.removeAll(),this._contentAssociations.removeAll(),this._structureAssociations.removeAll()}_clearFeatures(){this._associationFeatures.forEach(e=>e.removeAll()),this._associationFeatures.clear()}_compareByFeatureTitle(e,t){return e.title.localeCompare(t.title,void 0,{numeric:!0})}async _countAssociatedFeatureCount(e,t,s,i,a){let r=this._getFeatureQueryWhereClause(e,t,s,i),o=e.createQuery();return o.where=r,o.outFields=["*"],o.returnGeometry=!1,await e.queryFeatureCount(o,{signal:a?.signal})}async _countAssociatedFeatures(e,t,s,i,a){if(!t.length)return 0;let r=await this._findLayersBySourceId(e);await this._loadLayers(r);let o=r.map(l=>this._countAssociatedFeatureCount(l,t,s,i,a));return(await Promise.all(o)).reduce((l,c)=>l+c,0)}async _createAssociationFeatureObjects(e,t,s,i,a){if(!e.length)return[];let r=new Map,o=Array.from(t.entries()).map(async([c,d])=>{let u=await this._findLayersBySourceId(c);await this._loadLayers(u);let h=u.map(m=>this._queryLayer(m,d,s,i,a));(await Promise.all(h)).forEach(m=>{m.forEach(n=>{if(this.source==="popup"?n.sourceLayer&&n.getEffectivePopupTemplate():n.sourceLayer){let _=n.layer.globalIdField??"",y=n.getAttribute(_),w=r.get(y)??[];w.push(n),r.set(y,w)}})})});await Promise.all(o);let l=[];return await Promise.all(e.toArray().map(async c=>{let{fromNetworkElement:d,toNetworkElement:u}=c,h=d.globalId===this._globalId?u:d,m=r.get(h.globalId)??[];await Promise.all(m.map(async n=>{let _=this._utilityNetwork?.getTerminalById(h?.terminalId??void 0)?.name,y=await n.sourceLayer.getFeatureTitle(n)||this._getFeatureTitle(n);l.push({title:y,feature:n,association:c,terminalName:_})}))})),l}_destroyAssociatedFeatureViewModels(){this._associationViewModels.forEach(e=>e.destroyAll())}_equals(e,t){if(e.globalId===V&&t.globalId===V){let s=function(d,u){return d.networkSourceId===u.networkSourceId&&d.globalId===u.globalId&&d.terminalId===u.terminalId&&d.firstUnit===u.firstUnit&&d.numUnits===u.numUnits},i=e.fromNetworkElement,a=e.toNetworkElement,r=t.fromNetworkElement,o=t.toNetworkElement,l=s(i,r),c=s(a,o);return l&&c&&e.associationType===t.associationType}return e.globalId!=null&&t.globalId!=null&&e.globalId===t.globalId}async _findLayersBySourceId(e){let{_utilityNetwork:t,map:s}=this;t?.loaded||await t?.load();let i=t.getLayerIdBySourceId(e),a=s.allLayers.filter(o=>!!t?.isUtilityLayer(o)&&o.layerId===i),r=s.allTables.filter(o=>!!t?.isUtilityLayer(o)&&o.layerId===i);return a.concat(r).toArray()}_getAssociationsByType(e){switch(e){case"attachment":return this._attachmentAssociations;case"structure":return this._structureAssociations;case"connectivity":return this._connectivityAssociations;case"container":return this._containerAssociations;case"content":return this._contentAssociations}}_getAssociationTypeTitle(e){let{_messages:t}=this;if(e.title)return e.title;switch(e.type){case"attachment":return t.associationsAttachments??this.messages?.noTitle??"";case"connectivity":return t.associationsConnectivity??this.messages?.noTitle??"";case"structure":return t.associationsStructure??this.messages?.noTitle??"";case"content":return t.associationsContents??this.messages?.noTitle??"";case"container":return t.associationsContainer??this.messages?.noTitle??""}}_getFeatureCountForAssociationType(e){switch(e){case"attachment":return this._attachmentFeatureCount;case"structure":return this._structureFeatureCount;case"content":return this._contentFeatureCount;case"container":return this._containerFeatureCount;case"connectivity":return this._connectivityFeatureCount}}_getFeatureQueryWhereClause(e,t,s,i){let a=e.globalIdField,r=e.fieldsIndex.get(j.assetGroup),o=e.fieldsIndex.get(j.assetType),l=s!=null,c=i!=null,d=a?U.sqlIn(a,t):null,u=l?`(${r?.name} = ${s})`:null,h=l&&c?`(${o?.name} = ${i})`:null;return[d,u,h].filter(Boolean).join(" AND ")}_getFeatureTitle(e){let t=e.attributes,s=e.sourceLayer;if(!t||!s)return"";let i="displayField"in s?s.displayField:null,a=i!=null?t[i.toString()]:null,r=a!=null?a.toString():null,o=e.getObjectId()?.toString();return r||o||""}_getParentFeatureDescription(){let{parentFeatureViewModel:e}=this;if(e){if("heading"in e)return e.heading;if("title"in e)return e.title}}async _loadUtilityNetworks(){let e=this.map;if(!e)return;e.utilityNetworks&&await Promise.allSettled(e.utilityNetworks.map(s=>s.load()));let t=this._utilityNetwork;if(t){let s=i=>{if("layerId"in i&&t.isUtilityLayer(i)){let a=i.layerId!=null?t.getSourceIdByLayerId(i.layerId):null;a!=null&&this._networkSourceIdsInUse.add(a)}};this._networkSourceIdsInUse=new Set,e.allLayers.forEach(s),e.allTables.forEach(s)}}async _loadLayers(e){let t=e.filter(s=>!s.loaded).map(s=>s.load());t.length&&await Promise.allSettled(t)}_matchesGlobalFeature(e,t){return this._equals(e.association,t.association)}async _queryAssociatedFeatures(e,t){let{layer:s,_globalId:i,associationTypes:a,_utilityNetwork:r,_canQuery:o,_associationFeatures:l}=this;if(await Promise.allSettled([s?.load(),r?.load()]),!o||!s||!a||!r)return;let c=this._getAssociationsByType(e.type),{associatedAssetGroup:d,associatedAssetType:u}=e,h=new Map;c.forEach(n=>{let{fromNetworkElement:_,toNetworkElement:y}=n,{networkSourceId:w,elementGlobalId:b}=_.globalId===i?{networkSourceId:y.networkSourceId,elementGlobalId:y.globalId}:{networkSourceId:_.networkSourceId,elementGlobalId:_.globalId},g=h.get(w)||[];g.push(b),h.set(w,g)});let m=await this._createAssociationFeatureObjects(c,h,d,u,t);this._parseFeatureObjects(m,l)}async _queryAssociations(e){let{layer:t,_globalId:s,associationTypes:i,_utilityNetwork:a,_canQuery:r}=this;if(await Promise.allSettled([t?.load(),a?.load()]),this._clearAssociations(),!r||!t||!i||!a||!s)return;let o=A(t)?t.parent:t,l=new Q({globalId:s,networkSourceId:a.getSourceIdByLayerId(o.layerId)}),c=new Set;i.forEach(n=>{switch(n.type){case"attachment":case"structure":c.add("attachment");break;case"container":case"content":c.add("containment");break;case"connectivity":c.add("connectivity"),c.add("junction-junction-connectivity"),c.add("junction-edge-from-connectivity"),c.add("junction-edge-midspan-connectivity"),c.add("junction-edge-to-connectivity");break}});let d=await a?.queryAssociations(new B({elements:[l],types:Array.from(c)}),{signal:e?.signal}),u=new Map,h=new Map;i.forEach(n=>{h.set(n.type,n),u.set(n.type,[])}),d.forEach(n=>{let{toNetworkElement:_,fromNetworkElement:y}=n;switch(n.associationType){case"attachment":if(y?.globalId===s){if(this._shouldDiscardNetworkElement(_,"attachment",h))break;u.get("attachment")?.push(_.globalId),this._attachmentAssociations.add(n)}else{if(this._shouldDiscardNetworkElement(y,"structure",h))break;u.get("structure")?.push(y.globalId),this._structureAssociations.add(n)}break;case"connectivity":case"junction-edge-from-connectivity":case"junction-edge-midspan-connectivity":case"junction-edge-to-connectivity":case"junction-junction-connectivity":if(y?.globalId===s){if(this._shouldDiscardNetworkElement(_,"connectivity",h))break;u.get("connectivity")?.push(_.globalId)}else{if(this._shouldDiscardNetworkElement(y,"connectivity",h))break;u.get("connectivity")?.push(y.globalId)}this._connectivityAssociations.add(n);break;case"containment":if(y?.globalId===s){if(this._shouldDiscardNetworkElement(_,"content",h))break;u.get("content")?.push(_.globalId),this._contentAssociations.add(n)}else{if(this._shouldDiscardNetworkElement(y,"container",h))break;u.get("container")?.push(y.globalId),this._containerAssociations.add(n)}break}});let m=i.map(async n=>{let{associatedNetworkSourceId:_,associatedAssetGroup:y,associatedAssetType:w}=n,b=u.get(n.type),g=y!=null?await this._countAssociatedFeatures(_,b,y,w,e):b.length;switch(n.type){case"attachment":this._attachmentFeatureCount=g;break;case"connectivity":this._connectivityFeatureCount=g;break;case"container":this._containerFeatureCount=g;break;case"content":this._contentFeatureCount=g;break;case"structure":this._structureFeatureCount=g;break}});await Promise.allSettled(m)}async _queryFeatureCount(){await this._loadUtilityNetworks();let{_queryFeatureCountAbortController:e,_canQuery:t}=this;if(!t){this._featureCount=0;return}await this._queryAssociations(e),this._featureCount=this._attachmentFeatureCount+this._connectivityFeatureCount+this._containerFeatureCount+this._contentFeatureCount+this._structureFeatureCount}async _queryLayer(e,t,s,i,a){let r=this._getFeatureQueryWhereClause(e,t,s,i),o=e.createQuery();o.where=r,o.outFields=["*"],o.returnGeometry=!1,o.cacheHint=this._supportsCacheHint;let{features:l}=await E(e,o,a);return l}_parseFeatureObjects(e,t){let s=v();e.forEach(i=>{let a=(i?.feature).sourceLayer;P(s,a,()=>new f).add(i)});for(let[i,a]of s)this._sortFeatureObjectsByTitle(a),t.set(i,a)}_selectAssociationType(e){let{flowItems:t}=this;t&&(this._activeAssociationType=e,this._setUpUtilityNetworkAssociationsViewModels(),this._addAssociationTypeFlowItem(e))}_setUpUtilityNetworkAssociationsViewModels(){this._associationViewModels.forEach((a,r)=>{let o=this._associationFeatures.get(r);o?a.forEach(l=>{o.find(c=>this._matchesGlobalFeature(l,c))||(a.remove(l),a.length||this._associationViewModels.delete(r))}):(a.removeAll(),this._associationViewModels.delete(r))});let{map:e,view:t,spatialReference:s,timeZone:i}=this;this._associationFeatures.forEach((a,r)=>{let o=this._associationViewModels.get(r)||new f;a?.filter(Boolean).forEach((l,c)=>{if(!o.some(d=>this._matchesGlobalFeature(d,l))){let{association:d,feature:u,terminalName:h,title:m}=l;o.add({title:m,association:d,featureViewModel:new O({abilities:{utilityNetworkAssociationsContent:!1},map:e,view:t,spatialReference:s,timeZone:i,graphic:u}),terminalName:h},c)}}),this._associationViewModels.set(r,o)})}_shouldDiscardNetworkElement(e,t,s){if(!e)return!1;let{networkSourceId:i}=e,a=s.get(t)?.associatedNetworkSourceId,r=this._networkSourceIdsInUse.has(i);return a!=null&&a!==i||!r}_sortFeatureObjectsByTitle(e){e.sort(this._compareByFeatureTitle)}render(){let{_state:e}=this;return p`<div class="root"><arcgis-feature-element-info .heading=${this.heading} .headingLevel=${this.headingLevel} .description=${this.description}></arcgis-feature-element-info>${e==="loading"?this._renderLoading():e==="disabled"?this._renderAssociationNotFound():this._renderContent()}</div>`}_renderAssociationNotFound(){return p`<calcite-notice icon=information kind=info open scale=s width=full><div slot=message>${this._messages.noAssociations}</div></calcite-notice>`}_renderAssociationTypeList(e){return this._getFeatureCountForAssociationType(e.type)>0?this._renderAssociationTypeListItem(e):null}_renderAssociationTypeListItem(e){let t=this._getAssociationTypeTitle(e);return C(`association-type-${e.type}`,p`<calcite-list-item .description=${S(e.description)} .label=${S(t)} .value=${e.type} @calciteListItemSelect=${()=>this._selectAssociationType(e)}><calcite-icon flip-rtl icon=chevron-right scale=s slot=content-end></calcite-icon></calcite-list-item>`)}_renderContent(){let{_state:e,associationTypes:t}=this,s=this._messages.associationsList??this._messagesFeature.noTitle??"";return C("list-container",p`<div class="list-container">${e==="ready"?p`<div><calcite-list display-mode=flat .label=${s}>${t.map(i=>this._renderAssociationTypeList(i))}</calcite-list></div>`:null}${this._renderStickyLoading()}</div>`)}_renderLoading(){return p`<div class="loading-container">${this._renderLoadingIcon()}${this._renderStickyLoading()}</div>`}_renderLoadingIcon(){return p`<calcite-loader inline label></calcite-loader>`}_renderStickyLoading(){return this._state==="querying"?p`<div class="sticky-loading-container">${this._renderLoadingIcon()}</div>`:null}};N("arcgis-feature-utility-network-associations",$);return $},"applications/Components/featureUtils","applications/Components/stringUtils","core/Collection","core/promiseUtils","core/reactiveUtils","core/sql","rest/networks/support/NetworkElement","rest/networks/support/QueryAssociationsParameters","popup/FeatureModel",a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{X as e}from"./
|
|
2
|
+
import{X as e}from"./AKSCONMP.js";import"./NJ3CJS46.js";import{Y as o}from"./NXC47WWQ.js";import"./TAVTDQ6S.js";var r=class extends o{setupDefaultRules(){super.setupDefaultRules(),this.rule("InterfaceColors").setAll({stroke:e.fromHex(0),fill:e.fromHex(2829099),primaryButton:e.lighten(e.fromHex(6788316),-.2),primaryButtonHover:e.lighten(e.fromHex(6779356),-.2),primaryButtonDown:e.lighten(e.fromHex(6872181),-.2),primaryButtonActive:e.lighten(e.fromHex(6872182),-.2),primaryButtonText:e.fromHex(16777215),primaryButtonStroke:e.lighten(e.fromHex(6788316),-.2),secondaryButton:e.fromHex(3881787),secondaryButtonHover:e.lighten(e.fromHex(3881787),.1),secondaryButtonDown:e.lighten(e.fromHex(3881787),.15),secondaryButtonActive:e.lighten(e.fromHex(3881787),.2),secondaryButtonText:e.fromHex(12303291),secondaryButtonStroke:e.lighten(e.fromHex(3881787),-.2),grid:e.fromHex(12303291),background:e.fromHex(0),alternativeBackground:e.fromHex(16777215),text:e.fromHex(16777215),alternativeText:e.fromHex(0),disabled:e.fromHex(11382189),positive:e.fromHex(5288704),negative:e.fromHex(11730944),warning:e.fromHex(15909424)})}};var b=r;export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import l from"./
|
|
2
|
+
import l from"./J2K2LRII.js";import{a as q}from"./4L43F7HU.js";import k from"./PD2BELF2.js";import j from"./W6ILOTBW.js";import{a as B,b as S,c as G,g as O}from"./ZCFWKPXL.js";import{a as U}from"./4O6ZYILT.js";import{a as I}from"./YEPGUNSV.js";import i from"./DP2UXNPJ.js";import h from"./HU57LQOA.js";import g from"./3ZRVPLIZ.js";import"./WJQUE4DR.js";import f from"./ZRT4RJ62.js";import{a as T}from"./SAI7K4OO.js";import{a as m}from"./L5IRXOCJ.js";import e from"./ANB7YZCR.js";import c from"./3VFPLRD3.js";import b from"./E3RBRDUV.js";import{h as D}from"./FY7P5YLX.js";import"./IRDDLVT2.js";import a from"./TJHVEY7T.js";import{a as F}from"./LXME6MU5.js";import{B as y,P as M,Q as E,R as _,T as p,X as C,_ as L,b as o,x as d}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([z,{watch:w,on:H},V,,,,A,P,,,,,,{a:x,b:N,c:R,d:k}])=>{var v=q,j="nested",K=P(V),$=class extends _{constructor(){super(...arguments),this.#t=x(this),this.#i=null,this._rootGroupUid=`table-${y()}`,this._rootListRef=M(),this._selectedDragItemLayerUid=null,this.messages=T(),this.viewModel=K(this),this._canMove=({dragEl:e,fromEl:t,toEl:i},s)=>{let l=s==="pull"?this.listItemCanGiveFunction:this.listItemCanReceiveFunction,a=this.#e(e);if(!a||!("sortable"in a)||!a.sortable)return!1;let c=this.#e(t),h=this.#s(t),n=this.#e(i),g=this.#s(i),u=!!h&&!!g&&h===g,f={selected:a,from:c,to:n},b=t?.group,r=i?.group;return b&&r&&typeof l=="function"?l(f):u},this._onPanelOpen=()=>{this.requestUpdate()},this._onSelectedDragItemLayerUidChange=e=>{this._selectedDragItemLayerUid=e},this._onTriggerAction=(e,t)=>{this.triggerAction(e,t)},this.autoDestroyDisabled=!1,this.closed=!1,this.collapsed=!1,this.dragEnabled=!1,this.filterPlaceholder="",this.filterText="",this.headingLevel=2,this.hideNoFilterResultsNotice=!1,this.hideNoItemsNotice=!1,this.hideStatusIndicators=!1,this.icon="table",this.listItemCreatedFunction=this.viewModel.listItemCreatedFunction,this.listModeDisabled=this.viewModel.listModeDisabled,this.map=this.viewModel.map,this.minDragEnabledItems=G,this.minFilterItems=S,this.selectedItems=new z,this.selectionMode="none",this.showCloseButton=!1,this.showCollapseButton=!1,this.showErrors=!1,this.showFilter=!1,this.showHeading=!1,this.showTemporaryTableIndicators=!1,this.tables=this.viewModel.tables,this.arcgisClose=d(),this.arcgisFilterChange=d(),this.arcgisPropertyChange=D()("state"),this.arcgisReady=d(),this.arcgisSelectedItemsChange=d(),this.arcgisTableItemsChanged=d(),this.arcgisTriggerAction=A(()=>this.viewModel,"trigger-action")}static{this.properties={_visibleItems:16,_openedPanelItems:16,_dragEnabled:16,_filterEnabled:16,autoDestroyDisabled:5,closed:5,collapsed:7,dragEnabled:5,filterPlaceholder:1,filterPredicate:0,filterText:1,headingLevel:9,hideNoFilterResultsNotice:5,hideNoItemsNotice:5,hideStatusIndicators:5,icon:1,label:1,listItemCanGiveFunction:0,listItemCanReceiveFunction:0,listItemCreatedFunction:0,listModeDisabled:5,map:0,messageOverrides:0,minDragEnabledItems:9,minFilterItems:9,referenceElement:1,selectedItems:0,selectionMode:1,showCloseButton:5,showCollapseButton:5,showErrors:5,showFilter:5,showHeading:5,showTemporaryTableIndicators:5,state:32,tableItems:32,tables:0,view:0}}static{this.styles=[R,N]}#t;#i;get _visibleItems(){return this.tableItems?.filter(e=>!e.hidden&&(this.showErrors||!e.error))}get _openedPanelItems(){return this._visibleItems.filter(({hidden:e,panel:t})=>!e&&t?.open&&!t.disabled&&t.flowEnabled)}get _dragEnabled(){return this.viewModel.totalItems>=this.minDragEnabledItems&&this.dragEnabled}get _filterEnabled(){return this.viewModel.totalItems>=this.minFilterItems&&this.showFilter}get state(){return this.viewModel.state}get tableItems(){return this.viewModel.tableItems}async destroy(){await this.manager.destroy()}willUpdate(e){e.has("map")&&(this.viewModel.map=this.map),e.has("tables")&&(this.viewModel.tables=this.tables),e.has("listItemCreatedFunction")&&(this.viewModel.listItemCreatedFunction=this.listItemCreatedFunction)}loaded(){this.manager.onLifecycle(()=>[w(()=>this.view?.map,e=>{this.map||(this.viewModel.map=e)},{initial:!0}),H(()=>this.viewModel.tableItems,"change",()=>{O(this.selectedItems),this.arcgisTableItemsChanged.emit(),this.requestUpdate()},{initial:!0}),H(()=>this.selectedItems,"change",()=>this.arcgisSelectedItemsChange.emit()),w(()=>[this.viewModel.state,this.viewModel.totalItems],()=>this.requestUpdate(),{initial:!0}),w(()=>[this.filterPredicate,this._rootListRef.value],()=>this.#r())])}triggerAction(e,t){return this.viewModel.triggerAction(e,t)}#e(e){if(e?.tagName.toLowerCase()==="calcite-list-item")return e.value;let t=e?.getAttribute("data-item");return t?this.#a(t):null}#a(e){let t=this.tableItems?.toArray()??[];for(;t.length;){let i=t.shift();if(i){if(i.uid===e)return i;t.push(...i.children?.toArray()??[])}}return null}#s(e){return e?.getAttribute("data-layer-type")??null}#r(){let e=this._rootListRef.value;e&&(e.filterPredicate=this.filterPredicate?t=>{let i=this.#e(t);return i?this.filterPredicate(i):!1}:void 0)}#o(e){e.open=!1}#n(e,t){e?.sort((i,s)=>{let l=i.uid!=null?t.indexOf(i.uid):-1,a=s.uid!=null?t.indexOf(s.uid):-1;return l>a?-1:l<a?1:0})}#h(e){let{fromEl:t,dragEl:i,oldIndex:s}=e;s==null||!t||!i||t.insertBefore(i,t.children[s])}#d(e){let t=this.#i,{toEl:i,fromEl:s,dragEl:l,newIndex:a}=e,c=t?.newIndex===a&&t?.dragEl===l&&t?.toEl===i&&t?.fromEl===s;if(!s||!i||c)return;this.#i=e,this._selectedDragItemLayerUid=l.value;let h=Array.from(s.children).filter(n=>n?.matches("calcite-list-item")).map(n=>n.value.layer?.uid??"");this.#n(this.map?.tables,h)}#c(e){let{selectionMode:t,selectedItems:i}=this;if(t==="none")return;let s=e.target.selectedItems.map(l=>this.#e(l)).filter(Boolean);i.removeAll(),i.addMany(s)}#m(){this.closed=!0,this.arcgisClose.emit(),this.autoDestroyDisabled||this.destroy()}render(){let{state:e}=this,t={[m.hidden]:e==="loading",[m.disabled]:e==="disabled"};return o`<div class=${p(F(m.widget,m.panel,t))}>${this.#p()}</div>`}#l(){return o`<div slot=message>${this.messages.noItemsToDisplay}</div>`}#g(){return this.hideNoItemsNotice?null:o`<div class=${p(v.itemMessage)}><calcite-notice icon=information kind=info open width=full>${this.#l()}</calcite-notice></div>`}#u(){return U(this._openedPanelItems.toArray(),e=>e.uid,(e,t)=>{let{panel:i,title:s}=e,l=()=>this.#o(i);return o`<calcite-flow-item .description=${s} .heading=${i.title} .headingLevel=${this.headingLevel} .selected=${t===this._openedPanelItems.length-1} @calciteFlowItemBack=${a=>{a.preventDefault(),l()}}><arcgis-layer-list-item-panel .item=${e} .view=${this.view}></arcgis-layer-list-item-panel><calcite-button appearance=transparent @click=${l} slot=footer-actions width=full>${this.messages.back}</calcite-button></calcite-flow-item>`})}#p(){let{collapsed:e,_visibleItems:t,_filterEnabled:i,_rootGroupUid:s,showCloseButton:l,showCollapseButton:a,showHeading:c,_dragEnabled:h,filterText:n,filterPlaceholder:g,messages:u}=this,f=this.#t.selectionMode,b=[o`<calcite-flow-item .closable=${l} .closed=${this.closed} .collapsed=${e} .collapsible=${a} .heading=${c?this.label??u.componentLabel:void 0} .headingLevel=${this.headingLevel} .selected=${!this._openedPanelItems.length} @calciteFlowItemClose=${()=>this.#m()}>${t?.length?o`<calcite-list .canPull=${r=>this._canMove(r,"pull")} .canPut=${r=>this._canMove(r,"put")} data-layer-type=${s??C} .displayMode=${j} .dragEnabled=${h} .filterEnabled=${i} .filterPlaceholder=${g} .filterProps=${B} .filterText=${i?n:""} .group=${s} .label=${this.label??u.componentLabel} selection-appearance=border .selectionMode=${f} @calciteListChange=${this.#c} @calciteListDragEnd=${r=>this.#h(r.detail)} @calciteListFilter=${r=>{this.filterText=r.currentTarget?.filterText??"",this.arcgisFilterChange.emit()}} @calciteListOrderChange=${r=>this.#d(r.detail)} ${E(this._rootListRef)}>${t.toArray().map(r=>this.#f(r))}${i&&!this.hideNoFilterResultsNotice?o`<div class=${p(v.filterNoResults)} slot=filter-no-results><calcite-notice kind=info open width=full>${this.#l()}</calcite-notice></div>`:null}</calcite-list>`:this.#g()}</calcite-flow-item>`,this.#u()];return this.closed?null:I("root-flow",o`<calcite-flow>${b}</calcite-flow>`)}#f(e){return I(e.uid,k({canMove:this._canMove,css:v,displayMode:j,dragEnabled:this.dragEnabled,hideStatusIndicators:this.hideStatusIndicators,item:e,itemType:"table",listModeDisabled:this.viewModel.listModeDisabled,messages:this.messages,rootGroupUid:this._rootGroupUid,selectedDragItemLayerUid:this._selectedDragItemLayerUid,selectedItems:this.selectedItems,selectionMode:this.#t.selectionMode,showErrors:this.showErrors,showFilter:this.showFilter,showTemporaryTableIndicators:this.showTemporaryTableIndicators,handleAction:(t,i)=>this._onTriggerAction(t,i),handlePanelOpen:this._onPanelOpen,handleSelectedDragItemLayerUidChange:this._onSelectedDragItemLayerUidChange,view:this.view}))}};L("arcgis-table-list-next",$);return $},"core/Collection","core/reactiveUtils","layerList/TableListModel",a,b,c,e,f,g,h,i,j,k,l)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{b as oe}from"./JB6WQEFJ.js";import g from"./DSIYRWN2.js";import{a as T}from"./KBRYRH7T.js";import"./FH3WFF5O.js";import{a as M}from"./6J3KSMFG.js";import f from"./SKV3CQSZ.js";import"./WJQUE4DR.js";import e from"./ZRT4RJ62.js";import{a as ee}from"./SAI7K4OO.js";import d from"./ANB7YZCR.js";import c from"./3VFPLRD3.js";import b from"./E3RBRDUV.js";import{d as X,h as Y}from"./FY7P5YLX.js";import"./IRDDLVT2.js";import a from"./TJHVEY7T.js";import{b as Q}from"./LXME6MU5.js";import{E as N,F as H,O as q,P as k,Q as _,R as j,X as A,_ as J,a as K,b as v,e as O,x as W,z as U}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([{substitute:de},pe,ge,{watch:y,on:ue,whenOnce:me},ve,{getOrCreateMapValue:ae,createReactiveMap:ye},be,{property:p,subclass:fe},{ignoreAbortErrors:E},Ce,we,,,,w,te,{f:Z},ie])=>{function se(i,e){let t=e;for(let o of i.split(".")){if(typeof t!="object"||t===null)return;t=Reflect.get(t,o)}return typeof t=="string"?t:void 0}var Te=K`.editing-controls-panel{min-inline-size:100px;max-inline-size:400px;-webkit-user-select:none;user-select:none;pointer-events:initial;padding:var(--calcite-space-sm);arcgis-sketch-tooltip-controls+arcgis-snapping-controls{border-block-start:1px solid var(--calcite-color-border-3)}}:host{pointer-events:none}.toolbar-container{block-size:100%;min-block-size:0;min-inline-size:0}arcgis-toolbar-stack[layout=vertical]{block-size:100cqh;min-block-size:100%;max-block-size:100%}:host([data-intrinsic-toolbar-sizing]){min-inline-size:0;min-block-size:0;max-inline-size:100%;max-block-size:100%;arcgis-toolbar-stack[layout=vertical]{block-size:100%}}:host([data-intrinsic-toolbar-sizing][layout="vertical"]){display:grid;grid-template-columns:minmax(min-content,1fr);grid-template-rows:minmax(0,1fr);inline-size:fit-content;block-size:100%;.toolbar-container{block-size:auto}.toolbar-container,arcgis-view-popover{grid-area:1 / 1}}:host([data-intrinsic-toolbar-sizing][layout="vertical"][toolbar-kind="floating"]){block-size:auto}`,Se={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"text"},Ee={selectionTools:{defaultPriority:T.Default,groupKind:"split-button",overflowLabel:"selection"},selectionSet:{defaultPriority:T.High,groupKind:"actions"},createTools:{defaultPriority:T.High,groupKind:"more-button",overflowLabel:"drawing"},undoRedo:{defaultPriority:T.Medium,groupKind:"split-button",overflowLabel:"action",preferEndSlot:!0},settings:{defaultPriority:T.Max,groupKind:"more-button",overflowLabel:"action",preferEndSlot:!0},geometrySimplification:{defaultPriority:T.Default,groupKind:"actions",preferEndSlot:!0}},_e=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,d=(i,e,t,o)=>{for(var s=o>1?void 0:o?Me(e,t):e,a=i.length-1,c;a>=0;a--)(c=i[a])&&(s=(o?c(e,t,s):c(s))||s);return o&&s&&_e(e,t,s),s},h=class extends be{constructor(i){super(i),this._effectiveRenderStateCache=new Map,this._effectiveGeometrySimplificationInProgress=!1,this.visibleElements=new Ce,this.settingsPopoverOpen=!1,this.availableCreateTools=["point","polyline","freehandPolyline","polygon","freehandPolygon","rectangle","circle"]}initialize(){this.selectionViewModel??=new we({persistSelection:!1}),this.addHandles([y(()=>this.sketchViewModel,(i,e)=>{i!==e&&this._effectiveRenderStateCache.clear()},{sync:!0}),ie({getLoading:()=>this.sketchViewModel?.geometrySimplificationInProgress??!1,setEffectiveLoading:i=>{this._effectiveGeometrySimplificationInProgress=i}}),y(()=>this.view,i=>{this.selectionViewModel.view=i},{initial:!0,sync:!0}),y(()=>this.sketchViewModel?.layer,i=>this.selectionViewModel.sources=i?[i]:[],{initial:!0,sync:!0}),this.selectionViewModel.on("complete",({selection:i})=>{let{sketchViewModel:e}=this;if(i.length&&e){let{defaultUpdateOptions:t}=e,{tool:o}=t;this.update(i,{...t,tool:i.length>1&&o==="reshape"?"transform":o})}}),y(()=>this.selectionViewModel.activeOperation,i=>{i&&(this.sketchViewModel?.cancel(),this._activeCustomToolOptions=void 0)},{sync:!0}),ue(()=>this.sketchViewModel,"create",i=>{i.state==="complete"&&this.sketchViewModel?.creationMode!=="continuous"&&(this._activeCustomToolOptions=void 0)}),y(()=>this.visibleElements.settingsMenu,i=>{i||(this.settingsPopoverOpen=!1)},{sync:!0})])}destroy(){this._pendingCommandAbortController?.abort(),this.selectionViewModel.destroy(),this.sketchViewModel=void 0}get _isEffectiveRenderStateFrozen(){let{sketchViewModel:i}=this;return!!(i?.toolTransitionInProgress||i?.geometrySimplificationInProgress)}_getEffectiveValue(i,e){if(!this._isEffectiveRenderStateFrozen||!this._effectiveRenderStateCache.has(i)){let t=e();return this._effectiveRenderStateCache.set(i,t),t}return this._effectiveRenderStateCache.get(i)}get _state(){return this.sketchViewModel?.state??"disabled"}get test(){return{activeCustomToolOptions:this._activeCustomToolOptions,activeSelectionTool:this._activeSelectionTool,selectionViewModel:this.selectionViewModel}}get _activeSelectionTool(){switch(this.selectionViewModel.activeOperation?.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";default:return}}get _activePluginUniqueIds(){let i=this.sketchViewModel?.activePluginConfigurations.filter(e=>!e.hidden).map(e=>e.uniqueId);return new Set(i??[])}get _createToolActions(){let{sketchViewModel:i}=this;if(!i)return[];let e=i.effectiveAvailablePlugins,t=this.state==="disabled",o=this.visibleElements.createTools,s=this.activeTool,a=this._activeCustomToolOptions,c=a||!i.firstPluginWithSwappableLeaf?this._customToolOptions:[],r=i.rootPlugins,n=c?.map(l=>({active:l===a,disabled:t,icon:l.icon,labelKey:l.label,onClick:l===a?()=>this._cancelActiveOperation():()=>this._activateLegacyDrawTool(l.toolName,l.createOptions,l)}))??[];if(a&&r)return[...this._pluginsToActions(r),...n];if(e?.length&&this.view?.type!=="3d")return[...this._pluginsToActions(e),...n];let g=this.view?.type==="3d";return[...this.availableCreateTools?.filter(l=>g&&l==="multipoint"?!1:l==="mesh"?!0:o[l])?.map(l=>({active:l===s,disabled:t,icon:Se[l],labelKey:`draw.${l}`,onClick:l===s?()=>this._cancelActiveOperation():()=>this._activateLegacyDrawTool(l)}))??[],...n]}get _shouldShowBackButton(){let i=this.sketchViewModel?.firstPluginWithSwappableLeaf,e=this.sketchViewModel?.rootPlugins,t=this._activeCustomToolOptions;return!!(this.sketchViewModel?.multiplePluginsActive&&i&&e&&!(e.length<2&&e.includes(i)&&!this.visibleElements.singlePluginBackButton)&&!t)}get _selectionToolActions(){return this._shouldShowBackButton?[{active:!1,disabled:this.state==="disabled",icon:"chevron-left",iconFlipRTL:!0,labelKey:"back",onClick:()=>this._cancelActiveOperation()}]:this._selectionCommands}get _settingsActions(){let i=this._customActions?.get("settings-before"),e=this._customActions?.get("settings-after"),t=this.visibleElements.settingsMenu,o=[];return!i?.length&&!e?.length&&!t||(i&&o.push(...this._customActionsToSketchActions(i)),t&&o.push({icon:"gear",active:this.settingsPopoverOpen,disabled:this.state==="disabled",labelKey:"settings.heading",tooltipKey:"settings.heading",refKey:"settings",onClick:()=>this.toggleSettingsPopover()}),e&&o.push(...this._customActionsToSketchActions(e))),o}get _activeTool(){let i=this.selectionViewModel.activeOperation;if(i)switch(i.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}if(!this.sketchViewModel)return;let{availableCreateTools:e}=this,{activeTool:t,activeCreateToolDrawMode:o}=this.sketchViewModel;return t==="polygon"&&o==="freehand"&&e?.includes("freehandPolygon")?"freehandPolygon":t==="polyline"&&o==="freehand"&&e?.includes("freehandPolyline")?"freehandPolyline":t??void 0}get _selectionCommands(){let{state:i,visibleElements:e,_activeSelectionTool:t,_customActions:o}=this,s=this.state==="disabled",a=[];this.sketchViewModel?.updateOnGraphicClick!==!1&&a.push({active:i==="ready"&&this._activeSelectionTool==null,disabled:s,icon:"cursor",labelKey:"selectFeature",onClick:()=>this._activateDefaultSelectionTool()});let c=e.selectionTools;c["rectangle-selection"]&&a.push({active:t==="rectangle-selection",disabled:s,icon:"cursor-marquee",labelKey:"rectangleSelection",onClick:()=>this._activateSelectionTool("rectangle-selection")}),c["lasso-selection"]&&a.push({active:t==="lasso-selection",disabled:s,icon:"lasso-select",labelKey:"lassoSelection",onClick:()=>this._activateSelectionTool("lasso-selection")});let r=o?.get("selection-toolbar");return r&&a.push(...this._customActionsToSketchActions(r)),a}get _selectionSetActions(){let i=this.sketchViewModel?.updateGraphics.length??0;if(!i)return[];let e=this.state==="disabled",t=[],o=this._customActions?.get("before-selection-set"),s=this._customActions?.get("after-selection-set");return this.visibleElements.selectionCountLabel&&t.push({active:!1,appearance:"outline",disabled:e,icon:"selection-x",kind:"brand",labelKey:"deselectCount",labelParameters:{count:i},textEnabled:!0,renderAsAction:!0,onClick:()=>this._cancelSketchOperation()}),o&&t.push(...this._customActionsToSketchActions(o)),this.visibleElements.duplicateButton&&t.push({active:!1,disabled:e,icon:"copy",renderAsAction:!0,labelKey:i>1?"duplicateFeatures":"duplicateFeature",onClick:()=>this._duplicate()}),this.visibleElements.deleteButton&&t.push({active:!1,disabled:e,icon:"trash",kind:"danger",renderAsAction:!0,labelKey:i>1?"deleteFeatures":"deleteFeature",onClick:()=>this._delete()}),s&&t.push(...this._customActionsToSketchActions(s)),t}get _undoRedoActions(){return this.visibleElements.undoRedoMenu?[{active:!1,disabled:this.state==="disabled"||!this.sketchViewModel?.canUndo(),icon:"undo",labelKey:"undo",iconFlipRTL:!0,onClick:()=>this._undo()},{active:!1,disabled:this.state==="disabled"||!this.sketchViewModel?.canRedo(),icon:"redo",labelKey:"redo",iconFlipRTL:!0,onClick:()=>this._redo()}]:[]}get state(){return this._getEffectiveValue("state",()=>this._state)}get activeTool(){return this._getEffectiveValue("activeTool",()=>this._activeTool)}get activePluginIds(){return this._getEffectiveValue("activePluginId",()=>this._activePluginUniqueIds)}get groupedActions(){let i=this._getEffectiveValue("availableCommandGroups",()=>[["selectionTools",this._selectionToolActions],["createTools",this._createToolActions],["undoRedo",this._undoRedoActions],["settings",this._settingsActions],["selectionSet",this._selectionSetActions]].map(([t,o])=>({name:t,commands:o,visible:o.length>0}))),e=this._effectiveGeometrySimplificationInProgress?i.map(t=>({...t,commands:t.commands.map(o=>({...o,disabled:!0}))})):i;return!this.visibleElements.geometrySimplificationActivityIndicator||!this._effectiveGeometrySimplificationInProgress?e:[...e,{name:"geometrySimplification",commands:[{active:!1,appearance:"transparent",disabled:!0,kind:"warning",labelKey:"processing",loading:!0,onClick:()=>{},renderAsAction:!0}],visible:!0}]}async create(i,e){await this._executeWhenReady(async()=>{this.cancelAll();let t=this.sketchViewModel;t&&await E(t.create(i,e))})}async _executeWhenReady(i){this._pendingCommandAbortController?.abort();let e=new AbortController;this._pendingCommandAbortController=e;try{await E((async()=>{this.sketchViewModel?.geometrySimplificationInProgress&&await me(()=>!this.sketchViewModel?.geometrySimplificationInProgress,e.signal),e.signal.aborted||await i()})())}finally{this._pendingCommandAbortController===e&&(this._pendingCommandAbortController=void 0)}}toggleSettingsPopover(){this.settingsPopoverOpen=!this.settingsPopoverOpen}setCustomTools(i,e){this._customToolOptions=i??void 0;let t=this._activeCustomToolOptions;if(t){let o=this._customToolOptions?.find(s=>s.toolKey===t.toolKey);o?this._activeCustomToolOptions=o:this.cancelAll()}if(e?.length){let o=new Map;for(let s of e)ae(o,s.position,()=>[]).push(s);this._customActions=o}else this._customActions=void 0}cancelAll(){this._pendingCommandAbortController?.abort(),this._cancelSupportingOperations(),this.sketchViewModel?.cancel()}async update(i,e){await this._executeWhenReady(async()=>{let t=this.sketchViewModel;t&&await E(t.update(i,e))})}_activateDefaultSelectionTool(){this._executeWhenReady(()=>{this.cancelAll(),this.view?.focus()})}_cancelActiveOperation(){this._executeWhenReady(()=>this.cancelAll())}_cancelSketchOperation(){this._executeWhenReady(()=>this.sketchViewModel?.cancel())}_cancelSupportingOperations(){this.selectionViewModel.cancel(),this._activeCustomToolOptions=void 0}_activatePlugin(i){this._executeWhenReady(()=>{let e=this._activeCustomToolOptions!=null;this._cancelSupportingOperations();let t=this.sketchViewModel;if(t){if(e){t.cancel(),E(t.create(i));return}t.firstPluginWithSwappableLeaf?(t.replaceLeaf(i),this.view?.focus()):E(t.create(i))}})}_activateLegacyDrawTool(i,e,t){this._executeWhenReady(()=>{this._cancelSupportingOperations();let o=this.sketchViewModel;o&&(this._activeCustomToolOptions=t,E(o.create(i,e)))})}_activateSelectionTool(i){this._executeWhenReady(()=>{if(this._activeSelectionTool===i){this.selectionViewModel.cancel();return}this.cancelAll();let e={createTool:i==="lasso-selection"?"polygon":"rectangle",...i==="lasso-selection"?{mode:"hybrid",toolName:"lasso"}:{toolName:"rectangle"},type:"replace",selectOnComplete:!0};this.selectionViewModel.activate(e)&&this.view?.focus()})}_delete(){this._executeWhenReady(()=>this.sketchViewModel?.delete())}_duplicate(){this._executeWhenReady(()=>{this.sketchViewModel?.duplicate()})}_executeCustomAction(i){this._executeWhenReady(()=>i.onclick?.())}_redo(){this._executeWhenReady(()=>{this.sketchViewModel?.redo()})}_undo(){this._executeWhenReady(()=>{this.sketchViewModel?.undo()})}_customActionsToSketchActions(i){let e=this.state==="disabled";return i.map(t=>({active:t.active??!1,afterCreate:t.afterCreate,afterRemoved:t.afterRemoved,afterUpdate:t.afterUpdate,disabled:e||(t.disabled??!1),icon:t.icon,iconFlipRTL:t.flipRTL,id:t.id,labelKey:t.text,onClick:()=>this._executeCustomAction(t)}))}_pluginsToActions(i){let e=this.activePluginIds,t=this._activeCustomToolOptions,o=this.state==="disabled";return i.map(s=>({active:(e?.has(s.uniqueId)??!1)&&!t,icon:s.icon,disabled:o,labelKey:`digitizers.${s.localizationKey}`,onClick:()=>this._activatePlugin([s])}))}};d([p()],h.prototype,"_isEffectiveRenderStateFrozen",1);d([p()],h.prototype,"_effectiveGeometrySimplificationInProgress",2);d([p()],h.prototype,"_state",1);d([p()],h.prototype,"_customToolOptions",2);d([p()],h.prototype,"_activeCustomToolOptions",2);d([p()],h.prototype,"_customActions",2);d([p()],h.prototype,"selectionViewModel",2);d([p()],h.prototype,"_activeSelectionTool",1);d([p()],h.prototype,"_activePluginUniqueIds",1);d([p()],h.prototype,"_createToolActions",1);d([p()],h.prototype,"_shouldShowBackButton",1);d([p()],h.prototype,"_selectionToolActions",1);d([p()],h.prototype,"_settingsActions",1);d([p()],h.prototype,"_activeTool",1);d([p()],h.prototype,"_selectionCommands",1);d([p()],h.prototype,"_selectionSetActions",1);d([p()],h.prototype,"_undoRedoActions",1);d([p()],h.prototype,"sketchViewModel",2);d([p()],h.prototype,"visibleElements",2);d([p()],h.prototype,"view",2);d([p()],h.prototype,"settingsPopoverOpen",2);d([p()],h.prototype,"availableCreateTools",2);d([p()],h.prototype,"state",1);d([p()],h.prototype,"activeTool",1);d([p()],h.prototype,"activePluginIds",1);d([p()],h.prototype,"groupedActions",1);h=d([fe("components.sketch.SketchComponentViewModel")],h);var x=class extends q{#t;#e=!1;#i;constructor(e){if(super(e),e.type!==N.ELEMENT)throw new Error("nodeHooks() can only be used on elements")}render(e){return O}update(e,[t]){let o=e.element;if(!(o instanceof HTMLElement))throw new TypeError("nodeHooks() can only be used on HTMLElements");let s=this.#e?t.afterUpdate:t.afterCreate;return this.#t=o,this.#e=!0,this.#i=t,queueMicrotask(()=>{o.isConnected&&s?.(o)}),O}disconnected(){let e=this.#t,t=this.#i?.afterRemoved;!e||!t||queueMicrotask(()=>{e.isConnected||Z(()=>t(e),{timeout:16})})}},ne=H(x),ke=new Set(["arcgis-map","arcgis-scene"]),Pe=8,R=class extends U{constructor(e){super(e),this.#t=new MutationObserver(()=>this.#c()),this.#e=new ResizeObserver(()=>this.#v()),this.#i=new ResizeObserver(([t])=>{if(!t)return;let o=this.component.layout==="horizontal"?t.contentRect.height:t.contentRect.width;o!==this.#s&&(this.#s=o,this.#v())}),this.#h=[],this.ref=t=>{this.#o!==t&&(this.#o=t,this.#a=void 0,this.#r=void 0,this.#c())},this.#u=()=>this.#c(),this.exports=void 0,e.listenOn(window,"resize",()=>this.#g()),this.onConnected(()=>this.#g()),this.onUpdated(()=>{(this.#d!==this.component.layout||this.#y!==this.component.toolbarKind)&&this.#c()}),this.onDisconnected(()=>this.#C()),this.onLifecycle(()=>y(()=>this.component.view?.attributionHeight,()=>{this.#g()},{initial:!0}))}#t;#e;#i;#l;#s;#n;#h;#m;#o;#a;#r;#d;#y;#p;#g(){queueMicrotask(()=>{this.component.el.isConnected&&this.#c()})}#c(){this.#y=this.component.toolbarKind;let e=this.#b();if(this.component.el.toggleAttribute("data-intrinsic-toolbar-sizing",!e),!e){this.#f(),this.#C();return}this.#w(e.toolbar),this.#T(e),this.#S(e),this.#v(e)}#b(){let e=this.component.el,t=e.parentElement,o=this.#o,s=e.assignedSlot;if(!t||!ke.has(t.localName)||!o||!s?.parentElement)return;let a=getComputedStyle(t).direction==="rtl"?"rtl":"ltr",c=re(e.slot,a);if(!c)return;let r=Array.from(t.children).filter(n=>n instanceof HTMLElement&&n.localName!=="arcgis-sketch");return{assignedSlot:s,content:r,direction:a,parent:t,position:c,toolbar:o}}#u;#w(e){this.#d!==this.component.layout&&(this.#s=void 0,this.#d=this.component.layout),this.#l!==e&&(this.#i.disconnect(),this.#l=e,this.#s=void 0,this.#i.observe(e))}#T(e){let t=e.assignedSlot;this.#n!==t&&(this.#n?.removeEventListener("slotchange",this.#u),this.#n=t,t.addEventListener("slotchange",this.#u)),this.#m!==e.parent&&(this.#t.disconnect(),this.#p?.(),this.#m=e.parent,this.#p=Q(e.parent,["dir"],()=>{this.#g()}),this.#t.observe(e.parent,{childList:!0,subtree:!1}))}#S(e){let t=[e.parent,...e.content];Ae(this.#h,t)||(this.#e.disconnect(),t.forEach(o=>this.#e.observe(o)),this.#h=t)}#v(e=this.#b()){if(!e){this.#f();return}let t=this.component.layout,o=e.parent.getBoundingClientRect(),s=Le({content:Oe(e),gap:Pe,layout:t,position:e.position,sameSlotReserve:Ge(e.assignedSlot,this.component.el,t,e.assignedSlot),toolbarBounds:e.toolbar.getBoundingClientRect(),viewBounds:o}),a=s;if(e.toolbar.toolbarKind==="floating"){let c=getComputedStyle(e.assignedSlot.parentElement.parentElement),r=Math.max(Number.parseFloat(c.marginLeft),Number.parseFloat(c.marginRight)),n=t==="horizontal"?window.innerWidth:window.innerHeight,g=t==="horizontal"?o.width:o.height,l=t==="vertical"?this.component.view?.attributionHeight??0:0;a=Math.max(0,Math.min(s,g-2*r-l,n-2*r))}this.#E(e.toolbar,t,s,a)}#E(e,t,o,s){o===this.#a&&s===e.allocatedLength&&t===this.#r||(this.#a=o,this.#r=t,e.allocatedLength=s,t==="horizontal"?(e.style.height="",e.style.maxHeight="",e.style.maxWidth=`${o}px`,e.style.width="fit-content"):(e.style.height="fit-content",e.style.maxHeight=`${o}px`,e.style.maxWidth="",e.style.width=""))}#f(){this.#o&&(this.#o.style.maxHeight="",this.#o.style.maxWidth="",this.#o.style.height="",this.#o.style.width="",this.#o.allocatedLength=void 0,this.#a=void 0,this.#r=void 0)}#C(){this.#t.disconnect(),this.#p?.(),this.#p=void 0,this.#e.disconnect(),this.#i.disconnect(),this.#l=void 0,this.#s=void 0,this.#h=[],this.#n?.removeEventListener("slotchange",this.#u),this.#n=void 0,this.#a=void 0,this.#r=void 0,this.#d=void 0,this.#m=void 0}};function Le({content:i,gap:e,layout:t,position:o,sameSlotReserve:s,toolbarBounds:a,viewBounds:c}){let r=G(c,t),n=G(a,t),g=le(o,t),l=g?n.start-r.start:r.end-n.end,u=0,b=!1;for(let C of i){if(le(C.position,t)===g)continue;let m=G(C.bounds,t);if(!(m.crossStart<n.crossEnd&&m.crossEnd>n.crossStart))continue;let S=g?r.end-m.start:m.end-r.start;u=Math.max(u,S),b=!0}let f=b?e:0;return Math.max(0,r.length-Math.max(0,l)-s-u-f)}function G(i,e){return e==="horizontal"?{start:i.left,end:i.right,length:i.width,crossStart:i.top,crossEnd:i.bottom}:{start:i.top,end:i.bottom,length:i.height,crossStart:i.left,crossEnd:i.right}}function le(i,e){return e==="horizontal"?i.endsWith("left"):i.startsWith("top")}function Oe(i){return i.content.flatMap(e=>{if(e.assignedSlot===i.assignedSlot)return[];let t=re(e.slot,i.direction);return t?[{bounds:e.getBoundingClientRect(),position:t}]:[]})}function Ae(i,e){return i.length===e.length&&i.every((t,o)=>t===e[o])}function Ge(i,e,t,o){let s=getComputedStyle(o),a=s.flexDirection;if(!(t==="horizontal"?a.startsWith("row"):a.startsWith("column")))return 0;let c=i.assignedElements().filter(b=>b instanceof HTMLElement),r=c.indexOf(e);if(r<0)return 0;let n=getComputedStyle(e),g=a==="row"?Number.parseFloat(n.marginRight):a==="row-reverse"?Number.parseFloat(n.marginLeft):a==="column"?Number.parseFloat(n.marginBottom):Number.parseFloat(n.marginTop),l=c.slice(r+1),u=Number.parseFloat(t==="horizontal"?s.columnGap:s.rowGap);return l.reduce((b,f)=>{let C=f.getBoundingClientRect(),m=getComputedStyle(f),S=t==="horizontal"?C.width+Number.parseFloat(m.marginLeft)+Number.parseFloat(m.marginRight):C.height+Number.parseFloat(m.marginTop)+Number.parseFloat(m.marginBottom);return b+S+u},g)}function re(i,e){let[t,o]=i.split("-");if(t!=="bottom"&&t!=="top")return;let s=o==="start"?e==="ltr"?"left":"right":o==="end"?e==="ltr"?"right":"left":o;return s==="left"||s==="right"?`${t}-${s}`:void 0}var xe=["bottom-end","bottom-start","bottom-left","bottom-right","top-end","top-start","top-left","top-right"],Re=new Set(xe),$e=te(i=>new ve({...i,cancelUpdateOnClickAway:!0,creationMode:"continuous",textSymbol:new ge({text:"text"}),useLegacyCreateTools:!1})),$=class extends j{constructor(){super(),this.#t=new h,this.#l=k(),this.#s=new R(this),this.#n=k(),this._defaultGraphicsLayer=null,this._messages=ee(),this.test={componentViewModel:this.#t},this._groupLayoutPriorityOverrides=new Map,this._contextualToolLocation="separate",this._refMap=ye(),this.viewModel=$e(this),this.view=this.viewModel.view,this.autoDestroyDisabled=!1,this.createGraphic=this.viewModel.createGraphic,this.creationMode=this.viewModel.creationMode,this.defaultCreateOptions=this.viewModel.defaultCreateOptions,this.defaultGraphicsLayerDisabled=!1,this.defaultUpdateOptions=this.viewModel.defaultUpdateOptions,this.geometrySimplificationInProgress=this.viewModel.geometrySimplificationInProgress,this.icon="pencil",this.label=this._messages?.componentLabel,this.labelOptions=this.viewModel.labelOptions,this.layer=this.viewModel.layer,this.layout="horizontal",this.pointSymbol=this.viewModel.pointSymbol,this.polygonSymbol=this.viewModel.polygonSymbol,this.polylineSymbol=this.viewModel.polylineSymbol,this.activeFillSymbol=this.viewModel.activeFillSymbol,this.activeLineSymbol=this.viewModel.activeLineSymbol,this.activeVertexSymbol=this.viewModel.activeVertexSymbol,this.activeCreateToolDrawMode=this.viewModel.activeCreateToolDrawMode,this.visualScale="m",this.snappingOptions=this.viewModel.snappingOptions,this.textSymbol=this.viewModel.textSymbol,this.toolbarKind="floating",this.tooltipOptions=this.viewModel.tooltipOptions,this.useViewOptions=this.viewModel.useViewOptions,this.valueOptions=this.viewModel.valueOptions,this.useLegacyCreateTools=this.viewModel.useLegacyCreateTools,this.updateOnGraphicClickDisabled=this.viewModel.updateOnGraphicClick,this.updateGraphics=this.viewModel.updateGraphics,this.activeTooltip=this.viewModel.activeTooltip,this.arcgisCreate=w(()=>this.viewModel,"create"),this.arcgisDelete=w(()=>this.viewModel,"delete"),this.arcgisDuplicate=w(()=>this.viewModel,"duplicate"),this.arcgisPropertyChange=Y()("activeTool","geometrySimplificationInProgress","state"),this.arcgisReady=W(),this.arcgisRedo=w(()=>this.viewModel,"redo"),this.arcgisUndo=w(()=>this.viewModel,"undo"),this.arcgisUpdate=w(()=>this.viewModel,"update"),X(["slot"],()=>{this.requestUpdate()}),this.manager.onLifecycle(()=>[y(()=>this.el.view?.map,(e,t)=>{let o=this._defaultGraphicsLayer;o&&(t?.allLayers.includes(o)&&t.remove(o),o&&!e?.allLayers.includes(o)&&e?.add(o))}),y(()=>this.el.view,e=>{this.viewModel.view=e,this.#t.view=e??void 0},{initial:!0}),y(()=>this.viewModel,e=>{this.#t.sketchViewModel=e,this.viewModel.pluginManager.sketch=this},{initial:!0}),y(()=>this.#t.state,(e,t)=>{this.requestUpdate("state",t)},{initial:!0}),y(()=>this.#t.activeTool,()=>this.arcgisPropertyChange.emit({name:"activeTool"}),{sync:!0})]),this.manager.onDestroy(()=>{this._defaultGraphicsLayer&&this.el.view?.map?.allLayers.includes(this._defaultGraphicsLayer)&&this.el.view?.map?.remove(this._defaultGraphicsLayer),this._defaultGraphicsLayer?.destroy(),this._defaultGraphicsLayer=null,this.#t.destroy()})}static{this.properties={_groupLayoutPriorityOverrides:16,_contextualToolLocation:16,_refMap:16,viewModel:0,view:0,activeTool:32,autoDestroyDisabled:5,visibleElements:0,availableCreateTools:0,createGraphic:32,creationMode:1,defaultCreateOptions:0,defaultGraphicsLayerDisabled:5,defaultUpdateOptions:0,geometrySimplificationInProgress:36,hideCreateToolsCircle:5,hideCreateToolsMultipoint:5,hideCreateToolsPoint:5,hideCreateToolsPolygon:5,hideCreateToolsPolyline:5,hideCreateToolsRectangle:5,hideDuplicateButton:5,hideDeleteButton:5,hideSelectionCountLabel:5,hideLabelsToggle:5,hideSelectionToolsLassoSelection:5,hideSelectionToolsRectangleSelection:5,hideSettingsMenu:5,hideSinglePluginBackButton:5,hideSnappingControls:5,hideSnappingControlsElementsEnabledToggle:5,hideSnappingControlsElementsFeatureEnabledToggle:5,hideSnappingControlsElementsLayerList:5,hideSnappingControlsElementsSelfEnabledToggle:5,hideSnappingControlsElementsGridEnabledToggle:5,hideSnappingControlsElementsGridControls:5,hideSnappingControlsElementsGridControlsElementsColorSelection:5,hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle:5,hideSnappingControlsElementsGridControlsElementsLineIntervalInput:5,hideSnappingControlsElementsGridControlsElementsNumericInputs:5,hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning:5,hideSnappingControlsElementsGridControlsElementsPlacementButtons:5,hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle:5,hideTooltipsToggle:5,hideUndoRedoMenu:5,icon:1,label:1,labelOptions:0,layer:0,layout:3,pointSymbol:0,polygonSymbol:0,polylineSymbol:0,activeFillSymbol:0,activeLineSymbol:0,activeVertexSymbol:0,activeCreateToolDrawMode:1,referenceElement:1,relativePosition:1,scale:1,visualScale:1,showSnappingControlsElementsHeader:5,showCreateToolsFreehandPolygon:5,showCreateToolsFreehandPolyline:5,showCreateToolsText:5,hideGeometrySimplificationActivityIndicator:5,snappingOptions:0,state:32,textSymbol:0,toolbarKind:3,tooltipOptions:0,useViewOptions:5,valueOptions:0,useLegacyCreateTools:5,updateOnGraphicClickDisabled:5,cancelUpdateOnClickAwayDisabled:5,updateGraphics:32,activeTooltip:0}}static{this.styles=Te}#t;get#e(){return this.#t.visibleElements}#i;#l;#s;#n;get activeTool(){return this.#t.activeTool}get visibleElements(){return this.#t.visibleElements}set visibleElements(e){this.#t.visibleElements=e}get availableCreateTools(){return this.#t.availableCreateTools}set availableCreateTools(e){this.#t.availableCreateTools=e}get hideCreateToolsCircle(){return!this.#e.createTools.circle}set hideCreateToolsCircle(e){this.#e.createTools.circle=!e}get hideCreateToolsMultipoint(){return!this.#e.createTools.multipoint}set hideCreateToolsMultipoint(e){this.#e.createTools.multipoint=!e}get hideCreateToolsPoint(){return!this.#e.createTools.point}set hideCreateToolsPoint(e){this.#e.createTools.point=!e}get hideCreateToolsPolygon(){return!this.#e.createTools.polygon}set hideCreateToolsPolygon(e){this.#e.createTools.polygon=!e}get hideCreateToolsPolyline(){return!this.#e.createTools.polyline}set hideCreateToolsPolyline(e){this.#e.createTools.polyline=!e}get hideCreateToolsRectangle(){return!this.#e.createTools.rectangle}set hideCreateToolsRectangle(e){this.#e.createTools.rectangle=!e}get hideDuplicateButton(){return!this.#e.duplicateButton}set hideDuplicateButton(e){this.#e.duplicateButton=!e}get hideDeleteButton(){return!this.#e.deleteButton}set hideDeleteButton(e){this.#e.deleteButton=!e}get hideSelectionCountLabel(){return!this.#e.selectionCountLabel}set hideSelectionCountLabel(e){this.#e.selectionCountLabel=!e}get hideLabelsToggle(){return!this.#e.labelsToggle}set hideLabelsToggle(e){this.#e.labelsToggle=!e}get hideSelectionToolsLassoSelection(){return!this.#e.selectionTools["lasso-selection"]}set hideSelectionToolsLassoSelection(e){this.#e.selectionTools["lasso-selection"]=!e}get hideSelectionToolsRectangleSelection(){return!this.#e.selectionTools["rectangle-selection"]}set hideSelectionToolsRectangleSelection(e){this.#e.selectionTools["rectangle-selection"]=!e}get hideSettingsMenu(){return!this.#e.settingsMenu}set hideSettingsMenu(e){this.#e.settingsMenu=!e}get hideSinglePluginBackButton(){return!this.#e.singlePluginBackButton}set hideSinglePluginBackButton(e){this.#e.singlePluginBackButton=!e}get hideSnappingControls(){return!this.#e.snappingControls}set hideSnappingControls(e){this.#e.snappingControls=!e}get hideSnappingControlsElementsEnabledToggle(){return!this.#e.snappingControlsElements.enabledToggle}set hideSnappingControlsElementsEnabledToggle(e){this.#e.snappingControlsElements.enabledToggle=!e}get hideSnappingControlsElementsFeatureEnabledToggle(){return!this.#e.snappingControlsElements.featureEnabledToggle}set hideSnappingControlsElementsFeatureEnabledToggle(e){this.#e.snappingControlsElements.featureEnabledToggle=!e}get hideSnappingControlsElementsLayerList(){return!this.#e.snappingControlsElements.layerList}set hideSnappingControlsElementsLayerList(e){this.#e.snappingControlsElements.layerList=!e}get hideSnappingControlsElementsSelfEnabledToggle(){return!this.#e.snappingControlsElements.selfEnabledToggle}set hideSnappingControlsElementsSelfEnabledToggle(e){this.#e.snappingControlsElements.selfEnabledToggle=!e}get hideSnappingControlsElementsGridEnabledToggle(){return!this.#e.snappingControlsElements.gridEnabledToggle}set hideSnappingControlsElementsGridEnabledToggle(e){this.#e.snappingControlsElements.gridEnabledToggle=!e}get hideSnappingControlsElementsGridControls(){return!this.#e.snappingControlsElements.gridControls}set hideSnappingControlsElementsGridControls(e){this.#e.snappingControlsElements.gridControls=!e}get hideSnappingControlsElementsGridControlsElementsColorSelection(){return!this.#e.snappingControlsElements.gridControlsElements.colorSelection}set hideSnappingControlsElementsGridControlsElementsColorSelection(e){this.#e.snappingControlsElements.gridControlsElements.colorSelection=!e}get hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle(){return!this.#e.snappingControlsElements.gridControlsElements.dynamicScaleToggle}set hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle(e){this.#e.snappingControlsElements.gridControlsElements.dynamicScaleToggle=!e}get hideSnappingControlsElementsGridControlsElementsLineIntervalInput(){return!this.#e.snappingControlsElements.gridControlsElements.lineIntervalInput}set hideSnappingControlsElementsGridControlsElementsLineIntervalInput(e){this.#e.snappingControlsElements.gridControlsElements.lineIntervalInput=!e}get hideSnappingControlsElementsGridControlsElementsNumericInputs(){return!this.#e.snappingControlsElements.gridControlsElements.numericInputs}set hideSnappingControlsElementsGridControlsElementsNumericInputs(e){this.#e.snappingControlsElements.gridControlsElements.numericInputs=!e}get hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning(){return!this.#e.snappingControlsElements.gridControlsElements.outOfScaleWarning}set hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning(e){this.#e.snappingControlsElements.gridControlsElements.outOfScaleWarning=!e}get hideSnappingControlsElementsGridControlsElementsPlacementButtons(){return!this.#e.snappingControlsElements.gridControlsElements.placementButtons}set hideSnappingControlsElementsGridControlsElementsPlacementButtons(e){this.#e.snappingControlsElements.gridControlsElements.placementButtons=!e}get hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle(){return!this.#e.snappingControlsElements.gridControlsElements.rotateWithMapToggle}set hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle(e){this.#e.snappingControlsElements.gridControlsElements.rotateWithMapToggle=!e}get hideTooltipsToggle(){return!this.#e.tooltipsToggle}set hideTooltipsToggle(e){this.#e.tooltipsToggle=!e}get hideUndoRedoMenu(){return!this.#e.undoRedoMenu}set hideUndoRedoMenu(e){this.#e.undoRedoMenu=!e}get relativePosition(){let e=this.el.slot||this.el.closest("arcgis-expand")?.slot||"";return this.#i??(Re.has(e)?e:oe.topRight)}set relativePosition(e){this.#i=e}get scale(){return this.visualScale}set scale(e){this.visualScale=e}get showSnappingControlsElementsHeader(){return this.#e.snappingControlsElements.header}set showSnappingControlsElementsHeader(e){this.#e.snappingControlsElements.header=e}get showCreateToolsFreehandPolygon(){return this.#e.createTools.freehandPolygon}set showCreateToolsFreehandPolygon(e){this.#e.createTools.freehandPolygon=e}get showCreateToolsFreehandPolyline(){return this.#e.createTools.freehandPolyline}set showCreateToolsFreehandPolyline(e){this.#e.createTools.freehandPolyline=e}get showCreateToolsText(){return this.#e.createTools.text}set showCreateToolsText(e){this.#e.createTools.text=e}get hideGeometrySimplificationActivityIndicator(){return!this.#e.geometrySimplificationActivityIndicator}set hideGeometrySimplificationActivityIndicator(e){this.#e.geometrySimplificationActivityIndicator=!e}get state(){return this.#t.state}get cancelUpdateOnClickAwayDisabled(){return!this.viewModel.cancelUpdateOnClickAway}set cancelUpdateOnClickAwayDisabled(e){this.viewModel.cancelUpdateOnClickAway=!e}async addGraphic(e){this.viewModel.addGraphic(e)}async addGraphics(e){this.viewModel.addGraphics(e)}async cancel(){this.#t.cancelAll()}async complete(){this.viewModel.complete()}async create(e,t){await this.#t.create(e,t)}async delete(){this.viewModel.delete()}async destroy(){await this.manager.destroy()}async dismissFloatingElements(){this.#t.settingsPopoverOpen=!1}async duplicate(){this.viewModel.duplicate()}async hasGraphic(e){return this.viewModel.hasGraphic(e)}async removeAllGraphics(){this.viewModel.removeAllGraphics()}async removeGraphic(e){this.viewModel.removeGraphic(e)}async removeGraphics(e){this.viewModel.removeGraphics(e)}async redo(){this.viewModel.redo()}async canRedo(){return this.viewModel.canRedo()}async setContextualToolLocation(e){this._contextualToolLocation=e}async setCustomTools(e,t){this.#t.setCustomTools(e,t)}async setGroupCollapsePriorities(e){this._groupLayoutPriorityOverrides=e||new Map}async triggerUpdate(e,t){await this.#t.update(e,t)}async place(e){this.viewModel.place(e)}async undo(){this.#t.sketchViewModel?.undo()}async canUndo(){return this.viewModel.canUndo()}connectedCallback(){super.connectedCallback(),this.defaultGraphicsLayerDisabled||(this._defaultGraphicsLayer?.destroyed&&(this._defaultGraphicsLayer=null),this._defaultGraphicsLayer??=new pe({title:"Sketch Layer"}),this.layer=this._defaultGraphicsLayer,this.view?.map?.add(this.layer),this.viewModel.layer=this._defaultGraphicsLayer)}disconnectedCallback(){this._defaultGraphicsLayer&&this.view?.map?.allLayers.includes(this._defaultGraphicsLayer)&&this.view?.map?.remove(this._defaultGraphicsLayer),this.cancel(),super.disconnectedCallback()}render(){let e=this._refMap.get("settings")?.value?.actionElement,t=this.#t.groupedActions,{visualScale:o,layout:s,toolbarKind:a,relativePosition:c,_contextualToolLocation:r}=this,n=t.find(({name:l})=>l==="selectionSet"),g=t.filter(({name:l})=>l!=="selectionSet");return v`<div class="toolbar-container"><arcgis-toolbar-stack .layout=${s} .toolbarKind=${a} .relativePosition=${c} .scale=${o} tooltip-appearance=calcite ${_(this.#s.ref)}><arcgis-toolbar ${_(this.#l)}>${M({hidden:!n?.visible||r!=="inline",children:this._renderActionGroup(n)})}${g.map(l=>this._renderActionGroup(l))}${M({hidden:!n?.visible||r!=="inline-end",children:this._renderActionGroup(n)})}</arcgis-toolbar>${M({hidden:!n?.visible||r!=="separate",children:v`<arcgis-toolbar>${this._renderActionGroup(n)}</arcgis-toolbar>`})}</arcgis-toolbar-stack></div>${M({hidden:this.hideSettingsMenu,children:v`<arcgis-view-popover .open=${this.#t.settingsPopoverOpen} .heading=${this._messages.settings?.heading} .anchorElement=${e} .visualScale=${o} .actionBarElement=${this.#l.value?.barElement} @arcgisPropertyChange=${l=>this.#t.settingsPopoverOpen=l.target.open??!1}>${this._renderSettings()}</arcgis-view-popover>`})}`}_renderSettings(){let{autoDestroyDisabled:e,hideLabelsToggle:t,hideSnappingControls:o,hideTooltipsToggle:s,showSnappingControlsElementsHeader:a,useViewOptions:c,view:r,viewModel:n}=this;return v`<div class="editing-controls-panel"><arcgis-sketch-tooltip-controls .hideLabelsToggle=${t} .hideTooltipsToggle=${c||s} .directionMode=${n.valueOptions.directionMode} .labelsEnabled=${n.labelOptions.enabled} .tooltipsEnabled=${n.tooltipOptions.enabled} @arcgisPropertyChange=${g=>{g.stopPropagation();let{labelsEnabled:l,tooltipsEnabled:u,directionMode:b}=g.currentTarget,f=this.viewModel;switch(g.detail.name){case"labelsEnabled":f.labelOptions.enabled=l;break;case"directionMode":f.valueOptions.directionMode=b;break;case"tooltipsEnabled":f.tooltipOptions.enabled=u;break}}}></arcgis-sketch-tooltip-controls>${!c&&!o?v`<arcgis-snapping-controls .autoDestroyDisabled=${e} .view=${r} .visibleElements=${this.#e.snappingControlsElements} .snappingOptions=${n.snappingOptions} .showHeader=${a} @arcgisPropertyChange=${g=>g.stopPropagation()}></arcgis-snapping-controls>`:void 0}</div>`}_renderActionGroup({visible:e,commands:t,name:o}){if(!e||!t.length)return;let{defaultPriority:s,groupKind:a,overflowLabel:c,preferEndSlot:r}=Ee[o],n=(o==="geometrySimplification"?void 0:this._groupLayoutPriorityOverrides.get(o))??s,g=t.map(u=>this._renderCommand(u)),l=se(`more.${c}`,this._messages);switch(a){case"more-button":return v`<arcgis-toolbar-group .priority=${n} .preferEndSlot=${r}><arcgis-toolbar-more-button .overflowActionLabel=${l} .priority=${n}>${g}</arcgis-toolbar-more-button></arcgis-toolbar-group>`;case"split-button":return v`<arcgis-toolbar-group .priority=${n} .preferEndSlot=${r}><arcgis-toolbar-split-button .overflowActionLabel=${l} .priority=${n}>${g}</arcgis-toolbar-split-button></arcgis-toolbar-group>`;case"actions":return v`<arcgis-toolbar-group .priority=${n} .preferEndSlot=${r}>${g}</arcgis-toolbar-group>`}}_renderCommand({active:e,afterCreate:t,afterRemoved:o,afterUpdate:s,appearance:a,icon:c,disabled:r,id:n,kind:g,labelKey:l,labelParameters:u,loading:b,tooltipKey:f,iconFlipRTL:C,onClick:m,refKey:S,textEnabled:V,renderAsAction:ce}){let{_messages:B,_refMap:he,layout:I}=this,P=se(l,B),L=P===void 0?l:u?de(P,u):P,D=B?.[f]??L,z=S?ae(he,S,k):this.#n,F={afterCreate:t,afterRemoved:o,afterUpdate:s};return ce?v`<arcgis-toolbar-action .active=${e} .appearance=${a} .disabled=${r} .icon=${c} .iconFlipRtl=${C} id=${n??A} .kind=${g} .loading=${b} .labelText=${I==="horizontal"?L:""} .textEnabled=${V} .tooltipText=${I==="horizontal"&&V?"":D} @arcgisToolbarItemSelected=${m} ${ne(F)} ${_(z)}></arcgis-toolbar-action>`:v`<arcgis-toolbar-item .active=${e} .disabled=${r} .icon=${c} id=${n??A} .iconFlipRtl=${C} .labelText=${L} .tooltipText=${D} @arcgisItemSelected=${m} ${ne(F)} ${_(z)}></arcgis-toolbar-item>`}};J("arcgis-sketch",$);return $},"intl","layers/GraphicsLayer","symbols/TextSymbol","core/reactiveUtils","widgets/Sketch/SketchViewModel","applications/Components/featureUtils","core/Accessor","core/accessorSupport/decorators","core/promiseUtils","widgets/Sketch/VisibleElements","widgets/support/SelectionToolbar/SelectionToolbarViewModel",a,b,c,d,e,f,g)
|
|
2
|
+
import{b as oe}from"./JB6WQEFJ.js";import g from"./DSIYRWN2.js";import{a as T}from"./KBRYRH7T.js";import"./FH3WFF5O.js";import{a as M}from"./6J3KSMFG.js";import f from"./3ZRVPLIZ.js";import"./WJQUE4DR.js";import e from"./ZRT4RJ62.js";import{a as ee}from"./SAI7K4OO.js";import d from"./ANB7YZCR.js";import c from"./3VFPLRD3.js";import b from"./E3RBRDUV.js";import{d as X,h as Y}from"./FY7P5YLX.js";import"./IRDDLVT2.js";import a from"./TJHVEY7T.js";import{b as Q}from"./LXME6MU5.js";import{E as N,F as H,O as q,P as k,Q as _,R as j,X as A,_ as J,a as K,b as v,e as O,x as W,z as U}from"./IW3P4TGM.js";import"./TAVTDQ6S.js";export default $arcgis.t(([{substitute:de},pe,ge,{watch:y,on:ue,whenOnce:me},ve,{getOrCreateMapValue:ae,createReactiveMap:ye},be,{property:p,subclass:fe},{ignoreAbortErrors:E},Ce,we,,,,w,te,{f:Z},ie])=>{function se(i,e){let t=e;for(let o of i.split(".")){if(typeof t!="object"||t===null)return;t=Reflect.get(t,o)}return typeof t=="string"?t:void 0}var Te=K`.editing-controls-panel{min-inline-size:100px;max-inline-size:400px;-webkit-user-select:none;user-select:none;pointer-events:initial;padding:var(--calcite-space-sm);arcgis-sketch-tooltip-controls+arcgis-snapping-controls{border-block-start:1px solid var(--calcite-color-border-3)}}:host{pointer-events:none}.toolbar-container{block-size:100%;min-block-size:0;min-inline-size:0}arcgis-toolbar-stack[layout=vertical]{block-size:100cqh;min-block-size:100%;max-block-size:100%}:host([data-intrinsic-toolbar-sizing]){min-inline-size:0;min-block-size:0;max-inline-size:100%;max-block-size:100%;arcgis-toolbar-stack[layout=vertical]{block-size:100%}}:host([data-intrinsic-toolbar-sizing][layout="vertical"]){display:grid;grid-template-columns:minmax(min-content,1fr);grid-template-rows:minmax(0,1fr);inline-size:fit-content;block-size:100%;.toolbar-container{block-size:auto}.toolbar-container,arcgis-view-popover{grid-area:1 / 1}}:host([data-intrinsic-toolbar-sizing][layout="vertical"][toolbar-kind="floating"]){block-size:auto}`,Se={point:"pin",polyline:"line",polygon:"polygon",rectangle:"rectangle",circle:"circle",multipoint:"pins",mesh:"i3d-building",freehandPolygon:"freehand-area",freehandPolyline:"freehand",text:"text"},Ee={selectionTools:{defaultPriority:T.Default,groupKind:"split-button",overflowLabel:"selection"},selectionSet:{defaultPriority:T.High,groupKind:"actions"},createTools:{defaultPriority:T.High,groupKind:"more-button",overflowLabel:"drawing"},undoRedo:{defaultPriority:T.Medium,groupKind:"split-button",overflowLabel:"action",preferEndSlot:!0},settings:{defaultPriority:T.Max,groupKind:"more-button",overflowLabel:"action",preferEndSlot:!0},geometrySimplification:{defaultPriority:T.Default,groupKind:"actions",preferEndSlot:!0}},_e=Object.defineProperty,Me=Object.getOwnPropertyDescriptor,d=(i,e,t,o)=>{for(var s=o>1?void 0:o?Me(e,t):e,a=i.length-1,c;a>=0;a--)(c=i[a])&&(s=(o?c(e,t,s):c(s))||s);return o&&s&&_e(e,t,s),s},h=class extends be{constructor(i){super(i),this._effectiveRenderStateCache=new Map,this._effectiveGeometrySimplificationInProgress=!1,this.visibleElements=new Ce,this.settingsPopoverOpen=!1,this.availableCreateTools=["point","polyline","freehandPolyline","polygon","freehandPolygon","rectangle","circle"]}initialize(){this.selectionViewModel??=new we({persistSelection:!1}),this.addHandles([y(()=>this.sketchViewModel,(i,e)=>{i!==e&&this._effectiveRenderStateCache.clear()},{sync:!0}),ie({getLoading:()=>this.sketchViewModel?.geometrySimplificationInProgress??!1,setEffectiveLoading:i=>{this._effectiveGeometrySimplificationInProgress=i}}),y(()=>this.view,i=>{this.selectionViewModel.view=i},{initial:!0,sync:!0}),y(()=>this.sketchViewModel?.layer,i=>this.selectionViewModel.sources=i?[i]:[],{initial:!0,sync:!0}),this.selectionViewModel.on("complete",({selection:i})=>{let{sketchViewModel:e}=this;if(i.length&&e){let{defaultUpdateOptions:t}=e,{tool:o}=t;this.update(i,{...t,tool:i.length>1&&o==="reshape"?"transform":o})}}),y(()=>this.selectionViewModel.activeOperation,i=>{i&&(this.sketchViewModel?.cancel(),this._activeCustomToolOptions=void 0)},{sync:!0}),ue(()=>this.sketchViewModel,"create",i=>{i.state==="complete"&&this.sketchViewModel?.creationMode!=="continuous"&&(this._activeCustomToolOptions=void 0)}),y(()=>this.visibleElements.settingsMenu,i=>{i||(this.settingsPopoverOpen=!1)},{sync:!0})])}destroy(){this._pendingCommandAbortController?.abort(),this.selectionViewModel.destroy(),this.sketchViewModel=void 0}get _isEffectiveRenderStateFrozen(){let{sketchViewModel:i}=this;return!!(i?.toolTransitionInProgress||i?.geometrySimplificationInProgress)}_getEffectiveValue(i,e){if(!this._isEffectiveRenderStateFrozen||!this._effectiveRenderStateCache.has(i)){let t=e();return this._effectiveRenderStateCache.set(i,t),t}return this._effectiveRenderStateCache.get(i)}get _state(){return this.sketchViewModel?.state??"disabled"}get test(){return{activeCustomToolOptions:this._activeCustomToolOptions,activeSelectionTool:this._activeSelectionTool,selectionViewModel:this.selectionViewModel}}get _activeSelectionTool(){switch(this.selectionViewModel.activeOperation?.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";default:return}}get _activePluginUniqueIds(){let i=this.sketchViewModel?.activePluginConfigurations.filter(e=>!e.hidden).map(e=>e.uniqueId);return new Set(i??[])}get _createToolActions(){let{sketchViewModel:i}=this;if(!i)return[];let e=i.effectiveAvailablePlugins,t=this.state==="disabled",o=this.visibleElements.createTools,s=this.activeTool,a=this._activeCustomToolOptions,c=a||!i.firstPluginWithSwappableLeaf?this._customToolOptions:[],r=i.rootPlugins,n=c?.map(l=>({active:l===a,disabled:t,icon:l.icon,labelKey:l.label,onClick:l===a?()=>this._cancelActiveOperation():()=>this._activateLegacyDrawTool(l.toolName,l.createOptions,l)}))??[];if(a&&r)return[...this._pluginsToActions(r),...n];if(e?.length&&this.view?.type!=="3d")return[...this._pluginsToActions(e),...n];let g=this.view?.type==="3d";return[...this.availableCreateTools?.filter(l=>g&&l==="multipoint"?!1:l==="mesh"?!0:o[l])?.map(l=>({active:l===s,disabled:t,icon:Se[l],labelKey:`draw.${l}`,onClick:l===s?()=>this._cancelActiveOperation():()=>this._activateLegacyDrawTool(l)}))??[],...n]}get _shouldShowBackButton(){let i=this.sketchViewModel?.firstPluginWithSwappableLeaf,e=this.sketchViewModel?.rootPlugins,t=this._activeCustomToolOptions;return!!(this.sketchViewModel?.multiplePluginsActive&&i&&e&&!(e.length<2&&e.includes(i)&&!this.visibleElements.singlePluginBackButton)&&!t)}get _selectionToolActions(){return this._shouldShowBackButton?[{active:!1,disabled:this.state==="disabled",icon:"chevron-left",iconFlipRTL:!0,labelKey:"back",onClick:()=>this._cancelActiveOperation()}]:this._selectionCommands}get _settingsActions(){let i=this._customActions?.get("settings-before"),e=this._customActions?.get("settings-after"),t=this.visibleElements.settingsMenu,o=[];return!i?.length&&!e?.length&&!t||(i&&o.push(...this._customActionsToSketchActions(i)),t&&o.push({icon:"gear",active:this.settingsPopoverOpen,disabled:this.state==="disabled",labelKey:"settings.heading",tooltipKey:"settings.heading",refKey:"settings",onClick:()=>this.toggleSettingsPopover()}),e&&o.push(...this._customActionsToSketchActions(e))),o}get _activeTool(){let i=this.selectionViewModel.activeOperation;if(i)switch(i.toolName){case"lasso":return"lasso-selection";case"rectangle":return"rectangle-selection";case"default":return"custom-selection"}if(!this.sketchViewModel)return;let{availableCreateTools:e}=this,{activeTool:t,activeCreateToolDrawMode:o}=this.sketchViewModel;return t==="polygon"&&o==="freehand"&&e?.includes("freehandPolygon")?"freehandPolygon":t==="polyline"&&o==="freehand"&&e?.includes("freehandPolyline")?"freehandPolyline":t??void 0}get _selectionCommands(){let{state:i,visibleElements:e,_activeSelectionTool:t,_customActions:o}=this,s=this.state==="disabled",a=[];this.sketchViewModel?.updateOnGraphicClick!==!1&&a.push({active:i==="ready"&&this._activeSelectionTool==null,disabled:s,icon:"cursor",labelKey:"selectFeature",onClick:()=>this._activateDefaultSelectionTool()});let c=e.selectionTools;c["rectangle-selection"]&&a.push({active:t==="rectangle-selection",disabled:s,icon:"cursor-marquee",labelKey:"rectangleSelection",onClick:()=>this._activateSelectionTool("rectangle-selection")}),c["lasso-selection"]&&a.push({active:t==="lasso-selection",disabled:s,icon:"lasso-select",labelKey:"lassoSelection",onClick:()=>this._activateSelectionTool("lasso-selection")});let r=o?.get("selection-toolbar");return r&&a.push(...this._customActionsToSketchActions(r)),a}get _selectionSetActions(){let i=this.sketchViewModel?.updateGraphics.length??0;if(!i)return[];let e=this.state==="disabled",t=[],o=this._customActions?.get("before-selection-set"),s=this._customActions?.get("after-selection-set");return this.visibleElements.selectionCountLabel&&t.push({active:!1,appearance:"outline",disabled:e,icon:"selection-x",kind:"brand",labelKey:"deselectCount",labelParameters:{count:i},textEnabled:!0,renderAsAction:!0,onClick:()=>this._cancelSketchOperation()}),o&&t.push(...this._customActionsToSketchActions(o)),this.visibleElements.duplicateButton&&t.push({active:!1,disabled:e,icon:"copy",renderAsAction:!0,labelKey:i>1?"duplicateFeatures":"duplicateFeature",onClick:()=>this._duplicate()}),this.visibleElements.deleteButton&&t.push({active:!1,disabled:e,icon:"trash",kind:"danger",renderAsAction:!0,labelKey:i>1?"deleteFeatures":"deleteFeature",onClick:()=>this._delete()}),s&&t.push(...this._customActionsToSketchActions(s)),t}get _undoRedoActions(){return this.visibleElements.undoRedoMenu?[{active:!1,disabled:this.state==="disabled"||!this.sketchViewModel?.canUndo(),icon:"undo",labelKey:"undo",iconFlipRTL:!0,onClick:()=>this._undo()},{active:!1,disabled:this.state==="disabled"||!this.sketchViewModel?.canRedo(),icon:"redo",labelKey:"redo",iconFlipRTL:!0,onClick:()=>this._redo()}]:[]}get state(){return this._getEffectiveValue("state",()=>this._state)}get activeTool(){return this._getEffectiveValue("activeTool",()=>this._activeTool)}get activePluginIds(){return this._getEffectiveValue("activePluginId",()=>this._activePluginUniqueIds)}get groupedActions(){let i=this._getEffectiveValue("availableCommandGroups",()=>[["selectionTools",this._selectionToolActions],["createTools",this._createToolActions],["undoRedo",this._undoRedoActions],["settings",this._settingsActions],["selectionSet",this._selectionSetActions]].map(([t,o])=>({name:t,commands:o,visible:o.length>0}))),e=this._effectiveGeometrySimplificationInProgress?i.map(t=>({...t,commands:t.commands.map(o=>({...o,disabled:!0}))})):i;return!this.visibleElements.geometrySimplificationActivityIndicator||!this._effectiveGeometrySimplificationInProgress?e:[...e,{name:"geometrySimplification",commands:[{active:!1,appearance:"transparent",disabled:!0,kind:"warning",labelKey:"processing",loading:!0,onClick:()=>{},renderAsAction:!0}],visible:!0}]}async create(i,e){await this._executeWhenReady(async()=>{this.cancelAll();let t=this.sketchViewModel;t&&await E(t.create(i,e))})}async _executeWhenReady(i){this._pendingCommandAbortController?.abort();let e=new AbortController;this._pendingCommandAbortController=e;try{await E((async()=>{this.sketchViewModel?.geometrySimplificationInProgress&&await me(()=>!this.sketchViewModel?.geometrySimplificationInProgress,e.signal),e.signal.aborted||await i()})())}finally{this._pendingCommandAbortController===e&&(this._pendingCommandAbortController=void 0)}}toggleSettingsPopover(){this.settingsPopoverOpen=!this.settingsPopoverOpen}setCustomTools(i,e){this._customToolOptions=i??void 0;let t=this._activeCustomToolOptions;if(t){let o=this._customToolOptions?.find(s=>s.toolKey===t.toolKey);o?this._activeCustomToolOptions=o:this.cancelAll()}if(e?.length){let o=new Map;for(let s of e)ae(o,s.position,()=>[]).push(s);this._customActions=o}else this._customActions=void 0}cancelAll(){this._pendingCommandAbortController?.abort(),this._cancelSupportingOperations(),this.sketchViewModel?.cancel()}async update(i,e){await this._executeWhenReady(async()=>{let t=this.sketchViewModel;t&&await E(t.update(i,e))})}_activateDefaultSelectionTool(){this._executeWhenReady(()=>{this.cancelAll(),this.view?.focus()})}_cancelActiveOperation(){this._executeWhenReady(()=>this.cancelAll())}_cancelSketchOperation(){this._executeWhenReady(()=>this.sketchViewModel?.cancel())}_cancelSupportingOperations(){this.selectionViewModel.cancel(),this._activeCustomToolOptions=void 0}_activatePlugin(i){this._executeWhenReady(()=>{let e=this._activeCustomToolOptions!=null;this._cancelSupportingOperations();let t=this.sketchViewModel;if(t){if(e){t.cancel(),E(t.create(i));return}t.firstPluginWithSwappableLeaf?(t.replaceLeaf(i),this.view?.focus()):E(t.create(i))}})}_activateLegacyDrawTool(i,e,t){this._executeWhenReady(()=>{this._cancelSupportingOperations();let o=this.sketchViewModel;o&&(this._activeCustomToolOptions=t,E(o.create(i,e)))})}_activateSelectionTool(i){this._executeWhenReady(()=>{if(this._activeSelectionTool===i){this.selectionViewModel.cancel();return}this.cancelAll();let e={createTool:i==="lasso-selection"?"polygon":"rectangle",...i==="lasso-selection"?{mode:"hybrid",toolName:"lasso"}:{toolName:"rectangle"},type:"replace",selectOnComplete:!0};this.selectionViewModel.activate(e)&&this.view?.focus()})}_delete(){this._executeWhenReady(()=>this.sketchViewModel?.delete())}_duplicate(){this._executeWhenReady(()=>{this.sketchViewModel?.duplicate()})}_executeCustomAction(i){this._executeWhenReady(()=>i.onclick?.())}_redo(){this._executeWhenReady(()=>{this.sketchViewModel?.redo()})}_undo(){this._executeWhenReady(()=>{this.sketchViewModel?.undo()})}_customActionsToSketchActions(i){let e=this.state==="disabled";return i.map(t=>({active:t.active??!1,afterCreate:t.afterCreate,afterRemoved:t.afterRemoved,afterUpdate:t.afterUpdate,disabled:e||(t.disabled??!1),icon:t.icon,iconFlipRTL:t.flipRTL,id:t.id,labelKey:t.text,onClick:()=>this._executeCustomAction(t)}))}_pluginsToActions(i){let e=this.activePluginIds,t=this._activeCustomToolOptions,o=this.state==="disabled";return i.map(s=>({active:(e?.has(s.uniqueId)??!1)&&!t,icon:s.icon,disabled:o,labelKey:`digitizers.${s.localizationKey}`,onClick:()=>this._activatePlugin([s])}))}};d([p()],h.prototype,"_isEffectiveRenderStateFrozen",1);d([p()],h.prototype,"_effectiveGeometrySimplificationInProgress",2);d([p()],h.prototype,"_state",1);d([p()],h.prototype,"_customToolOptions",2);d([p()],h.prototype,"_activeCustomToolOptions",2);d([p()],h.prototype,"_customActions",2);d([p()],h.prototype,"selectionViewModel",2);d([p()],h.prototype,"_activeSelectionTool",1);d([p()],h.prototype,"_activePluginUniqueIds",1);d([p()],h.prototype,"_createToolActions",1);d([p()],h.prototype,"_shouldShowBackButton",1);d([p()],h.prototype,"_selectionToolActions",1);d([p()],h.prototype,"_settingsActions",1);d([p()],h.prototype,"_activeTool",1);d([p()],h.prototype,"_selectionCommands",1);d([p()],h.prototype,"_selectionSetActions",1);d([p()],h.prototype,"_undoRedoActions",1);d([p()],h.prototype,"sketchViewModel",2);d([p()],h.prototype,"visibleElements",2);d([p()],h.prototype,"view",2);d([p()],h.prototype,"settingsPopoverOpen",2);d([p()],h.prototype,"availableCreateTools",2);d([p()],h.prototype,"state",1);d([p()],h.prototype,"activeTool",1);d([p()],h.prototype,"activePluginIds",1);d([p()],h.prototype,"groupedActions",1);h=d([fe("components.sketch.SketchComponentViewModel")],h);var x=class extends q{#t;#e=!1;#i;constructor(e){if(super(e),e.type!==N.ELEMENT)throw new Error("nodeHooks() can only be used on elements")}render(e){return O}update(e,[t]){let o=e.element;if(!(o instanceof HTMLElement))throw new TypeError("nodeHooks() can only be used on HTMLElements");let s=this.#e?t.afterUpdate:t.afterCreate;return this.#t=o,this.#e=!0,this.#i=t,queueMicrotask(()=>{o.isConnected&&s?.(o)}),O}disconnected(){let e=this.#t,t=this.#i?.afterRemoved;!e||!t||queueMicrotask(()=>{e.isConnected||Z(()=>t(e),{timeout:16})})}},ne=H(x),ke=new Set(["arcgis-map","arcgis-scene"]),Pe=8,R=class extends U{constructor(e){super(e),this.#t=new MutationObserver(()=>this.#c()),this.#e=new ResizeObserver(()=>this.#v()),this.#i=new ResizeObserver(([t])=>{if(!t)return;let o=this.component.layout==="horizontal"?t.contentRect.height:t.contentRect.width;o!==this.#s&&(this.#s=o,this.#v())}),this.#h=[],this.ref=t=>{this.#o!==t&&(this.#o=t,this.#a=void 0,this.#r=void 0,this.#c())},this.#u=()=>this.#c(),this.exports=void 0,e.listenOn(window,"resize",()=>this.#g()),this.onConnected(()=>this.#g()),this.onUpdated(()=>{(this.#d!==this.component.layout||this.#y!==this.component.toolbarKind)&&this.#c()}),this.onDisconnected(()=>this.#C()),this.onLifecycle(()=>y(()=>this.component.view?.attributionHeight,()=>{this.#g()},{initial:!0}))}#t;#e;#i;#l;#s;#n;#h;#m;#o;#a;#r;#d;#y;#p;#g(){queueMicrotask(()=>{this.component.el.isConnected&&this.#c()})}#c(){this.#y=this.component.toolbarKind;let e=this.#b();if(this.component.el.toggleAttribute("data-intrinsic-toolbar-sizing",!e),!e){this.#f(),this.#C();return}this.#w(e.toolbar),this.#T(e),this.#S(e),this.#v(e)}#b(){let e=this.component.el,t=e.parentElement,o=this.#o,s=e.assignedSlot;if(!t||!ke.has(t.localName)||!o||!s?.parentElement)return;let a=getComputedStyle(t).direction==="rtl"?"rtl":"ltr",c=re(e.slot,a);if(!c)return;let r=Array.from(t.children).filter(n=>n instanceof HTMLElement&&n.localName!=="arcgis-sketch");return{assignedSlot:s,content:r,direction:a,parent:t,position:c,toolbar:o}}#u;#w(e){this.#d!==this.component.layout&&(this.#s=void 0,this.#d=this.component.layout),this.#l!==e&&(this.#i.disconnect(),this.#l=e,this.#s=void 0,this.#i.observe(e))}#T(e){let t=e.assignedSlot;this.#n!==t&&(this.#n?.removeEventListener("slotchange",this.#u),this.#n=t,t.addEventListener("slotchange",this.#u)),this.#m!==e.parent&&(this.#t.disconnect(),this.#p?.(),this.#m=e.parent,this.#p=Q(e.parent,["dir"],()=>{this.#g()}),this.#t.observe(e.parent,{childList:!0,subtree:!1}))}#S(e){let t=[e.parent,...e.content];Ae(this.#h,t)||(this.#e.disconnect(),t.forEach(o=>this.#e.observe(o)),this.#h=t)}#v(e=this.#b()){if(!e){this.#f();return}let t=this.component.layout,o=e.parent.getBoundingClientRect(),s=Le({content:Oe(e),gap:Pe,layout:t,position:e.position,sameSlotReserve:Ge(e.assignedSlot,this.component.el,t,e.assignedSlot),toolbarBounds:e.toolbar.getBoundingClientRect(),viewBounds:o}),a=s;if(e.toolbar.toolbarKind==="floating"){let c=getComputedStyle(e.assignedSlot.parentElement.parentElement),r=Math.max(Number.parseFloat(c.marginLeft),Number.parseFloat(c.marginRight)),n=t==="horizontal"?window.innerWidth:window.innerHeight,g=t==="horizontal"?o.width:o.height,l=t==="vertical"?this.component.view?.attributionHeight??0:0;a=Math.max(0,Math.min(s,g-2*r-l,n-2*r))}this.#E(e.toolbar,t,s,a)}#E(e,t,o,s){o===this.#a&&s===e.allocatedLength&&t===this.#r||(this.#a=o,this.#r=t,e.allocatedLength=s,t==="horizontal"?(e.style.height="",e.style.maxHeight="",e.style.maxWidth=`${o}px`,e.style.width="fit-content"):(e.style.height="fit-content",e.style.maxHeight=`${o}px`,e.style.maxWidth="",e.style.width=""))}#f(){this.#o&&(this.#o.style.maxHeight="",this.#o.style.maxWidth="",this.#o.style.height="",this.#o.style.width="",this.#o.allocatedLength=void 0,this.#a=void 0,this.#r=void 0)}#C(){this.#t.disconnect(),this.#p?.(),this.#p=void 0,this.#e.disconnect(),this.#i.disconnect(),this.#l=void 0,this.#s=void 0,this.#h=[],this.#n?.removeEventListener("slotchange",this.#u),this.#n=void 0,this.#a=void 0,this.#r=void 0,this.#d=void 0,this.#m=void 0}};function Le({content:i,gap:e,layout:t,position:o,sameSlotReserve:s,toolbarBounds:a,viewBounds:c}){let r=G(c,t),n=G(a,t),g=le(o,t),l=g?n.start-r.start:r.end-n.end,u=0,b=!1;for(let C of i){if(le(C.position,t)===g)continue;let m=G(C.bounds,t);if(!(m.crossStart<n.crossEnd&&m.crossEnd>n.crossStart))continue;let S=g?r.end-m.start:m.end-r.start;u=Math.max(u,S),b=!0}let f=b?e:0;return Math.max(0,r.length-Math.max(0,l)-s-u-f)}function G(i,e){return e==="horizontal"?{start:i.left,end:i.right,length:i.width,crossStart:i.top,crossEnd:i.bottom}:{start:i.top,end:i.bottom,length:i.height,crossStart:i.left,crossEnd:i.right}}function le(i,e){return e==="horizontal"?i.endsWith("left"):i.startsWith("top")}function Oe(i){return i.content.flatMap(e=>{if(e.assignedSlot===i.assignedSlot)return[];let t=re(e.slot,i.direction);return t?[{bounds:e.getBoundingClientRect(),position:t}]:[]})}function Ae(i,e){return i.length===e.length&&i.every((t,o)=>t===e[o])}function Ge(i,e,t,o){let s=getComputedStyle(o),a=s.flexDirection;if(!(t==="horizontal"?a.startsWith("row"):a.startsWith("column")))return 0;let c=i.assignedElements().filter(b=>b instanceof HTMLElement),r=c.indexOf(e);if(r<0)return 0;let n=getComputedStyle(e),g=a==="row"?Number.parseFloat(n.marginRight):a==="row-reverse"?Number.parseFloat(n.marginLeft):a==="column"?Number.parseFloat(n.marginBottom):Number.parseFloat(n.marginTop),l=c.slice(r+1),u=Number.parseFloat(t==="horizontal"?s.columnGap:s.rowGap);return l.reduce((b,f)=>{let C=f.getBoundingClientRect(),m=getComputedStyle(f),S=t==="horizontal"?C.width+Number.parseFloat(m.marginLeft)+Number.parseFloat(m.marginRight):C.height+Number.parseFloat(m.marginTop)+Number.parseFloat(m.marginBottom);return b+S+u},g)}function re(i,e){let[t,o]=i.split("-");if(t!=="bottom"&&t!=="top")return;let s=o==="start"?e==="ltr"?"left":"right":o==="end"?e==="ltr"?"right":"left":o;return s==="left"||s==="right"?`${t}-${s}`:void 0}var xe=["bottom-end","bottom-start","bottom-left","bottom-right","top-end","top-start","top-left","top-right"],Re=new Set(xe),$e=te(i=>new ve({...i,cancelUpdateOnClickAway:!0,creationMode:"continuous",textSymbol:new ge({text:"text"}),useLegacyCreateTools:!1})),$=class extends j{constructor(){super(),this.#t=new h,this.#l=k(),this.#s=new R(this),this.#n=k(),this._defaultGraphicsLayer=null,this._messages=ee(),this.test={componentViewModel:this.#t},this._groupLayoutPriorityOverrides=new Map,this._contextualToolLocation="separate",this._refMap=ye(),this.viewModel=$e(this),this.view=this.viewModel.view,this.autoDestroyDisabled=!1,this.createGraphic=this.viewModel.createGraphic,this.creationMode=this.viewModel.creationMode,this.defaultCreateOptions=this.viewModel.defaultCreateOptions,this.defaultGraphicsLayerDisabled=!1,this.defaultUpdateOptions=this.viewModel.defaultUpdateOptions,this.geometrySimplificationInProgress=this.viewModel.geometrySimplificationInProgress,this.icon="pencil",this.label=this._messages?.componentLabel,this.labelOptions=this.viewModel.labelOptions,this.layer=this.viewModel.layer,this.layout="horizontal",this.pointSymbol=this.viewModel.pointSymbol,this.polygonSymbol=this.viewModel.polygonSymbol,this.polylineSymbol=this.viewModel.polylineSymbol,this.activeFillSymbol=this.viewModel.activeFillSymbol,this.activeLineSymbol=this.viewModel.activeLineSymbol,this.activeVertexSymbol=this.viewModel.activeVertexSymbol,this.activeCreateToolDrawMode=this.viewModel.activeCreateToolDrawMode,this.visualScale="m",this.snappingOptions=this.viewModel.snappingOptions,this.textSymbol=this.viewModel.textSymbol,this.toolbarKind="floating",this.tooltipOptions=this.viewModel.tooltipOptions,this.useViewOptions=this.viewModel.useViewOptions,this.valueOptions=this.viewModel.valueOptions,this.useLegacyCreateTools=this.viewModel.useLegacyCreateTools,this.updateOnGraphicClickDisabled=this.viewModel.updateOnGraphicClick,this.updateGraphics=this.viewModel.updateGraphics,this.activeTooltip=this.viewModel.activeTooltip,this.arcgisCreate=w(()=>this.viewModel,"create"),this.arcgisDelete=w(()=>this.viewModel,"delete"),this.arcgisDuplicate=w(()=>this.viewModel,"duplicate"),this.arcgisPropertyChange=Y()("activeTool","geometrySimplificationInProgress","state"),this.arcgisReady=W(),this.arcgisRedo=w(()=>this.viewModel,"redo"),this.arcgisUndo=w(()=>this.viewModel,"undo"),this.arcgisUpdate=w(()=>this.viewModel,"update"),X(["slot"],()=>{this.requestUpdate()}),this.manager.onLifecycle(()=>[y(()=>this.el.view?.map,(e,t)=>{let o=this._defaultGraphicsLayer;o&&(t?.allLayers.includes(o)&&t.remove(o),o&&!e?.allLayers.includes(o)&&e?.add(o))}),y(()=>this.el.view,e=>{this.viewModel.view=e,this.#t.view=e??void 0},{initial:!0}),y(()=>this.viewModel,e=>{this.#t.sketchViewModel=e,this.viewModel.pluginManager.sketch=this},{initial:!0}),y(()=>this.#t.state,(e,t)=>{this.requestUpdate("state",t)},{initial:!0}),y(()=>this.#t.activeTool,()=>this.arcgisPropertyChange.emit({name:"activeTool"}),{sync:!0})]),this.manager.onDestroy(()=>{this._defaultGraphicsLayer&&this.el.view?.map?.allLayers.includes(this._defaultGraphicsLayer)&&this.el.view?.map?.remove(this._defaultGraphicsLayer),this._defaultGraphicsLayer?.destroy(),this._defaultGraphicsLayer=null,this.#t.destroy()})}static{this.properties={_groupLayoutPriorityOverrides:16,_contextualToolLocation:16,_refMap:16,viewModel:0,view:0,activeTool:32,autoDestroyDisabled:5,visibleElements:0,availableCreateTools:0,createGraphic:32,creationMode:1,defaultCreateOptions:0,defaultGraphicsLayerDisabled:5,defaultUpdateOptions:0,geometrySimplificationInProgress:36,hideCreateToolsCircle:5,hideCreateToolsMultipoint:5,hideCreateToolsPoint:5,hideCreateToolsPolygon:5,hideCreateToolsPolyline:5,hideCreateToolsRectangle:5,hideDuplicateButton:5,hideDeleteButton:5,hideSelectionCountLabel:5,hideLabelsToggle:5,hideSelectionToolsLassoSelection:5,hideSelectionToolsRectangleSelection:5,hideSettingsMenu:5,hideSinglePluginBackButton:5,hideSnappingControls:5,hideSnappingControlsElementsEnabledToggle:5,hideSnappingControlsElementsFeatureEnabledToggle:5,hideSnappingControlsElementsLayerList:5,hideSnappingControlsElementsSelfEnabledToggle:5,hideSnappingControlsElementsGridEnabledToggle:5,hideSnappingControlsElementsGridControls:5,hideSnappingControlsElementsGridControlsElementsColorSelection:5,hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle:5,hideSnappingControlsElementsGridControlsElementsLineIntervalInput:5,hideSnappingControlsElementsGridControlsElementsNumericInputs:5,hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning:5,hideSnappingControlsElementsGridControlsElementsPlacementButtons:5,hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle:5,hideTooltipsToggle:5,hideUndoRedoMenu:5,icon:1,label:1,labelOptions:0,layer:0,layout:3,pointSymbol:0,polygonSymbol:0,polylineSymbol:0,activeFillSymbol:0,activeLineSymbol:0,activeVertexSymbol:0,activeCreateToolDrawMode:1,referenceElement:1,relativePosition:1,scale:1,visualScale:1,showSnappingControlsElementsHeader:5,showCreateToolsFreehandPolygon:5,showCreateToolsFreehandPolyline:5,showCreateToolsText:5,hideGeometrySimplificationActivityIndicator:5,snappingOptions:0,state:32,textSymbol:0,toolbarKind:3,tooltipOptions:0,useViewOptions:5,valueOptions:0,useLegacyCreateTools:5,updateOnGraphicClickDisabled:5,cancelUpdateOnClickAwayDisabled:5,updateGraphics:32,activeTooltip:0}}static{this.styles=Te}#t;get#e(){return this.#t.visibleElements}#i;#l;#s;#n;get activeTool(){return this.#t.activeTool}get visibleElements(){return this.#t.visibleElements}set visibleElements(e){this.#t.visibleElements=e}get availableCreateTools(){return this.#t.availableCreateTools}set availableCreateTools(e){this.#t.availableCreateTools=e}get hideCreateToolsCircle(){return!this.#e.createTools.circle}set hideCreateToolsCircle(e){this.#e.createTools.circle=!e}get hideCreateToolsMultipoint(){return!this.#e.createTools.multipoint}set hideCreateToolsMultipoint(e){this.#e.createTools.multipoint=!e}get hideCreateToolsPoint(){return!this.#e.createTools.point}set hideCreateToolsPoint(e){this.#e.createTools.point=!e}get hideCreateToolsPolygon(){return!this.#e.createTools.polygon}set hideCreateToolsPolygon(e){this.#e.createTools.polygon=!e}get hideCreateToolsPolyline(){return!this.#e.createTools.polyline}set hideCreateToolsPolyline(e){this.#e.createTools.polyline=!e}get hideCreateToolsRectangle(){return!this.#e.createTools.rectangle}set hideCreateToolsRectangle(e){this.#e.createTools.rectangle=!e}get hideDuplicateButton(){return!this.#e.duplicateButton}set hideDuplicateButton(e){this.#e.duplicateButton=!e}get hideDeleteButton(){return!this.#e.deleteButton}set hideDeleteButton(e){this.#e.deleteButton=!e}get hideSelectionCountLabel(){return!this.#e.selectionCountLabel}set hideSelectionCountLabel(e){this.#e.selectionCountLabel=!e}get hideLabelsToggle(){return!this.#e.labelsToggle}set hideLabelsToggle(e){this.#e.labelsToggle=!e}get hideSelectionToolsLassoSelection(){return!this.#e.selectionTools["lasso-selection"]}set hideSelectionToolsLassoSelection(e){this.#e.selectionTools["lasso-selection"]=!e}get hideSelectionToolsRectangleSelection(){return!this.#e.selectionTools["rectangle-selection"]}set hideSelectionToolsRectangleSelection(e){this.#e.selectionTools["rectangle-selection"]=!e}get hideSettingsMenu(){return!this.#e.settingsMenu}set hideSettingsMenu(e){this.#e.settingsMenu=!e}get hideSinglePluginBackButton(){return!this.#e.singlePluginBackButton}set hideSinglePluginBackButton(e){this.#e.singlePluginBackButton=!e}get hideSnappingControls(){return!this.#e.snappingControls}set hideSnappingControls(e){this.#e.snappingControls=!e}get hideSnappingControlsElementsEnabledToggle(){return!this.#e.snappingControlsElements.enabledToggle}set hideSnappingControlsElementsEnabledToggle(e){this.#e.snappingControlsElements.enabledToggle=!e}get hideSnappingControlsElementsFeatureEnabledToggle(){return!this.#e.snappingControlsElements.featureEnabledToggle}set hideSnappingControlsElementsFeatureEnabledToggle(e){this.#e.snappingControlsElements.featureEnabledToggle=!e}get hideSnappingControlsElementsLayerList(){return!this.#e.snappingControlsElements.layerList}set hideSnappingControlsElementsLayerList(e){this.#e.snappingControlsElements.layerList=!e}get hideSnappingControlsElementsSelfEnabledToggle(){return!this.#e.snappingControlsElements.selfEnabledToggle}set hideSnappingControlsElementsSelfEnabledToggle(e){this.#e.snappingControlsElements.selfEnabledToggle=!e}get hideSnappingControlsElementsGridEnabledToggle(){return!this.#e.snappingControlsElements.gridEnabledToggle}set hideSnappingControlsElementsGridEnabledToggle(e){this.#e.snappingControlsElements.gridEnabledToggle=!e}get hideSnappingControlsElementsGridControls(){return!this.#e.snappingControlsElements.gridControls}set hideSnappingControlsElementsGridControls(e){this.#e.snappingControlsElements.gridControls=!e}get hideSnappingControlsElementsGridControlsElementsColorSelection(){return!this.#e.snappingControlsElements.gridControlsElements.colorSelection}set hideSnappingControlsElementsGridControlsElementsColorSelection(e){this.#e.snappingControlsElements.gridControlsElements.colorSelection=!e}get hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle(){return!this.#e.snappingControlsElements.gridControlsElements.dynamicScaleToggle}set hideSnappingControlsElementsGridControlsElementsDynamicScaleToggle(e){this.#e.snappingControlsElements.gridControlsElements.dynamicScaleToggle=!e}get hideSnappingControlsElementsGridControlsElementsLineIntervalInput(){return!this.#e.snappingControlsElements.gridControlsElements.lineIntervalInput}set hideSnappingControlsElementsGridControlsElementsLineIntervalInput(e){this.#e.snappingControlsElements.gridControlsElements.lineIntervalInput=!e}get hideSnappingControlsElementsGridControlsElementsNumericInputs(){return!this.#e.snappingControlsElements.gridControlsElements.numericInputs}set hideSnappingControlsElementsGridControlsElementsNumericInputs(e){this.#e.snappingControlsElements.gridControlsElements.numericInputs=!e}get hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning(){return!this.#e.snappingControlsElements.gridControlsElements.outOfScaleWarning}set hideSnappingControlsElementsGridControlsElementsOutOfScaleWarning(e){this.#e.snappingControlsElements.gridControlsElements.outOfScaleWarning=!e}get hideSnappingControlsElementsGridControlsElementsPlacementButtons(){return!this.#e.snappingControlsElements.gridControlsElements.placementButtons}set hideSnappingControlsElementsGridControlsElementsPlacementButtons(e){this.#e.snappingControlsElements.gridControlsElements.placementButtons=!e}get hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle(){return!this.#e.snappingControlsElements.gridControlsElements.rotateWithMapToggle}set hideSnappingControlsElementsGridControlsElementsRotateWithMapToggle(e){this.#e.snappingControlsElements.gridControlsElements.rotateWithMapToggle=!e}get hideTooltipsToggle(){return!this.#e.tooltipsToggle}set hideTooltipsToggle(e){this.#e.tooltipsToggle=!e}get hideUndoRedoMenu(){return!this.#e.undoRedoMenu}set hideUndoRedoMenu(e){this.#e.undoRedoMenu=!e}get relativePosition(){let e=this.el.slot||this.el.closest("arcgis-expand")?.slot||"";return this.#i??(Re.has(e)?e:oe.topRight)}set relativePosition(e){this.#i=e}get scale(){return this.visualScale}set scale(e){this.visualScale=e}get showSnappingControlsElementsHeader(){return this.#e.snappingControlsElements.header}set showSnappingControlsElementsHeader(e){this.#e.snappingControlsElements.header=e}get showCreateToolsFreehandPolygon(){return this.#e.createTools.freehandPolygon}set showCreateToolsFreehandPolygon(e){this.#e.createTools.freehandPolygon=e}get showCreateToolsFreehandPolyline(){return this.#e.createTools.freehandPolyline}set showCreateToolsFreehandPolyline(e){this.#e.createTools.freehandPolyline=e}get showCreateToolsText(){return this.#e.createTools.text}set showCreateToolsText(e){this.#e.createTools.text=e}get hideGeometrySimplificationActivityIndicator(){return!this.#e.geometrySimplificationActivityIndicator}set hideGeometrySimplificationActivityIndicator(e){this.#e.geometrySimplificationActivityIndicator=!e}get state(){return this.#t.state}get cancelUpdateOnClickAwayDisabled(){return!this.viewModel.cancelUpdateOnClickAway}set cancelUpdateOnClickAwayDisabled(e){this.viewModel.cancelUpdateOnClickAway=!e}async addGraphic(e){this.viewModel.addGraphic(e)}async addGraphics(e){this.viewModel.addGraphics(e)}async cancel(){this.#t.cancelAll()}async complete(){this.viewModel.complete()}async create(e,t){await this.#t.create(e,t)}async delete(){this.viewModel.delete()}async destroy(){await this.manager.destroy()}async dismissFloatingElements(){this.#t.settingsPopoverOpen=!1}async duplicate(){this.viewModel.duplicate()}async hasGraphic(e){return this.viewModel.hasGraphic(e)}async removeAllGraphics(){this.viewModel.removeAllGraphics()}async removeGraphic(e){this.viewModel.removeGraphic(e)}async removeGraphics(e){this.viewModel.removeGraphics(e)}async redo(){this.viewModel.redo()}async canRedo(){return this.viewModel.canRedo()}async setContextualToolLocation(e){this._contextualToolLocation=e}async setCustomTools(e,t){this.#t.setCustomTools(e,t)}async setGroupCollapsePriorities(e){this._groupLayoutPriorityOverrides=e||new Map}async triggerUpdate(e,t){await this.#t.update(e,t)}async place(e){this.viewModel.place(e)}async undo(){this.#t.sketchViewModel?.undo()}async canUndo(){return this.viewModel.canUndo()}connectedCallback(){super.connectedCallback(),this.defaultGraphicsLayerDisabled||(this._defaultGraphicsLayer?.destroyed&&(this._defaultGraphicsLayer=null),this._defaultGraphicsLayer??=new pe({title:"Sketch Layer"}),this.layer=this._defaultGraphicsLayer,this.view?.map?.add(this.layer),this.viewModel.layer=this._defaultGraphicsLayer)}disconnectedCallback(){this._defaultGraphicsLayer&&this.view?.map?.allLayers.includes(this._defaultGraphicsLayer)&&this.view?.map?.remove(this._defaultGraphicsLayer),this.cancel(),super.disconnectedCallback()}render(){let e=this._refMap.get("settings")?.value?.actionElement,t=this.#t.groupedActions,{visualScale:o,layout:s,toolbarKind:a,relativePosition:c,_contextualToolLocation:r}=this,n=t.find(({name:l})=>l==="selectionSet"),g=t.filter(({name:l})=>l!=="selectionSet");return v`<div class="toolbar-container"><arcgis-toolbar-stack .layout=${s} .toolbarKind=${a} .relativePosition=${c} .scale=${o} tooltip-appearance=calcite ${_(this.#s.ref)}><arcgis-toolbar ${_(this.#l)}>${M({hidden:!n?.visible||r!=="inline",children:this._renderActionGroup(n)})}${g.map(l=>this._renderActionGroup(l))}${M({hidden:!n?.visible||r!=="inline-end",children:this._renderActionGroup(n)})}</arcgis-toolbar>${M({hidden:!n?.visible||r!=="separate",children:v`<arcgis-toolbar>${this._renderActionGroup(n)}</arcgis-toolbar>`})}</arcgis-toolbar-stack></div>${M({hidden:this.hideSettingsMenu,children:v`<arcgis-view-popover .open=${this.#t.settingsPopoverOpen} .heading=${this._messages.settings?.heading} .anchorElement=${e} .visualScale=${o} .actionBarElement=${this.#l.value?.barElement} @arcgisPropertyChange=${l=>this.#t.settingsPopoverOpen=l.target.open??!1}>${this._renderSettings()}</arcgis-view-popover>`})}`}_renderSettings(){let{autoDestroyDisabled:e,hideLabelsToggle:t,hideSnappingControls:o,hideTooltipsToggle:s,showSnappingControlsElementsHeader:a,useViewOptions:c,view:r,viewModel:n}=this;return v`<div class="editing-controls-panel"><arcgis-sketch-tooltip-controls .hideLabelsToggle=${t} .hideTooltipsToggle=${c||s} .directionMode=${n.valueOptions.directionMode} .labelsEnabled=${n.labelOptions.enabled} .tooltipsEnabled=${n.tooltipOptions.enabled} @arcgisPropertyChange=${g=>{g.stopPropagation();let{labelsEnabled:l,tooltipsEnabled:u,directionMode:b}=g.currentTarget,f=this.viewModel;switch(g.detail.name){case"labelsEnabled":f.labelOptions.enabled=l;break;case"directionMode":f.valueOptions.directionMode=b;break;case"tooltipsEnabled":f.tooltipOptions.enabled=u;break}}}></arcgis-sketch-tooltip-controls>${!c&&!o?v`<arcgis-snapping-controls .autoDestroyDisabled=${e} .view=${r} .visibleElements=${this.#e.snappingControlsElements} .snappingOptions=${n.snappingOptions} .showHeader=${a} @arcgisPropertyChange=${g=>g.stopPropagation()}></arcgis-snapping-controls>`:void 0}</div>`}_renderActionGroup({visible:e,commands:t,name:o}){if(!e||!t.length)return;let{defaultPriority:s,groupKind:a,overflowLabel:c,preferEndSlot:r}=Ee[o],n=(o==="geometrySimplification"?void 0:this._groupLayoutPriorityOverrides.get(o))??s,g=t.map(u=>this._renderCommand(u)),l=se(`more.${c}`,this._messages);switch(a){case"more-button":return v`<arcgis-toolbar-group .priority=${n} .preferEndSlot=${r}><arcgis-toolbar-more-button .overflowActionLabel=${l} .priority=${n}>${g}</arcgis-toolbar-more-button></arcgis-toolbar-group>`;case"split-button":return v`<arcgis-toolbar-group .priority=${n} .preferEndSlot=${r}><arcgis-toolbar-split-button .overflowActionLabel=${l} .priority=${n}>${g}</arcgis-toolbar-split-button></arcgis-toolbar-group>`;case"actions":return v`<arcgis-toolbar-group .priority=${n} .preferEndSlot=${r}>${g}</arcgis-toolbar-group>`}}_renderCommand({active:e,afterCreate:t,afterRemoved:o,afterUpdate:s,appearance:a,icon:c,disabled:r,id:n,kind:g,labelKey:l,labelParameters:u,loading:b,tooltipKey:f,iconFlipRTL:C,onClick:m,refKey:S,textEnabled:V,renderAsAction:ce}){let{_messages:B,_refMap:he,layout:I}=this,P=se(l,B),L=P===void 0?l:u?de(P,u):P,D=B?.[f]??L,z=S?ae(he,S,k):this.#n,F={afterCreate:t,afterRemoved:o,afterUpdate:s};return ce?v`<arcgis-toolbar-action .active=${e} .appearance=${a} .disabled=${r} .icon=${c} .iconFlipRtl=${C} id=${n??A} .kind=${g} .loading=${b} .labelText=${I==="horizontal"?L:""} .textEnabled=${V} .tooltipText=${I==="horizontal"&&V?"":D} @arcgisToolbarItemSelected=${m} ${ne(F)} ${_(z)}></arcgis-toolbar-action>`:v`<arcgis-toolbar-item .active=${e} .disabled=${r} .icon=${c} id=${n??A} .iconFlipRtl=${C} .labelText=${L} .tooltipText=${D} @arcgisItemSelected=${m} ${ne(F)} ${_(z)}></arcgis-toolbar-item>`}};J("arcgis-sketch",$);return $},"intl","layers/GraphicsLayer","symbols/TextSymbol","core/reactiveUtils","widgets/Sketch/SketchViewModel","applications/Components/featureUtils","core/Accessor","core/accessorSupport/decorators","core/promiseUtils","widgets/Sketch/VisibleElements","widgets/support/SelectionToolbar/SelectionToolbarViewModel",a,b,c,d,e,f,g)
|