/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import e from"../request.js";function t(e){return null!=e&&"object"==typeof e&&"2d"===e.type&&"linkchart"===e.view2dType}async function r(t,r,n){if(!t||!r||!t.includes("/resources"))return!1;const s=r+"/resources",o=t.includes("/resources/")?t.split("/resources/")[1]:t;if(!o)return!1;const c=100;let u=1;for(;-1!==u;){const t=(await e(s,{query:{f:"json",start:u,num:c}})).data,r=t?.resources??[];for(const e of r)if(e.resource===o)return"number"==typeof n&&e.created===n;if(null==t.nextStart||!r.length)break;u=t.nextStart}return!1}async function n(t,r){if(!t.length||!r)return new Map;const n=r+"/resources",s=100;let o=1;const c=new Map;for(;-1!==o;){const t=(await e(n,{query:{f:"json",start:o,num:s}})).data,r=t?.resources??[];for(const e of r)"number"==typeof e.created&&c.set(e.resource,e.created);if(null==t.nextStart||!r.length)break;o=t.nextStart}const u=new Map;for(const e of t){const t=e.includes("/resources/")?e.split("/resources/")[1]:e,r=c.get(t);null!=r&&u.set(e,r)}return u}export{r as areResourcesSafe,n as getCreationDatesForResources,t as isLinkChartView};
