import './async-D55cHugf.js';
import { d as bind_props } from './index-K3l_dLem.js';
import { I as IconButton } from './IconButton-BOK4HpdV.js';
import { c as createEventDispatcher } from './index-server-BzRj6e_1.js';
import './2-BYQShRaz.js';
import { S as ShareError } from './utils.svelte-DcXWObof.js';

function Community($$renderer) {
  $$renderer.push(`<svg id="icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="100%" height="100%"><path d="M23,20a5,5,0,0,0-3.89,1.89L11.8,17.32a4.46,4.46,0,0,0,0-2.64l7.31-4.57A5,5,0,1,0,18,7a4.79,4.79,0,0,0,.2,1.32l-7.31,4.57a5,5,0,1,0,0,6.22l7.31,4.57A4.79,4.79,0,0,0,18,25a5,5,0,1,0,5-5ZM23,4a3,3,0,1,1-3,3A3,3,0,0,1,23,4ZM7,19a3,3,0,1,1,3-3A3,3,0,0,1,7,19Zm16,9a3,3,0,1,1,3-3A3,3,0,0,1,23,28Z" fill="currentColor"></path></svg>`);
}
function ShareButton($$renderer, $$props) {
  $$renderer.component(($$renderer2) => {
    const dispatch = createEventDispatcher();
    let formatter = $$props["formatter"];
    let value = $$props["value"];
    let i18n = $$props["i18n"];
    let pending = false;
    IconButton($$renderer2, {
      Icon: Community,
      label: i18n("common.share"),
      pending,
      onclick: async () => {
        try {
          pending = true;
          const formatted = await formatter(value);
          dispatch("share", { description: formatted });
        } catch (e) {
          console.error(e);
          e instanceof ShareError ? e.message : "Share failed.";
        } finally {
          pending = false;
        }
      }
    });
    bind_props($$props, { formatter, value, i18n });
  });
}

export { Community as C, ShareButton as S };
//# sourceMappingURL=ShareButton-8xujn41z.js.map
