"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),w=require("react"),s=require("@devgateway/wp-react-lib"),n=require("semantic-ui-react"),k=r=>{const{"data-post-type":c,"data-download-style":u,"data-post-slug":d,"data-post-id":v,"data-media-id":x,"data-text":l,"data-agree":h="Agree","data-cancel":m="Cancel",intl:{locale:j}}=r,g=a=>{var t,i;return e.jsx("div",{class:"ui container entry-content",children:e.jsx("span",{dangerouslySetInnerHTML:{__html:(i=(t=a==null?void 0:a.posts)==null?void 0:t[0])==null?void 0:i.title.rendered},id:"agreement-text",class:"title"})})},[C,o]=w.useState(!1),p=({media:a})=>e.jsx(e.Fragment,{children:d&&e.jsx(s.PostProvider,{locale:j,type:c,slug:d,children:e.jsxs(n.Modal,{onClose:()=>o(!1),onOpen:()=>o(!0),open:C,trigger:e.jsx("span",{children:u=="link"?e.jsxs("a",{className:"agree-and-download link",children:[" ",l," "]}):e.jsx(n.Button,{className:"agree-and-download button",children:l})}),children:[e.jsx(n.Modal.Header,{className:"agreement-header",children:e.jsxs(s.PostConsumer,{children:[e.jsxs("svg",{width:"97",height:"97",viewBox:"0 0 97 97",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M48.6761 26L70.1999 47.5588C70.3676 47.7162 70.5012 47.9062 70.5925 48.1172C70.6839 48.3283 70.731 48.5558 70.731 48.7857C70.731 49.0157 70.6839 49.2432 70.5925 49.4542C70.5012 49.6652 70.3676 49.8553 70.1999 50.0126L48.6761 71.5714",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("path",{d:"M31.2041 26L52.7629 47.5588C53.084 47.8864 53.2639 48.3269 53.2639 48.7857C53.2639 49.2445 53.084 49.685 52.7629 50.0126L31.2041 71.5714",stroke:"white","stroke-linecap":"round","stroke-linejoin":"round"}),e.jsx("circle",{cx:"48.5",cy:"48.5",r:"48",stroke:"white"})]}),e.jsx(g,{...r})]})}),e.jsx(n.Modal.Content,{className:"agreement-body",children:e.jsx(s.PostConsumer,{children:e.jsx(s.Post,{preview:!0,showIntro:!0})})}),e.jsxs(n.Modal.Actions,{className:"agreement-footer",children:[e.jsx(n.Button,{className:"modal-cancel-button",onClick:()=>o(!1),children:m}),e.jsx(n.Button,{className:"modal-agree-button",content:h,onClick:()=>{o(!1);const t=document.createElement("a");t.href=a.guid.rendered+"?accepted=YES",document.body.appendChild(t),t.click(),document.body.removeChild(t)},positive:!0})]})]})})});return e.jsx("span",{className:"",children:e.jsx(s.MediaProvider,{id:x,children:e.jsx(s.MediaConsumer,{children:e.jsx(p,{})})})})};exports.default=k;
