/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import a from"./EZAL5KYF.js";export default $arcgis.t(([{m:l}])=>{function g(o,t){let n=[];return o.forEach(e=>{t.has(e.id)&&n.push(e)}),n}function p(o,t,n){if(t<1||o.length<t)return{cards:[],paging:{start:t,num:0,nextStart:-1,total:o.length}};let e=Math.min(t+n,o.length+1),r=e<o.length?e:-1;return{cards:o.slice(t-1,e-1),paging:{start:t,num:e-t,nextStart:r,total:o.length}}}function y(o,t){let n=c(o);return d(n,t)}function d(o,t){let n=[];return t.forEach(e=>{let r=u(e);r&&o.indexOf(r)>=0&&e.relatedSolutions&&(n=n.concat(e.relatedSolutions))}),new Set(n)}function u(o){let t="solutionid-",n=o.typeKeywords.filter(r=>r.startsWith(t)),e=null;return Array.isArray(n)&&n.length>0&&(e=n[0].substring(t.length)),e}function c(o){let t=[];return o.forEach(n=>{let e=u(n);e&&t.push(e)}),t=Array.from(new Set(t)),t}function m(o){let t="solutionversion-",n=(o.typeKeywords||[]).reduce((e,r)=>(r.startsWith(t)&&(e=Number(r.replace(t,""))),e),-1);return isNaN(n)?-1:n}function w(o,t,n){let e,r=n==="asc"?1:-1;switch(t){case"created":e=(i,s)=>r*(i.createdMs<s.createdMs?-1:i.createdMs>s.createdMs?1:0);break;case"numviews":e=(i,s)=>r*(i.numViews<s.numViews?-1:i.numViews>s.numViews?1:0);break;case"title":e=(i,s)=>r*(i.title.toLowerCase()<s.title.toLowerCase()?-1:i.title.toLowerCase()>s.title.toLowerCase()?1:0);break;default:e=()=>0;break}return o.sort(e),o}function a(o){return o.toLowerCase().replace(/\s+/g,"-")}function h(o,t){return o.find(n=>a(n.title)===t||t===n.id)}function I(o,t){let n="solutionid-";return o.find(e=>l(e.typeKeywords,n)===t)}function b(o,t){let n=o.find(e=>t===e.deployCommonId);return a(n.title)}return{a:g,b:p,c:y,d:m,e:w,f:a,g:h,h:I,i:b}},a)