1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7210],{12925:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/magnets/create",function(){return n(54108)}])},41791:function(e,t,n){"use strict";n.d(t,{Z:function(){return s}});var r=n(828),a=n(85893),l=n(67294);function s(e){var t=e.value,n=e.setValue,s=e.name,i=void 0===s?"":s,o=e.className,c=void 0===o?"block w-full border-0 text-gray-300 pl-4 pr-12 py-4 rounded-md border-gray-500 shadow-sm text-lg focus:ring-blue-300":o,u=e.maxHeight,d=void 0===u?300:u,m=e.onFocus,f=void 0===m?function(){}:m,h=e.disableEnter,x=void 0!==h&&h,g=e.required,v=void 0!==g&&g,b=e.placeholder,p=void 0===b?"":b,w=e.backgroundColor,y=void 0===w?"#1a232a":w,j=e.borderWidth,N=void 0===j?"1px":j,Z=e.disabled,k=void 0!==Z&&Z,E=e.minHeight,C=void 0===E?0:E,_=e.isExpandable,R=e.autoFocus,M=void 0!==R&&R,S=e.onKeyDown,L=void 0===S?null:S,B=(0,l.useRef)(null),q=(0,r.Z)((0,l.useState)(!1),2),O=q[0],T=q[1];return((0,l.useEffect)(function(){B.current&&(B.current.style.height="auto",T(B.current.scrollHeight>d),B.current.style.height="".concat(Math.max(C,Math.min(d,B.current.scrollHeight)),"px"))},[t,B]),(0,l.useEffect)(function(){M&&B.current&&B.current.focus()},[M]),void 0===_||_)?(0,a.jsx)("textarea",{className:c,style:{borderWidth:N,resize:"none",overflow:O?"auto":"hidden",backgroundColor:y,marginBottom:0},disabled:k,name:i,rows:"1",ref:B,value:t,onChange:function(e){return n(e.target.value)},onFocus:f,onKeyDown:function(e){null==L||L(e),x&&13===e.keyCode&&e.preventDefault()},required:v,placeholder:p}):(0,a.jsx)("input",{disabled:k,name:i,value:t,onChange:function(e){return n(e.target.value)},className:c,style:{borderWidth:N,resize:"none",overflow:"auto",backgroundColor:y,marginBottom:0},onKeyDown:function(e){null==L||L(e),x&&13===e.keyCode&&e.preventDefault()},onFocus:f,required:v,placeholder:p,ref:B})}},522:function(e,t,n){"use strict";var r=n(828),a=n(85893),l=n(66692),s=n(70256),i=n(75012),o=n(50629),c=n(41664),u=n.n(c);function d(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}var m={info:{bg:"bg-blue-50",text:"text-blue-700",link:"text-blue-700 hover:text-blue-600",action:"focus:ring-blue-600 hover:bg-blue-100",icon:(0,a.jsx)(l.Z,{className:"h-5 w-5 text-blue-400","aria-hidden":"true"})},error:{bg:"bg-red-50",text:"text-red-800",link:"text-red-800 hover:text-red-700",action:"focus:ring-red-600 hover:bg-red-100",icon:(0,a.jsx)(s.Z,{className:"h-5 w-5 text-red-400","aria-hidden":"true"})},success:{bg:"bg-green-50",text:"text-green-800",link:"text-green-800 hover:text-green-700",action:"focus:ring-green-600 hover:bg-green-100",icon:(0,a.jsx)(i.Z,{className:"h-5 w-5 text-green-400","aria-hidden":"true"})},warning:{bg:"bg-yellow-50",text:"text-yellow-800",link:"text-yellow-800 hover:text-yellow-700",action:"focus:ring-yellow-600 hover:bg-yellow-100",icon:(0,a.jsx)(o.Z,{className:"h-5 w-5 text-yellow-400","aria-hidden":"true"})}};t.Z=function(e){var t=e.message,n=e.linkHref,l=e.linkText,s=e.center,i=e.type,o=void 0===i?"info":i,c=e.title,f=e.body,h=e.actions,x=e.className;return h?(0,a.jsx)("div",{className:d("rounded-md p-4",x,m[o].bg),children:(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:m[o].icon}),(0,a.jsxs)("div",{className:"ml-3",children:[c&&(0,a.jsx)("h3",{className:d("text-sm mb-2 font-medium",m[o].text),children:c}),(0,a.jsx)("div",{className:d("text-sm",m[o].text),children:(0,a.jsx)("div",{children:f})}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)("div",{className:"-mx-2 -my-1.5 flex gap-3",children:Object.entries(h).map(function(e,t){var n=(0,r.Z)(e,2),l=n[0],s=n[1];return(0,a.jsx)("button",{onClick:function(){s&&s()},type:"button",className:d("rounded-md px-2 py-1.5 text-sm font-medium focus:outline-none",m[o].text,m[o].action),children:l},t)})})})]})]})}):(0,a.jsx)("div",{className:d("rounded-md p-4",m[o].bg),children:(0,a.jsxs)("div",{className:"flex ".concat(void 0!==s&&s?"items-center":""),children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:m[o].icon}),(0,a.jsxs)("div",{className:"ml-3 flex-1 md:flex md:justify-between",children:[(0,a.jsx)("div",{className:d("text-sm",m[o].text),children:t}),n&&l&&(0,a.jsx)("p",{className:"mt-3 text-sm md:mt-0 md:ml-6",children:(0,a.jsxs)(u(),{href:n,className:d("whitespace-nowrap font-medium",m[o].link),children:[l,(0,a.jsx)("span",{"aria-hidden":"true",children:" â"})]})})]})]})})}},54108:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return j}});var r=n(47568),a=n(828),l=n(97582),s=n(85893),i=n(67294),o=n(9008),c=n.n(o),u=n(41664),d=n.n(u),m=n(84053),f=n(11163),h=n(45485),x=n(41791),g=n(17885),v=n(10907),b=n(24669),p=n(26126),w=n(23662),y=n(522);function j(){var e,t=(0,a.Z)((0,i.useState)(!1),2),n=t[0],o=t[1],u=(0,a.Z)((0,i.useState)(""),2),j=u[0],N=u[1],Z=(0,a.Z)((0,i.useState)(""),2),k=Z[0],E=Z[1],C=(0,a.Z)((0,i.useState)(null),2),_=C[0],R=C[1],M=(0,a.Z)((0,i.useState)([]),2),S=M[0],L=M[1],B=(0,a.Z)((0,i.useState)(""),2),q=B[0],O
1=B[1],T=(0,m.useSupabaseClient)(),D=(0,m.useUser)(),F=(0,f.useRouter)(),A=(0,m.useSessionContext)(),K=A.session,H=A.isLoading,I=_&&_.includes("koalamagnets");(0,i.useEffect)(function(){var e;if(F.isReady&&!H){if(!K||!K.access_token){R([]);return}(0,w.I)({supabase:T,router:F,session:K}).then((e=(0,r.Z)(function(e){return(0,l.__generator)(this,function(t){switch(t.label){case 0:return[4,e.json()];case 1:return R(t.sent().entitlements),[2]}})}),function(t){return e.apply(this,arguments)}))}},[F.isReady,H]),(0,i.useEffect)(function(){if(null==D?void 0:D.id){var e=!1;return(0,r.Z)(function(){var t;return(0,l.__generator)(this,function(n){switch(n.label){case 0:return[4,T.from("brands").select("id, name, business_name").eq("user_id",D.id).order("created_at",{ascending:!0})];case 1:if(t=n.sent().data,e)return[2];return L(t||[]),[2]}})})(),function(){e=!0}}},[null==D?void 0:D.id]);var P=(e=(0,r.Z)(function(e){var t,r,a,s,i;return(0,l.__generator)(this,function(l){switch(l.label){case 0:if(n||!I)return[2];return e.preventDefault(),o(!0),[4,fetch((0,g.G6)()+"/api/magnet-generator-meta/?input="+encodeURIComponent(j),{headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(null==K?void 0:K.access_token)}})];case 1:return(t=l.sent()).ok,[4,t.json()];case 2:return r=l.sent(),[4,T.from("magnets").insert({name:r.name,brand_id:q||null,settings:{type:"singleInputForm",title:r.name,output:{format:r.outputType},private:{prompt:r.prompt},singleInputForm:{inputLabel:r.instructions,placeholder:r.placeholder,buttonLabel:"⨠Submit â¨"},callToAction:{enabled:!0,text:r.callToActionText,placeholder:"Enter your email address",buttonLabel:"Submit"}},environment:(0,b.z)(),user_id:D.id,color:(0,v.m)()}).select().single()];case 3:return s=(a=l.sent()).data,i=a.error,s&&F.push("/magnets/update?magnetId=".concat(s.id)),i&&(o(!1),E(i.message)),[2]}})}),function(t){return e.apply(this,arguments)});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(c(),{children:[(0,s.jsx)("title",{children:"KoalaMagnets - Create"},"title"),(0,s.jsx)("meta",{name:"robots",content:"noindex"})]}),null===_&&(0,s.jsx)("div",{className:"w-full flex justify-center mt-12",children:(0,s.jsx)(p.Z,{text:!1,svgClass:"w-12 h-12",delayBeforeShowingMs:250})}),null!==_&&(0,s.jsxs)("div",{className:"mx-auto my-12",style:{maxWidth:"800px"},children:[(0,s.jsx)("nav",{className:"mb-3","aria-label":"Breadcrumb",children:(0,s.jsxs)(d(),{href:"/magnets",className:"inline-flex items-center gap-1 text-sm font-medium text-gray-400 hover:text-gray-200",children:[(0,s.jsx)(h.Z,{className:"h-4 w-4"}),"KoalaMagnets"]})}),(0,s.jsx)("h1",{className:"text-3xl md:text-4xl font-bold text-white mb-8",children:"New magnet"}),k&&(0,s.jsx)("p",{className:"text-red-400 mt-12 mb-6",children:k}),!I&&(0,s.jsx)("div",{className:"mt-12 -mb-6",children:(0,s.jsx)(y.Z,{message:(0,s.jsxs)(s.Fragment,{children:["Please visit the"," ",(0,s.jsx)(d(),{href:"/pricing",className:"text-yellow-800 hover:text-yellow-700 underline",children:"Pricing page"})," ","and purchase the Professional plan or higher to get access to KoalaMagnets."]}),type:"warning"})}),(0,s.jsxs)("form",{onSubmit:P,className:"mx-auto my-12",style:{maxWidth:"800px"},children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("div",{className:"text-lg font-medium text-gray-300",children:"Please briefly describe what you would like your KoalaMagnet to do."}),(0,s.jsx)("div",{className:"mt-2 text-gray-400",children:'eg "Create quotes for a lawn maintenance service", "Dog name generator", "Act as a life coach"'}),(0,s.jsx)("div",{className:"mt-2 text-gray-400",children:"Our AI will automatically create the first version for you. Then you will be able to view and edit it."}),(0,s.jsx)("div",{className:"mt-3 text-gray-300",style:{position:"relative"},children:(0,s.jsx)(x.Z,{className:"block w-full border-0 text-gray-300 pl-4 pr-12 py-4 rounded-md border-gray-500 shadow-sm text-lg ring-0 focus:border-blue-300 outline-none",value:j,setValue:N,placeholder:"Dog name generator",required:!0})})]}),S.length>0&&(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("div",{className:"text-lg font-medium text-gray-300",children:"Attach a brand (optional)"}),(0,s.jsx)("div",{className:"mt-2 text-gray-400",children:"Lets the magnet answer using your business knowledge base, so it can handle quote requests or questions about your business."}),(0,s.jsxs)("select",{className:"mt-3 block w-full rounded-md border-gray-500 py-4 pl-4 pr-10 text-gray-300 focus:border-blue-500 focus:outline-none focus:ring-blue-500 text-lg",style:{borderWidth:"1px",backgroundColor:"#1a232a"},value:q,onChange:function(e){return O(e.target.value)},children:[(0,s.jsx)("option",{value:"",children:"No brand attached"}),S.map(function(e){return(0,s.jsx)("option",{value:e.id,children:e.business_name||e.name},e.id)})]})]}),(0,s.jsx)("button",{disabled:n||!I,type:"submit",className:"mt-7 flex items-center rounded-md bg-blue-600 px-6 py-4 text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 text-lg disabled:bg-blue-700 ".concat(n||!I?"cursor-not-allowed":""),children:n?"⨠Creating... â¨":"⨠Create â¨"})]})]})]})}},10907:function(e,t,n){"use strict";n.d(t,{m:function(){return r}});var r=function(){var e=["#22c55e","#eab308","#9333ea","#db2777","#84cc16","#06b6d4","#0ea5e9","#f43f5e","#d946ef"];return e[Math.floor(Math.random()*e.length)]}},24669:function(e,t,n){"use strict";function r(){return"production"}n.d(t,{z:function(){return r}})},75012:function(e,t,n){"use strict";var r=n(67294);let a=r.forwardRef(function({title:e,titleId:t,...n},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":t},n),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm13.36-1.814a.75.75 0 1 0-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.14-.094l3.75-5.25Z",clipRule:"evenodd"}))});t.Z=a},45485:function(e,t,n){"use strict";var r=n(67294);let a=r.forwardRef(function({title:e,titleId:t,...n},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":t},n),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M7.72 12.53a.75.75 0 0 1 0-1.06l7.5-7.5a.75.75 0 1 1 1.06 1.06L9.31 12l6.97 6.97a.75.75 0 1 1-1.06 1.06l-7.5-7.5Z",clipRule:"evenodd"}))});t.Z=a},50629:function(e,t,n){"use strict";var r=n(67294);let a=r.forwardRef(function({title:e,titleId:t,...n},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":t},n),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003ZM12 8.25a.75.75 0 0 1 .75.75v3.75a.75.75 0 0 1-1.5 0V9a.75.75 0 0 1 .75-.75Zm0 8.25a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))});t.Z=a},66692:function(e,t,n){"use strict";var r=n(67294);let a=r.forwardRef(function({title:e,titleId:t,...n},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":t},n),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm8.706-1.442c1.146-.573 2.437.463 2.126 1.706l-.709 2.836.042-.02a.75.75 0 0 1 .67 1.34l-.04.022c-1.147.573-2.438-.463-2.127-1.706l.71-2.836-.042.02a.75.75 0 1 1-.671-1.34l.041-.022ZM12 9a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Z",clipRule:"evenodd"}))});t.Z=a},70256:function(e,t,n){"use strict";var r=n(67294);let a=r.forwardRef(function({title:e,titleId:t,...n},a){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:a,"aria-labelledby":t},n),e?r.createElement("title",{id:t},e):null,r.createElement("path",{fillRule:"evenodd",d:"M12 2.25c-5.385 0-9.75 4.365-9.75 9.75s4.365 9.75 9.75 9.75 9.75-4.365 9.75-9.75S17.385 2.25 12 2.25Zm-1.72 6.97a.75.75 0 1 0-1.06 1.06L10.94 12l-1.72 1.72a.75.75 0 1 0 1.06 1.06L12 13.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L13.06 12l1.72-1.72a.75.75 0 1 0-1.06-1.06L12 10.94l-1.72-1.72Z",clipRule:"evenodd"}))});t.Z=a}},function(e){e.O(0,[9774,2888,179],function(){return e(e.s=12925)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.