/* COPYRIGHT Esri - https://js.arcgis.com/1.2/LICENSE.txt */
import a from"./YFLYHPA6.js";import{ka as u,nb as l,nc as f}from"./TRGFYBOH.js";import{u as c}from"./3GWWHA4S.js";export default $arcgis.t(([,{m:m}])=>{function D(e){let t="",r="?";return e.forEach(n=>{n.k&&n.v&&(t+=r+n.k+"="+n.v,r="&")}),t}function I(e){return e?f(e,{}).then(t=>Promise.resolve(!!t)):Promise.resolve(!1)}async function x(e,t){let r=t,n=await r.getUsername(),d={q:new c().match(e).in("title").and().match(n).in("owner"),filter:"type:Solution",authentication:r},h=(await l(d)).results.map(i=>i.title),{folders:p}=await u(r),w=p.map(i=>i.title),a=[...h,...w].map(i=>i.trim().toLowerCase()),o=e.toLowerCase(),y=a.filter(i=>i===o),v=a.filter(i=>i.startsWith(o));return{conflictingNames:y,similiarNames:v}}async function C(e,t){return E(e)?{status:!1,type:"empty"}:S(e)?{status:!1,type:"exceed length"}:T(e,"folder")?{status:!1,type:"special character"}:(await x(e.trim(),t)).conflictingNames.length>0?{status:!1,type:"not unique"}:{status:!0,type:""}}function E(e){return e.length<=0}function S(e){return e.length>m}function T(e,t){return(t==="item"?/[><~`$^+=|]/u:/[/<>]/u).test(e)}function U(e){if(e){let t=e.trim();return t?"<div>"+t+"</div>":""}else return""}function q(e){let t="",r="?";return e.forEach(n=>{n.k&&n.v&&(t+=r+n.k+"="+n.v,r="&")}),t}function b(e,t,r,n){let s="";return t?s=n+"/sharing/rest/content/items/"+e+"/info/"+t+q([{k:"w",v:"400"}]):s=r,s}function A(e){let t=e?e.replace("https://","").replace("www.",""):"";return t.endsWith("devext.arcgis.com")||t.endsWith("mapsqa.arcgis.com")||t.endsWith("qaext.arcgis.com")?e??"https://www.arcgis.com":"https://www.arcgis.com"}function M(e,t,r){return t.some(n=>n.wkid===e?(r=n.defaultExtent,!0):!1),r}function B(e,t){return g(t||e)}function F(e,t="en"){return new Intl.DateTimeFormat(t,{year:"numeric",month:"long",day:"numeric"}).format(e)}function O(e,t){let r="";return e.some(n=>n.startsWith(t)?(r=n.substring(t.length),!0):!1),r}function g(e){let t=e.replace("www.","");return t.endsWith("devext.arcgis.com")?"dev":t.endsWith("mapsqa.arcgis.com")||t.endsWith("qaext.arcgis.com")?"qa":t==="arcgis.com"||t.endsWith(".arcgis.com")?"prod":"dev"}function _(e,t){let r=e?.reduce((n,s)=>(n.indexOf(s.id)<0&&n.push(s.id),n),[])||[];return t?r.sort((n,s)=>t.indexOf(n)-t.indexOf(s)):r}function G(e){return e.charAt(0).toUpperCase()+e.slice(1)}function V(e){return{relevance:"Relevance",title:"Title",new:"New",created:"Date deployed",updated:"Updated",suggested:"Suggested for you"}[e]||e}function j(e){if(!e)return"Unknown error";if(e.message)return e.message;try{let t=JSON.stringify(e);return t&&t!=="{}"?t:e.toString()}catch{return e.toString()}}function z(e){return e?parseFloat(((Date.now()-e)/1e3).toFixed(2)):0}return{a:D,b:I,c:x,d:C,e:T,f:U,g:q,h:b,i:A,j:M,k:B,l:F,m:O,n:_,o:G,p:V,q:j,r:z}},"intl",a)