forked from bombastictranz/DuneQueryRepo
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew-6b9b1145d459eb74.js.download
2 lines (2 loc) · 45.8 KB
/
new-6b9b1145d459eb74.js.download
1
2
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1317],{94885:function(e){e.exports=function(e){if("function"!=typeof e)throw TypeError("Expected a function");return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}},53854:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/teams/new",function(){return n(89776)}])},24364:function(e,t,n){"use strict";n.d(t,{Z:function(){return j}});var r=n(85893),o=n(69015),i=n.n(o),a=n(94184),s=n.n(a),l=n(69932),d=n.n(l),u=n(27011),c=n.n(u),h=n(59999),L=n(32037),p=n(67294);function g(e){let{file:t}=e,n=(0,p.useRef)(null),[o,i]=(0,p.useState)(1);return(0,r.jsxs)(h.Vq,{label:"TODO",isOpen:!0,onDismiss:e.onClose,className:d().dialog,children:[(0,r.jsx)("h3",{children:"Crop your new profile picture"}),(0,r.jsx)(c(),{ref:n,image:t,scale:o,width:256,height:256,borderRadius:"user"===e.type?128:48,border:1,color:[255,255,255,1],backgroundColor:"white"}),(0,r.jsxs)("label",{className:d().scale,children:["Scale",(0,r.jsx)("br",{}),(0,r.jsx)("input",{type:"range",min:"1",max:"2",step:"0.01",value:o,onChange:e=>i(Number(e.target.value))})]}),(0,r.jsxs)("div",{className:d().buttonGroup,children:[(0,r.jsx)(L.lr,{size:"sm",onClick:e.onClose,children:"Cancel"}),(0,r.jsx)(L.lr,{color2:!0,onClick:function(){if(t&&n.current){let r=n.current.getImageScaledToCanvas();r.toBlob(n=>{n&&(e.setFile(new File([n],t.name,{type:t.type})),e.onClose())},t.type)}},children:"Done"})]})]})}var f=n(30297),m=n(91074),v=n(46615),y=n.n(v);let k=e=>{let t=s()(y().button,e.border&&y().border,e.color1&&y().color1,e.color2&&y().color2,e.light&&y().light,e.size&&y()[e.size],e.loading&&y().loading,e.className),{as:n="span"}=e;return p.createElement(n,{className:t},e.children)};var b=n(80949);function j(e){var t;let n=null!==(t=function(e){let[t,n]=(0,p.useState)(void 0);return(0,p.useEffect)(()=>{if(e){let t=new FileReader;t.onload=e=>{var t;"string"==typeof(null===(t=e.target)||void 0===t?void 0:t.result)?n(e.target.result):n(void 0)},t.readAsDataURL(e)}else n(void 0)},[e]),t}(e.newImageFile))&&void 0!==t?t:e.previouslySavedImageUrl,[o,a]=(0,p.useState)(void 0),[l,d]=(0,p.useState)(!1);return(0,r.jsxs)(m.Z,{className:s()(i().avatarWrapper,i().buttonAlwaysVisible),children:[(0,r.jsx)(f.q,{src:n,size:80,ownerId:e.ownerId,handle:e.handle,type:e.type}),(0,r.jsx)(k,{as:"label",size:"sm",children:(0,r.jsxs)(m.Z,{gap:"small",children:[(0,r.jsx)("span",{"aria-live":"polite","aria-label":"Set new profile picture",children:"Edit"}),(0,r.jsx)(b.J,{icon:"edit","aria-hidden":!0}),(0,r.jsx)("input",{type:"file",accept:"image/*",onChange:function(e){var t;let n=null===(t=e.target.files)||void 0===t?void 0:t[0];e.target.value="",n&&n.type.startsWith("image/")&&(a(n),d(!0))}})]})}),o&&l&&(0,r.jsx)(g,{file:o,setFile:e.setNewImageFile,onClose:()=>d(!1),type:e.type})]})}},36007:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(82729),o=n(76138),i=n(84937),a=n(39137),s=n(70794);function l(){let e=(0,r._)(['\n mutation GenerateUploadUrl($fileType: String!, $contentLength: BigNumber!) {\n generateUploadUrl(fileType: $fileType, contentLength: $contentLength, uploadType: "profile_image") {\n url\n }\n }\n']);return l=function(){return e},e}async function d(e,t){try{let n=await c(e,t);await u(t,n);let r=n.split("?")[0];return r}catch(e){throw Error("Failed to upload image")}}async function u(e,t){let n=await e.arrayBuffer(),r=await fetch(t,{method:"PUT",body:n,headers:{"x-amz-acl":"public-read","Content-Type":e.type}});if(!r.ok)throw Error("Failed to upload blob: ${response.error}")}let c=async(e,t)=>{var n,r;let a=await o.bj.mutate({mutation:i.rzt,variables:{contentLength:(0,s.Z)(t.size),fileType:t.type.replace("image/","")},context:{session:e},fetchPolicy:"no-cache"}),l=null===(r=a.data)||void 0===r?void 0:null===(n=r.generateUploadUrl)||void 0===n?void 0:n.url;if(!l)throw Error("GenerateUploadUrl did not return a URL");return l};(0,a.Z)(l())},82327:function(e,t,n){"use strict";n.d(t,{Z:function(){return u}});var r=n(85893),o=n(37242),i=n(11163),a=n(67294),s=n(57831),l=n(10475),d=n(71909);function u(e){return function(t){let n=(0,i.useRouter)(),u=(0,d.J)(),{session:c,sessionLoading:h}=(0,a.useContext)(s.B3),L=(0,a.useMemo)(()=>(null==c?void 0:c.user)?{...c,user:c.user}:void 0,[c]);return h||(0,l.s$)()||!n.isReady?(0,r.jsx)(o.h,{}):L?(0,r.jsx)(e,{...t,session:L}):(n.replace(u),(0,r.jsx)(o.h,{}))}}},35921:function(e,t,n){"use strict";n.d(t,{Z:function(){return d}});var r=n(82729),o=n(51577),i=n(57831),a=n(39137),s=n(84937);function l(){let e=(0,r._)(["\n query FindOwnProfile($id: Int!) {\n user(id: $id) {\n id\n name\n profileImageUrl\n bio\n isAvailableForGigs\n discordUsername\n twitterHandle\n telegramHandle\n receivedStars\n firstQueryCreatedDate\n createdAt\n privateFields {\n id\n ethereumAddressIsPublic\n ethereumAddress\n email\n serviceTier {\n id\n name\n }\n }\n }\n }\n"]);return l=function(){return e},e}function d(){var e;let t=(0,i.kP)(),{data:n,loading:r,refetch:a,error:l}=(0,s.Xsn)({notifyOnNetworkStatusChange:!0,context:{session:t},variables:{id:(null==t?void 0:null===(e=t.user)||void 0===e?void 0:e.id)||-1},onError:e=>{o.k.error(e)}});return{data:function(e){var t,n,r,o,i,a,s,l,d,u,c,h,L,p;if(e)return{id:e.id,name:e.name,is_available_for_gigs:null!==(i=e.isAvailableForGigs)&&void 0!==i&&i,email:null!==(a=null===(t=e.privateFields)||void 0===t?void 0:t.email)&&void 0!==a?a:"",profile_image_url:null!==(s=e.profileImageUrl)&&void 0!==s?s:"",bio:null!==(l=e.bio)&&void 0!==l?l:"",discord_username:null!==(d=e.discordUsername)&&void 0!==d?d:"",telegram_handle:null!==(u=e.telegramHandle)&&void 0!==u?u:"",twitter_handle:null!==(c=e.twitterHandle)&&void 0!==c?c:"",user_service_tier_name:null!==(h=null===(n=e.privateFields)||void 0===n?void 0:n.serviceTier.name)&&void 0!==h?h:"",ethereum_address_is_public:null!==(L=null===(r=e.privateFields)||void 0===r?void 0:r.ethereumAddressIsPublic)&&void 0!==L&&L,received_stars:e.receivedStars,firstQueryCreatedDate:e.createdAt,ethereum_address:null!==(p=null===(o=e.privateFields)||void 0===o?void 0:o.ethereumAddress)&&void 0!==p?p:void 0}}(null==n?void 0:n.user),loading:r,refetch:()=>{var e;a({id:(null==t?void 0:null===(e=t.user)||void 0===e?void 0:e.id)||-1})},error:l}}(0,a.Z)(l())},89776:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return G}});var r=n(82327),o=n(85893),i=n(31821);function a(){return(0,o.jsxs)("svg",{width:"114",height:"40",viewBox:"0 0 114 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,o.jsx)("path",{d:"M19.9892 39.9687C31.0277 39.9687 39.9762 31.0214 39.9762 19.9844C39.9762 8.94735 31.0277 7.62939e-05 19.9892 7.62939e-05C8.95059 7.62939e-05 0.0020752 8.94735 0.0020752 19.9844C0.0020752 31.0214 8.95059 39.9687 19.9892 39.9687Z",fill:"#F06040"}),(0,o.jsx)("path",{d:"M31.6481 3.75372C28.4375 1.44772 24.6152 0.145416 20.6644 0.0114806C16.7136 -0.122454 12.8118 0.918 9.4524 3.00127C6.09302 5.08454 3.42692 8.11706 1.79125 11.7154C0.155579 15.3136 -0.376194 19.3161 0.263175 23.2166C0.902544 27.117 2.68434 30.7404 5.38324 33.6283C8.08214 36.5163 11.5769 38.5392 15.4257 39.4412C19.2744 40.3433 23.3042 40.0839 27.0056 38.696C30.7069 37.3081 33.9135 34.8539 36.2198 31.6438C37.7512 29.5124 38.8477 27.1002 39.4467 24.5451C40.0457 21.99 40.1355 19.3419 39.711 16.752C39.2865 14.1622 38.3559 11.6813 36.9725 9.45108C35.5891 7.22082 33.7798 5.28486 31.6481 3.75372Z",fill:"#F1603F"}),(0,o.jsx)("path",{d:"M3.47949 31.257C3.47949 31.257 16.6871 26.9308 39.9651 19.3408C39.9651 19.3408 41.2401 31.7705 28.3541 38.2539C28.3541 38.2539 21.9997 41.2994 15.0284 39.3458C15.0284 39.3458 8.08667 38.0355 3.47949 31.257Z",fill:"#2B286C"}),(0,o.jsx)("path",{d:"M52 10H58.9306C60.1676 10 61.2863 10.2066 62.2868 10.6197C63.3055 11.0329 64.1695 11.6526 64.879 12.4789C65.6066 13.2864 66.1614 14.3099 66.5434 15.5493C66.9436 16.77 67.1437 18.1972 67.1437 19.831C67.1437 21.4648 66.9436 22.9014 66.5434 24.1408C66.1614 25.3615 65.6066 26.385 64.879 27.2113C64.1695 28.0188 63.3055 28.6291 62.2868 29.0423C61.2863 29.4554 60.1676 29.662 58.9306 29.662H52V10ZM58.9306 26.3662C60.2767 26.3662 61.3409 25.9624 62.1231 25.1549C62.9235 24.3286 63.3237 23.0704 63.3237 21.3803V18.2817C63.3237 16.5915 62.9235 15.3427 62.1231 14.5352C61.3409 13.7089 60.2767 13.2958 58.9306 13.2958H55.6017V26.3662H58.9306Z",fill:"#2A2C2F"}),(0,o.jsx)("path",{d:"M78.8344 27.2113H78.698C78.5707 27.5869 78.3978 27.9437 78.1796 28.2817C77.9795 28.6009 77.7157 28.892 77.3883 29.1549C77.079 29.4178 76.697 29.6244 76.2423 29.7746C75.8057 29.9249 75.2963 30 74.7142 30C73.2408 30 72.113 29.5023 71.3308 28.507C70.5486 27.5117 70.1575 26.0939 70.1575 24.2535V14.9577H73.6501V23.8873C73.6501 24.9014 73.8411 25.6808 74.2231 26.2254C74.6051 26.7512 75.2145 27.0141 76.0513 27.0141C76.3969 27.0141 76.7334 26.9671 77.0608 26.8732C77.4065 26.7793 77.7066 26.6385 77.9613 26.4507C78.2159 26.2441 78.4251 26 78.5888 25.7183C78.7526 25.4178 78.8344 25.0704 78.8344 24.6761V14.9577H82.327V29.662H78.8344V27.2113Z",fill:"#2A2C2F"}),(0,o.jsx)("path",{d:"M86.0895 29.662V14.9577H89.5821V17.4085H89.7185C90.0096 16.6197 90.4643 15.9624 91.0828 15.4366C91.7195 14.892 92.5926 14.6197 93.7023 14.6197C95.1757 14.6197 96.3035 15.1174 97.0857 16.1127C97.8679 17.108 98.259 18.5258 98.259 20.3662V29.662H94.7664V20.7324C94.7664 19.6808 94.5845 18.892 94.2207 18.3662C93.8569 17.8404 93.2566 17.5775 92.4198 17.5775C92.056 17.5775 91.7013 17.6338 91.3557 17.7465C91.0282 17.8404 90.7281 17.9906 90.4552 18.1972C90.2006 18.385 89.9914 18.6291 89.8277 18.9296C89.6639 19.2113 89.5821 19.5493 89.5821 19.9437V29.662H86.0895Z",fill:"#2A2C2F"}),(0,o.jsx)("path",{d:"M107.615 30C106.56 30 105.614 29.8216 104.777 29.4648C103.959 29.0892 103.258 28.5728 102.676 27.9155C102.112 27.2394 101.676 26.4319 101.367 25.493C101.057 24.5352 100.903 23.4648 100.903 22.2817C100.903 21.1174 101.048 20.0657 101.339 19.1268C101.649 18.1878 102.085 17.3897 102.649 16.7324C103.213 16.0563 103.904 15.5399 104.723 15.1831C105.541 14.8075 106.469 14.6197 107.506 14.6197C108.616 14.6197 109.58 14.8169 110.398 15.2113C111.217 15.6056 111.89 16.1408 112.417 16.8169C112.945 17.493 113.336 18.2817 113.591 19.1831C113.864 20.0657 114 21.0141 114 22.0282V23.2113H104.532V23.5775C104.532 24.6479 104.823 25.5117 105.405 26.169C105.987 26.8075 106.851 27.1268 107.997 27.1268C108.87 27.1268 109.58 26.939 110.125 26.5634C110.689 26.1878 111.19 25.7089 111.626 25.1268L113.509 27.2958C112.927 28.1408 112.126 28.8075 111.108 29.2958C110.107 29.7653 108.943 30 107.615 30ZM107.561 17.3239C106.633 17.3239 105.896 17.6432 105.35 18.2817C104.805 18.9202 104.532 19.7465 104.532 20.7606V20.9859H110.371V20.7324C110.371 19.7183 110.125 18.9014 109.634 18.2817C109.161 17.6432 108.47 17.3239 107.561 17.3239Z",fill:"#2A2C2F"})]})}function s(){return(0,o.jsxs)("svg",{width:"100%",height:"100%",viewBox:"0 0 480 362",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,o.jsxs)("g",{clipPath:"url(#clip0_560_169391)",children:[(0,o.jsx)("path",{d:"M243.856 325.404L223.202 359.841L192.126 361.368",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M119.532 328.257L142.026 295.397L164.06 262.055L185.515 228.281L206.309 194.135L226.373 159.668L245.617 124.96L272.962 123.152L290.235 88.0416L306.479 52.8512L330.123 50.2796L352.148 47.286L372.412 43.9105",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M245.616 124.96L263.97 90.0404L281.383 54.9706L297.796 19.8103L321.651 17.6104L343.955 15.0084L364.559 12.0349",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M321.652 17.6104L306.479 52.8508",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M343.956 15.0079L330.123 50.2788L315.16 85.5495",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M364.56 12.0348L352.147 47.2856L338.564 82.5864L323.841 117.907L308.008 153.198L291.085 188.409L273.131 223.489L244.836 225.779L215.55 227.386L185.514 228.281L180.753 222.585L176.132 217.059L171.631 211.675L167.251 206.441L162.99 201.348L158.849 196.385L154.808 191.563L150.877 186.852L147.047 182.271L143.306 177.8L145.616 148.427L147.457 118.932L148.837 89.3372L149.757 59.6518L150.227 29.8661L150.237 0",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M383.333 8.72925L372.411 43.9096L360.289 79.1903L346.986 114.542L332.523 149.903L316.91 185.254L300.197 220.525L282.414 255.685L263.61 290.664L243.856 325.403L213.61 327.382L182.624 328.527L151.167 328.819L119.531 328.256L98.067 358.574L96.6667 360.553",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M263.61 290.665L234.335 293.036L204.129 294.623L173.273 295.426L142.026 295.397",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M282.414 255.685L254.198 258.377L224.892 260.356L194.756 261.592L164.06 262.054",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M300.196 220.525L273.131 223.488L254.197 258.377L234.333 293.035L213.609 327.382L192.125 361.367L160.479 362",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M316.91 185.254L291.085 188.409L263.899 190.96L244.836 225.779L224.892 260.357L204.128 294.623L182.623 328.528L160.479 362L128.562 361.729",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M134.224 260.809L137.335 236.157",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M346.986 114.541L323.842 117.906L299.107 120.79L272.962 123.15L254.718 158.11L235.564 192.878L215.55 227.385L194.756 261.591L173.272 295.426L151.167 328.818L128.563 361.728L96.6667 360.553",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M360.289 79.1903L338.565 82.5859L315.16 85.5493L299.107 120.79L282.004 155.94L263.9 190.96L235.564 192.879L206.309 194.134L199.477 188.981L192.826 183.978L186.365 179.116L180.073 174.374L173.952 169.763L167.981 165.273L162.17 160.893L156.509 156.633L150.998 152.475L154.468 122.548L157.449 92.511L159.949 62.3636L161.95 32.1158L163.48 1.77759",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M249.737 13.3508L266.61 11.9443L282.494 10.2466L302.528 11.7937L323.012 13.381L343.956 15.0083",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M281.373 17.6001L297.796 19.8101",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M265.36 15.4503L281.374 17.6003L302.868 15.6713L321.652 17.6103",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M234.484 11.3112L249.107 10.1457L262.899 8.72937L275.772 7.08197L297.286 8.28742L310.889 6.07739",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M150.237 0L151.307 0.140533L152.007 0.241089L152.077 0.251145L163.479 1.77812L177.022 3.59623L190.885 5.4548L205.077 7.3634L219.6 9.31247L234.483 11.3116L249.736 13.3509L265.359 15.4503L284.523 13.7828L302.527 11.7938L319.25 9.51334L334.573 6.94155L358.718 7.82571L383.333 8.72974",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M219.601 9.31236L232.004 8.37792L243.716 7.24286L254.688 5.9067L264.83 4.38977",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M150.227 29.8665L161.949 32.1167L173.962 34.4072L186.264 36.7678L198.857 39.1789L211.769 41.6502L225.002 44.1817L238.565 46.7736L252.467 49.4356L266.74 52.1681L281.383 54.9709L306.478 52.8511",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M149.757 59.6519L159.949 62.3642L170.382 65.1368L181.074 67.9799L192.036 70.8933L203.268 73.8869L214.79 76.9507L226.603 80.0951L238.735 83.3198L251.187 86.635L263.97 90.0404L290.235 88.0413L315.16 85.5499",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M205.078 7.36313L215.28 6.65998L224.952 5.78612L234.023 4.75137L242.435 3.56604",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M148.837 89.3367L157.449 92.5111L166.271 95.7561L175.323 99.081L184.594 102.497L194.116 106.003L203.878 109.589L213.9 113.286L224.182 117.073L234.754 120.961L245.616 124.959",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M128.902 285.321L131.153 276.42L132.433 270.694L134.223 260.809L137.754 241.391L137.334 236.157L140.545 207.044L143.305 177.801",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M96.6667 360.553L100.388 353.029L101.658 351.07L116.531 328.196L121.132 321.124L141.496 288.716L161.4 255.846L180.753 222.585L199.477 188.981L217.501 155.087L234.754 120.961L251.187 86.6348L266.74 52.1676L281.373 17.6001",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M100.388 353.029L103.998 345.716L105.148 343.777L109.219 336.916L114.41 328.156L122.682 314.192L140.986 282.206L158.819 249.819L176.133 217.06L192.826 183.979L208.869 150.637L224.182 117.074L238.735 83.3198L252.468 49.4353L265.36 15.4503",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M190.886 5.45441L198.937 4.98229L206.579 4.36939L213.76 3.62601L220.442 2.76221",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M103.998 345.715L107.519 338.603L108.539 336.694L112.169 329.913L115.7 323.313L124.192 307.461L140.485 275.887L156.318 243.951L171.631 211.674L186.364 179.116L200.467 146.296L213.9 113.286L226.602 80.0947L238.564 46.7728L249.737 13.3505",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M147.457 118.932L154.468 122.549L161.65 126.255L169.021 130.063L176.573 133.971L184.334 137.969L192.296 142.078L200.467 146.297L208.869 150.637L217.501 155.087L226.373 159.668L254.718 158.111L282.004 155.941L308.009 153.198L332.524 149.903",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M107.519 338.603L110.93 331.692L115.041 323.102L118.161 316.573L125.663 300.911L127.793 296.27L139.996 269.749L153.878 238.246L167.251 206.441L180.074 174.374L192.296 142.077L203.878 109.589L214.791 76.9502L225.003 44.181L234.484 11.3112",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M119.532 328.256L121.132 321.123L122.682 314.192L124.193 307.461L125.663 300.911L127.093 294.532L128.943 289.961L139.526 263.772L151.508 232.69L162.99 201.347L173.952 169.763L184.334 137.968L194.116 106.003L203.268 73.8864L211.77 41.6494L219.601 9.31201",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M164.06 262.054L161.4 255.846L158.819 249.818L156.319 243.951L153.878 238.245L151.508 232.69L149.197 227.285L146.947 222.031L144.756 216.908L142.626 211.915L140.545 207.043",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M150.998 152.475L145.617 148.427",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M142.026 295.397L141.495 288.716L140.985 282.207L140.485 275.888L139.995 269.75L139.525 263.773L139.065 257.946L138.615 252.29L138.175 246.765L137.755 241.391L142.626 211.916L147.046 182.271L150.997 152.475",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M177.022 3.59604L182.943 3.33509L188.585 2.97333L193.896 2.52132L198.857 1.96875",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M163.48 1.77805L167.31 1.72777L170.961 1.6071L174.412 1.4364L177.652 1.19531",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M150.237 0L152.007 0.150589L153.547 0.281312L167.31 1.72785L182.943 3.33527L198.936 4.98267L215.279 6.66024L232.003 8.37803L249.106 10.1461L266.61 11.9443L284.523 13.7828L302.867 15.6713L323.011 13.3811L341.664 10.759L364.559 12.0348L383.333 8.72974",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M153.699 0.271118L155.309 0.361373L174.413 1.43634L193.897 2.52137L213.76 3.62626L234.024 4.7515L254.688 5.90667L275.773 7.0822L287.645 5.22363L310.89 6.07762L334.574 6.94142",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M115.04 323.103L120.561 310.023L123.212 303.744L127.093 294.533L128.483 288.334L132.054 278.078L139.065 257.946L149.197 227.286L158.849 196.385L167.981 165.273L176.573 133.971L184.594 102.497L192.036 70.8932L198.857 39.1786L205.078 7.3634",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M120.561 310.023L125.152 297.435L128.483 288.334L129.833 282.297L131.154 276.42L132.494 272.09L138.615 252.29L146.947 222.032L154.808 191.563L162.17 160.893L169.021 130.063L175.322 99.0812L181.073 67.9795L186.265 36.7671L190.885 5.45447",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M155.449 0.37207L156.819 0.422348L177.653 1.19589L198.857 1.96944L220.441 2.7631L242.436 3.56681L264.83 4.39039L287.645 5.22427",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M125.152 297.436L128.903 285.321L129.833 282.297L132.494 272.09L133.524 266.415L138.175 246.765L144.756 216.909L150.877 186.852L156.508 156.634L161.649 126.256L166.27 95.7567L170.381 65.1369L173.962 34.4069L177.022 3.59631",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M152.007 0.151367L152.648 0.221756L153.618 0.292146L154.518 0.342178L170.961 1.60796L188.585 2.97429L206.578 4.37055L224.952 5.78716L243.716 7.24376L262.899 8.73051L282.493 10.2474L297.286 8.28856L319.25 9.51411L341.665 10.7598L358.718 7.82649",stroke:"#F4603E",strokeWidth:"0.44",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,o.jsx)("defs",{children:(0,o.jsx)("clipPath",{id:"clip0_560_169391",children:(0,o.jsx)("rect",{width:"480",height:"362",fill:"white"})})})]})}var l=n(40691),d=n.n(l);function u(e){return(0,o.jsxs)("div",{className:d().sidePanel,children:[(0,o.jsx)("div",{className:d().logo,children:(0,o.jsx)(a,{})}),(0,o.jsxs)("div",{className:d().content,children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{children:function(e){switch(e){case"create":return(0,o.jsx)(o.Fragment,{children:"Dune is better with your team."});case"upgrade":return(0,o.jsx)(o.Fragment,{children:"Create a team to upgrade your plan."})}}(e.origin)}),(0,o.jsx)("div",{className:d().description,children:function(e){switch(e){case"create":return"Make collaboration easier with your coworkers, schoolmates, or crypto frens: create a Dune team and share your credits, ownership and edit rights of queries and dashboards with your teammates.";case"upgrade":return"To get the most out of Dune and use it for professional purposes or collaborate with your team, get started by creating a team or upgrading an existing one."}}(e.origin)})]}),(0,o.jsx)("div",{className:d().illustration,children:(0,o.jsx)(s,{})})]})]})}var c=n(36179),h=n.n(c),L=n(94184),p=n.n(L),g=n(67294),f=n(82729),m=n(84937),v=n(39137);function y(){let e=(0,f._)(["\n query PublicTeamServiceTiers {\n teamServiceTiers(\n orderBy: [\n { key: baseMonthlyPriceDollarsCents, direction: ASC }\n { key: baseAnnuallyPriceDollarsCents, direction: ASC }\n ]\n ) {\n results {\n id\n name\n base_monthly_price_dollars_cents: baseMonthlyPriceDollarsCents\n base_annually_price_dollars_cents: baseAnnuallyPriceDollarsCents\n is_public: isPublic\n included_nanocredits: includedNanocredits\n nanocredits_cost_cents: nanocreditsCostCents\n max_private_dashboards: maxPrivateDashboards\n max_private_queries: maxPrivateQueries\n can_use_crud_endpoints: canUseCrudEndpoints\n allow_private_queries_as_views: allowPrivateQueriesAsViews\n api_calls_per_minute: apiCallsPerMinute\n max_query_event_retention_days: maxQueryEventRetentionDays\n max_folders: maxFolders\n remove_watermark: removeWatermark\n catalog_storage_quota_bytes: catalogStorageQuotaBytes\n max_query_schedules: maxQuerySchedules\n max_dashboard_schedules: maxDashboardSchedules\n max_alert_queries: maxAlertQueries\n }\n }\n }\n"]);return y=function(){return e},e}let k=()=>{let{data:e}=(0,m.fqq)({fetchPolicy:"cache-first"});return null==e?void 0:e.teamServiceTiers.results};(0,v.Z)(y());var b=n(27728),j=n(49838),w=n.n(j),x=n(71320);function _(e){let t=k(),{setCadence:n,activeCadence:r}=(0,x.L)();return t?(0,o.jsx)("div",{className:w().pricingCards,children:(0,o.jsx)(b.d,{setCadence:n,cadence:r,teamHandle:e.teamHandle,teamServiceTiers:t,origin:"new_team"})}):null}var C=n(54173),M=n(61451),P=n(50642),E=n(99134),S=n(10398),F=n(24364),I=n(36007),O=n(57831),T=n(13426),D=n(35921),W=n(76138),U=n(45466);function R(){let e=(0,f._)(["\n mutation CreateTeam($input: CreateTeamInput!) {\n createTeam(input: $input) {\n id\n }\n }\n"]);return R=function(){return e},e}let A=async(e,t)=>{var n,r,o,i;if(!e.name)throw Error("Missing team name.");if(!e.handle)throw Error("Missing team handle.");if(!e.email)throw Error("Missing team email.");if(!N(e.handle))throw Error("Invalid team handle.");let a=await W.bj.mutate({mutation:m.MA0,variables:{input:{name:e.name,handle:e.handle.toLowerCase(),email:e.email,profileImageUrl:e.profileImageUrl}},context:{session:t},fetchPolicy:"no-cache"});if(!(null===(r=a.data)||void 0===r?void 0:null===(n=r.createTeam)||void 0===n?void 0:n.id))throw Error("Team creation failed");return await (0,U.vL)(t).catch(e=>{}),null===(i=a.data)||void 0===i?void 0:null===(o=i.createTeam)||void 0===o?void 0:o.id},N=e=>!(e.length<1)&&!(e.length>=42)&&!!/^[a-zA-Z0-9_-]+$/.test(e);(0,v.Z)(R());var V=n(50456),H=n.n(V),Z=n(85361);function z(e){var t;let n=(0,O.Ke)(),{data:r}=(0,D.Z)(),[i,a]=(0,g.useState)(!1),[s,l]=(0,g.useState)(),[d,u]=(0,g.useState)(void 0),[c,h]=(0,g.useState)(null!==(t=e.defaultName)&&void 0!==t?t:""),[L,p]=(0,g.useState)(""),[f,m]=(0,g.useState)("");(0,g.useEffect)(()=>{var e;m(null!==(e=null==r?void 0:r.email)&&void 0!==e?e:"")},[null==r?void 0:r.email]);let v=(0,g.useMemo)(()=>L.trim()||(0,T.Cu)(c),[L,c]),y=t=>{if(t.preventDefault(),!(0,T.k_)(v)){l(Error("Team handle may only contain up to 41 letters, numbers and underscores (_)."));return}a(!0),l(void 0),(async function(){let e=d?await (0,I.Z)(n,d):null,t=await A({name:c,handle:v,email:f,profileImageUrl:e},n);(0,Z._7)({id:t,type:"team"})})().then(()=>{e.onCreate(v)}).catch(e=>{l(B(e)),a(!1)})};return(0,o.jsxs)(P.l,{size:"L",onSubmit:e=>y(e),children:[(0,o.jsx)(F.Z,{newImageFile:d,setNewImageFile:u,type:"team",ownerId:void 0,handle:void 0}),(0,o.jsx)(S.U,{size:"L",style:"contained",placeholder:"Wizard collective...",label:"Display name",hint:"This will appear on the public team profile",onChange:e=>h(e.target.value),value:c}),(0,o.jsx)(S.U,{size:"L",style:"contained",placeholder:v||"wizard_collective",label:"Team handle",hint:"dune.com/".concat(""===L?v||"wizard_collective":L),onChange:e=>p(e.target.value),value:L}),(0,o.jsx)(S.U,{size:"L",style:"contained",placeholder:f,label:"Invoicing email",hint:"We will send any invoices to this email address",onChange:e=>m(e.target.value),value:f}),s&&(0,o.jsxs)("div",{className:H().error,role:"alert",children:[(0,o.jsx)(E.IconWarning,{}),s.message]}),(0,o.jsxs)("div",{className:H().buttons,children:[(0,o.jsx)(C.A,{size:"L",theme:"tertiary",type:"button",href:"/",children:"Cancel"}),(0,o.jsx)(M.z,{size:"L",theme:"primary",disabled:!c.trim(),loading:i,type:"submit",children:i?"Creating team":"Create team"})]})]})}let B=e=>e.message.includes("Team handle already in use")?Error("Team handle taken. Please pick a different handle."):e.message.includes("Invalid input for creating a team")?Error("Team handle may only contain up to 41 letters, numbers and underscores (_)."):Error("Something went wrong.");function q(){let[e,t]=(0,g.useState)("create"),[n,r]=(0,g.useState)("");return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Q,{percentage:"create"===e?50:100}),(0,o.jsxs)("div",{className:H().content,children:[(0,o.jsxs)("div",{className:H().steps,children:[(0,o.jsx)("div",{className:p()("create"===e&&H().activeStep),children:"1. Name your team"}),(0,o.jsx)("div",{className:p()("selectPlan"===e&&H().activeStep),children:"2. Select plan"})]}),(0,o.jsx)($,{activeStep:e,onCreate:e=>{t("selectPlan"),r(e)},teamHandle:n})]})]})}function $(e){let{activeStep:t,onCreate:n,teamHandle:r}=e;switch(t){case"create":return(0,o.jsx)(z,{onCreate:n});case"selectPlan":return(0,o.jsx)(_,{teamHandle:r});default:return null}}let Q=e=>{let{percentage:t}=e;return(0,o.jsx)("div",{className:p()(H().progressbar),style:{"--progress":"".concat(t,"%")},children:(0,o.jsx)("div",{})})};var X=n(11163),G=(0,r.Z)(function(){let e=function(){let{origin:e}=(0,X.useRouter)().query;switch(e){case"create":case"upgrade":return e;default:return"create"}}();return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(i.yG,{title:"Create team"}),(0,o.jsxs)("div",{className:h().page,children:[(0,o.jsx)("div",{className:h().leftSidePanel,children:(0,o.jsx)(u,{origin:e})}),(0,o.jsx)("div",{className:h().content,children:(0,o.jsx)(q,{})})]})]})})},69932:function(e){e.exports={dialog:"AvatarEditorDialog_dialog__6IYgj",scale:"AvatarEditorDialog_scale__suDgJ",buttonGroup:"AvatarEditorDialog_buttonGroup___D4Kh"}},36179:function(e){e.exports={page:"CreateTeam_page__6l_ZO",leftSidePanel:"CreateTeam_leftSidePanel__dqBXS",content:"CreateTeam_content___kymv"}},40691:function(e){e.exports={sidePanel:"LeftSidePanel_sidePanel__cLIYC",logo:"LeftSidePanel_logo__VmWij",description:"LeftSidePanel_description__2Tvd8",content:"LeftSidePanel_content__xHIcK",illustration:"LeftSidePanel_illustration__yJHt4"}},50456:function(e){e.exports={content:"RightSidePanel_content__69le3",steps:"RightSidePanel_steps__FIG_a",activeStep:"RightSidePanel_activeStep__TlNJs",progressbar:"RightSidePanel_progressbar__kdIM_",buttons:"RightSidePanel_buttons__DwmFM",error:"RightSidePanel_error__VkpvB"}},49838:function(e){e.exports={pricingCards:"SelectPlan_pricingCards__iip6H"}},69015:function(e){e.exports={profile:"UserProfile_profile__Y_UoE",public:"UserProfile_public__TwzIv","profile-content":"UserProfile_profile-content__TBtsd","profile-title":"UserProfile_profile-title__6PBsL","profile-user-details":"UserProfile_profile-user-details__DZE82",vcardAndStats:"UserProfile_vcardAndStats__6ZQE2",vcard:"UserProfile_vcard__iNOWy",leftList:"UserProfile_leftList__51a3W",rightList:"UserProfile_rightList__bfuhc",bioLengthWarning:"UserProfile_bioLengthWarning__RPDtg",avatarWrapper:"UserProfile_avatarWrapper__pXA0x",buttonAlwaysVisible:"UserProfile_buttonAlwaysVisible__3Ilro",private:"UserProfile_private__EQYb9"}},27011:function(e,t,n){e.exports=function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=n(e),o=n(t);function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t){var n,r=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)),r}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){a(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function L(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}return n}}(e,t)||p(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){if(e){if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?g(e,t):void 0}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t){return new Promise(function(n,r){var o=new Image;o.onload=function(){return n(o)},o.onerror=r,!1==(null!==e&&!!e.match(/^\s*data:([a-z]+\/[a-z]+(;[a-z-]+=[a-z-]+)?)?(;base64)?,[a-z0-9!$&',()*+;=\-._~:@/?%\s]*\s*$/i))&&t&&(o.crossOrigin=t),o.src=e})}var m,v=!("undefined"==typeof window||"undefined"==typeof navigator||!("ontouchstart"in window||0<navigator.msMaxTouchPoints)),y="undefined"!=typeof File,k={touch:{react:{down:"onTouchStart",mouseDown:"onMouseDown",drag:"onTouchMove",move:"onTouchMove",mouseMove:"onMouseMove",up:"onTouchEnd",mouseUp:"onMouseUp"},native:{down:"touchstart",mouseDown:"mousedown",drag:"touchmove",move:"touchmove",mouseMove:"mousemove",up:"touchend",mouseUp:"mouseup"}},desktop:{react:{down:"onMouseDown",drag:"onDragOver",move:"onMouseMove",up:"onMouseUp"},native:{down:"mousedown",drag:"dragStart",move:"mousemove",up:"mouseup"}}},b=v?k.touch:k.desktop,j="undefined"!=typeof window&&window.devicePixelRatio?window.devicePixelRatio:1,w={x:.5,y:.5},x=function(){!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(l,o.default.Component);var e,t,n,r=(e=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}(),function(){var t,n,r=u(l);return n=e?(t=u(this).constructor,Reflect.construct(r,arguments,t)):r.apply(this,arguments),n&&("object"==typeof n||"function"==typeof n)?n:h(this)});function l(e){var t;return function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,l),a(h(t=r.call(this,e)),"state",{drag:!1,my:null,mx:null,image:w}),a(h(t),"handleImageReady",function(e){var n=t.getInitialSize(e.width,e.height);n.resource=e,n.x=.5,n.y=.5,n.backgroundColor=t.props.backgroundColor,t.setState({drag:!1,image:n},t.props.onImageReady),t.props.onLoadSuccess(n)}),a(h(t),"clearImage",function(){t.canvas.getContext("2d").clearRect(0,0,t.canvas.width,t.canvas.height),t.setState({image:w})}),a(h(t),"handleMouseDown",function(e){(e=e||window.event).preventDefault(),t.setState({drag:!0,mx:null,my:null})}),a(h(t),"handleMouseUp",function(){t.state.drag&&(t.setState({drag:!1}),t.props.onMouseUp())}),a(h(t),"handleMouseMove",function(e){var n,r,o,i,a,s,l,u,c,h,L,p,g,f,m,v;e=e||window.event,!1!==t.state.drag&&(e.preventDefault(),o={mx:n=e.targetTouches?e.targetTouches[0].pageX:e.clientX,my:r=e.targetTouches?e.targetTouches[0].pageY:e.clientY},v=(v=t.props.rotate%360)<0?v+360:v,t.state.mx&&t.state.my&&(i=t.state.mx-n,a=t.state.my-r,s=t.state.image.width*t.props.scale,l=t.state.image.height*t.props.scale,c=(u=t.getCroppingRect()).x,h=u.y,c*=s,h*=l,p=Math.cos((L=function(e){return e*(Math.PI/180)})(v)),f=h+-i*(g=Math.sin(L(v)))+a*p,m={x:(c+i*p+a*g)/s+1/t.props.scale*t.getXScale()/2,y:f/l+1/t.props.scale*t.getYScale()/2},t.props.onPositionChange(m),o.image=d(d({},t.state.image),m)),t.setState(o),t.props.onMouseMove(e))}),a(h(t),"setCanvas",function(e){t.canvas=e}),t.canvas=null,t}return t=[{key:"componentDidMount",value:function(){this.props.disableHiDPIScaling&&(j=1);var e,t,n=this.canvas.getContext("2d");this.props.image&&this.loadImage(this.props.image),this.paint(n),document&&(e=!!function(){var e=!1;try{var t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){e=!1}return e}()&&{passive:!1},t=b.native,document.addEventListener(t.move,this.handleMouseMove,e),document.addEventListener(t.up,this.handleMouseUp,e),v&&(document.addEventListener(t.mouseMove,this.handleMouseMove,e),document.addEventListener(t.mouseUp,this.handleMouseUp,e)))}},{key:"componentDidUpdate",value:function(e,t){this.props.image&&this.props.image!==e.image||this.props.width!==e.width||this.props.height!==e.height||this.props.backgroundColor!==e.backgroundColor?this.loadImage(this.props.image):this.props.image||t.image===w||this.clearImage();var n=this.canvas.getContext("2d");n.clearRect(0,0,this.canvas.width,this.canvas.height),this.paint(n),this.paintImage(n,this.state.image,this.props.border),e.image===this.props.image&&e.width===this.props.width&&e.height===this.props.height&&e.position===this.props.position&&e.scale===this.props.scale&&e.rotate===this.props.rotate&&t.my===this.state.my&&t.mx===this.state.mx&&t.image.x===this.state.image.x&&t.image.y===this.state.image.y&&t.backgroundColor===this.state.backgroundColor||this.props.onImageChange()}},{key:"componentWillUnmount",value:function(){var e;document&&(e=b.native,document.removeEventListener(e.move,this.handleMouseMove,!1),document.removeEventListener(e.up,this.handleMouseUp,!1),v&&(document.removeEventListener(e.mouseMove,this.handleMouseMove,!1),document.removeEventListener(e.mouseUp,this.handleMouseUp,!1)))}},{key:"isVertical",value:function(){return!this.props.disableCanvasRotation&&this.props.rotate%180!=0}},{key:"getBorders",value:function(e){var t=0<arguments.length&&void 0!==e?e:this.props.border;return Array.isArray(t)?t:[t,t]}},{key:"getDimensions",value:function(){var e=this.props,t=e.width,n=e.height,r=e.rotate,o=e.border,i={},a=L(this.getBorders(o),2),s=a[0],l=a[1];return this.isVertical()?(i.width=n,i.height=t):(i.width=t,i.height=n),i.width+=2*s,i.height+=2*l,{canvas:i,rotate:r,width:t,height:n,border:o}}},{key:"getImage",value:function(){var e=this.getCroppingRect(),t=this.state.image;e.x*=t.resource.width,e.y*=t.resource.height,e.width*=t.resource.width,e.height*=t.resource.height;var n=document.createElement("canvas");this.isVertical()?(n.width=e.height,n.height=e.width):(n.width=e.width,n.height=e.height);var r=n.getContext("2d");return r.translate(n.width/2,n.height/2),r.rotate(this.props.rotate*Math.PI/180),r.translate(-n.width/2,-n.height/2),this.isVertical()&&r.translate((n.width-n.height)/2,(n.height-n.width)/2),t.backgroundColor&&(r.fillStyle=t.backgroundColor,r.fillRect(-e.x,-e.y,t.resource.width,t.resource.height)),r.drawImage(t.resource,-e.x,-e.y),n}},{key:"getImageScaledToCanvas",value:function(){var e=this.getDimensions(),t=e.width,n=e.height,r=document.createElement("canvas");return this.isVertical()?(r.width=n,r.height=t):(r.width=t,r.height=n),this.paintImage(r.getContext("2d"),this.state.image,0,1),r}},{key:"getXScale",value:function(){return Math.min(1,this.props.width/this.props.height/(this.state.image.width/this.state.image.height))}},{key:"getYScale",value:function(){return Math.min(1,this.props.height/this.props.width/(this.state.image.height/this.state.image.width))}},{key:"getCroppingRect",value:function(){var e=this.props.position||{x:this.state.image.x,y:this.state.image.y},t=1/this.props.scale*this.getXScale(),n=1/this.props.scale*this.getYScale(),r={x:e.x-t/2,y:e.y-n/2,width:t,height:n},o=0,i=1-r.width,a=0,s=1-r.height;return(this.props.disableBoundaryChecks||1<t||1<n)&&(o=-r.width,a=-r.height,s=i=1),d(d({},r),{},{x:Math.max(o,Math.min(r.x,i)),y:Math.max(a,Math.min(r.y,s))})}},{key:"loadImage",value:function(e){y&&e instanceof File?this.loadingImage=new Promise(function(t,n){var r=new FileReader;r.onload=function(e){try{var r=f(e.target.result);t(r)}catch(e){n(e)}},r.readAsDataURL(e)}).then(this.handleImageReady).catch(this.props.onLoadFailure):"string"==typeof e&&(this.loadingImage=f(e,this.props.crossOrigin).then(this.handleImageReady).catch(this.props.onLoadFailure))}},{key:"getInitialSize",value:function(e,t){var n,r,o=this.getDimensions();return t/e<o.height/o.width?r=e*((n=this.getDimensions().height)/t):n=t*((r=this.getDimensions().width)/e),{height:n,width:r}}},{key:"paintImage",value:function(e,t,n,r){var o,i=3<arguments.length&&void 0!==r?r:j;t.resource&&(o=this.calculatePosition(t,n),e.save(),e.translate(e.canvas.width/2,e.canvas.height/2),e.rotate(this.props.rotate*Math.PI/180),e.translate(-e.canvas.width/2,-e.canvas.height/2),this.isVertical()&&e.translate((e.canvas.width-e.canvas.height)/2,(e.canvas.height-e.canvas.width)/2),e.scale(i,i),e.globalCompositeOperation="destination-over",e.drawImage(t.resource,o.x,o.y,o.width,o.height),t.backgroundColor&&(e.fillStyle=t.backgroundColor,e.fillRect(o.x,o.y,o.width,o.height)),e.restore())}},{key:"calculatePosition",value:function(e,t){e=e||this.state.image;var n=L(this.getBorders(t),2),r=n[0],o=n[1],i=this.getCroppingRect(),a=e.width*this.props.scale,s=e.height*this.props.scale,l=-i.x*a,d=-i.y*s;return this.isVertical()?(l+=o,d+=r):(l+=r,d+=o),{x:l,y:d,height:s,width:a}}},{key:"paint",value:function(e){e.save(),e.scale(j,j),e.translate(0,0),e.fillStyle="rgba("+this.props.color.slice(0,4).join(",")+")";var t,n,r,o,i,a=this.props.borderRadius,s=this.getDimensions(),l=L(this.getBorders(s.border),2),d=l[0],u=l[1],c=s.canvas.height,h=s.canvas.width,a=Math.max(a,0);a=Math.min(a,h/2-d,c/2-u),e.beginPath(),t=h-2*d,n=c-2*u,0===(r=a)?e.rect(d,u,t,n):(o=t-r,i=n-r,e.translate(d,u),e.arc(r,r,r,Math.PI,1.5*Math.PI),e.lineTo(o,0),e.arc(o,r,r,1.5*Math.PI,2*Math.PI),e.lineTo(t,i),e.arc(o,i,r,2*Math.PI,.5*Math.PI),e.lineTo(r,n),e.arc(r,i,r,.5*Math.PI,Math.PI),e.translate(-d,-u)),e.rect(h,0,-h,c),e.fill("evenodd"),e.restore()}},{key:"render",value:function(){var e=this.props,t=(e.scale,e.rotate,e.image,e.border,e.borderRadius,e.width,e.height,e.position,e.color,e.backgroundColor,e.style),n=(e.crossOrigin,e.onLoadFailure,e.onLoadSuccess,e.onImageReady,e.onImageChange,e.onMouseUp,e.onMouseMove,e.onPositionChange,e.disableBoundaryChecks,e.disableHiDPIScaling,e.disableCanvasRotation,function(e,t){if(null==e)return{};var n,r=function(e,t){if(null==e)return{};for(var n,r={},o=Object.keys(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),i=0;i<o.length;i++)n=o[i],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}(e,["scale","rotate","image","border","borderRadius","width","height","position","color","backgroundColor","style","crossOrigin","onLoadFailure","onLoadSuccess","onImageReady","onImageChange","onMouseUp","onMouseMove","onPositionChange","disableBoundaryChecks","disableHiDPIScaling","disableCanvasRotation"])),r=this.getDimensions(),i={width:r.canvas.width,height:r.canvas.height,cursor:this.state.drag?"grabbing":"grab",touchAction:"none"},a={width:r.canvas.width*j,height:r.canvas.height*j,style:d(d({},i),t)};return a[b.react.down]=this.handleMouseDown,v&&(a[b.react.mouseDown]=this.handleMouseDown),o.default.createElement("canvas",s({ref:this.setCanvas},a,n))}}],i(l.prototype,t),n&&i(l,n),l}();return a(x,"propTypes",{scale:r.default.number,rotate:r.default.number,image:r.default.oneOfType([r.default.string].concat(function(e){if(Array.isArray(e))return g(e)}(m=y?[r.default.instanceOf(File)]:[])||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(m)||p(m)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())),border:r.default.oneOfType([r.default.number,r.default.arrayOf(r.default.number)]),borderRadius:r.default.number,width:r.default.number,height:r.default.number,position:r.default.shape({x:r.default.number,y:r.default.number}),color:r.default.arrayOf(r.default.number),backgroundColor:r.default.string,crossOrigin:r.default.oneOf(["","anonymous","use-credentials"]),onLoadFailure:r.default.func,onLoadSuccess:r.default.func,onImageReady:r.default.func,onImageChange:r.default.func,onMouseUp:r.default.func,onMouseMove:r.default.func,onPositionChange:r.default.func,disableBoundaryChecks:r.default.bool,disableHiDPIScaling:r.default.bool,disableCanvasRotation:r.default.bool}),a(x,"defaultProps",{scale:1,rotate:0,border:25,borderRadius:0,width:200,height:200,color:[0,0,0,.5],onLoadFailure:function(){},onLoadSuccess:function(){},onImageReady:function(){},onImageChange:function(){},onMouseUp:function(){},onMouseMove:function(){},onPositionChange:function(){},disableBoundaryChecks:!1,disableHiDPIScaling:!1,disableCanvasRotation:!0}),x}(n(45697),n(67294))}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[9225,3318,8110,3295,777,6746,1444,9002,9938,9694,7728,9774,2888,179],function(){return t(73611),t(53854)}),_N_E=e.O()}]);
//# sourceMappingURL=new-6b9b1145d459eb74.js.map