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