!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","esri/kernel"],e)}(function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=e("tslib"),r=e("esri/kernel");function n(e){return"}"!=(e="{"!=e[0]?"{"+e:e)[e.length-1]&&(e+="}"),e}t.getAuthenticationToken=function(e){return(e=r.id.findCredential(e))&&e.token||""},t.parsePortalItemUrl=function(e){if(e=e.match(/^(.*?)\/home\/item\.html\?id=(.*?)(\#.*)?$/))return{portalUrl:e[1],itemId:e[2]}},t.getPortalDataUrl=function(e,t){return e.portalUrl+"/sharing/rest/content/items/"+e.itemId+"?f=json&token="+t},t.getPortalItem=function(r,n,o){return i.__awaiter(this,void 0,void 0,function(){var t;return i.__generator(this,function(e){switch(e.label){case 0:return t=n.create(void 0,"arcgis"),o.finally(function(){t.cancel()}),t.request.url=r,[4,t.send()];case 1:if(!e.sent())throw console.error("Unable to get portal item.",t.response.message),Error("Unable to get portal item.");return[2,t.getResponseData(t.response.payload)]}})})},t.formatGlobalId=n,t.combineGlobalIds=function(e){return"["+e.map(function(e){return'"'+n(e)+'"'}).join(",")+"]"}});