/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{initializeProjection as e,project as t}from"../../geometry/projectionUtils.js";import r from"../../geometry/SpatialReference.js";import{webMercatorToGeographic as o}from"../../geometry/support/webMercatorUtils.js";async function n(n){const i=n.spatialReference;if(i.isWGS84)return n.clone();if(i.isWebMercator)return o(n);const a=r.WGS84;return await e(i,a),t(n,a)}function i(e,t){if(!a(e,t)){const r=e.typeKeywords;r?r.push(t):e.typeKeywords=[t]}}function a(e,t){return!!e.typeKeywords?.includes(t)}function s(e){return a(e,E.HOSTED_SERVICE)}function c(e,t){const r=e.typeKeywords;if(r){const e=r.indexOf(t);e>-1&&r.splice(e,1)}}function u(e,t,r){r?i(e,t):c(e,t)}async function l(e){const t=e.clone().normalize();let r;if(t.length>1)for(const o of t)r?o.width>r.width&&(r=o):r=o;else r=t[0];return n(r)}const E={CHARTS:"Charts",CATALOG_LAYER:"CatalogLayer",DYNAMIC:"Dynamic",DEVELOPER_BASEMAP:"DeveloperBasemap",GROUP_LAYER_MAP:"Map",HOSTED_SERVICE:"Hosted Service",JSAPI:"ArcGIS API for JavaScript",LOCAL_SCENE:"ViewingMode-Local",METADATA:"Metadata",MULTI_LAYER:"Multilayer",ORIENTED_IMAGERY_LAYER:"OrientedImageryLayer",PARCEL_FABRIC:"ParcelFabric",SINGLE_LAYER:"Singlelayer",SUBTYPE_GROUP_LAYER:"SubtypeGroupLayer",SUBTYPE_GROUP_TABLE:"SubtypeGroupTable",TABLE:"Table",TILED_IMAGERY:"Tiled Imagery",UTILITY_NETWORK:"UtilityNetwork"};function f(e){const{portal:t,isOrgItem:r,itemControl:o}=e,n=t.user?.privileges;let i=!n||n.includes("features:user:edit"),a=!!r&&!!n?.includes("features:user:fullEdit");const s="update"===o||"admin"===o;return s?a=i=!0:a&&(i=!0),{features:{edit:i,fullEdit:a},content:{updateItem:s}}}export{i as addTypeKeyword,f as getUserPrivileges,l as getWGS84ExtentForItem,a as hasTypeKeyword,s as isHostedLayer,c as removeTypeKeyword,u as toggleTypeKeyword,E as typeKeyword};
