Liferay.Loader.define("@liferay/content-dashboard-web@2.0.69/js/components/SidebarPanelInfoView/FileUrlCopyButton",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react"],(function(e,t,r){var a;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r("@frontend-taglib-clay$clayui/button"),l=i(r("@frontend-taglib-clay$clayui/form")),o=r("frontend-js-web"),u=((a=r("liferay!frontend-js-react-web$prop-types"))&&a.__esModule,i(r("liferay!frontend-js-react-web$react")));function c(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return c=function(){return e},e}function i(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=c();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=a?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(r,n,l):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}const e=2e3;var f=({url:t})=>{const[r,a]=(0,u.useState)(!1),[c,i]=(0,u.useState)(null);return u.default.createElement("div",{className:"file-url-copy-button"},u.default.createElement(l.default.Group,null,u.default.createElement(l.ClayInput.Group,null,u.default.createElement(l.ClayInput.GroupItem,{prepend:!0},u.default.createElement(l.ClayInput,{readOnly:!0,type:"text",value:t})),u.default.createElement(l.ClayInput.GroupItem,{append:!0,shrink:!0},u.default.createElement(n.ClayButtonWithIcon,{displayType:"secondary",onClick:async()=>{try{await navigator.clipboard.writeText(t),a(!0),(0,o.openToast)({message:Liferay.Language.get("copied-link-to-the-clipboard")})}catch(e){i(e),a(!0),(0,o.openToast)({message:e,title:Liferay.Language.get("an-error-occurred"),type:"warning"})}finally{setTimeout((()=>{a(!1),i(null)}),e)}},symbol:r?"check":c?"exclamation-circle":"copy"})))))};t.default=f}}));
//# sourceMappingURL=FileUrlCopyButton.js.map