PageSourceSearch

https://skriva.ai/_next/static/chunks/app/page-926d38beb50d6d1a.js

js skriva.ai collected 2026-10-05 13:27:06 UTC 48,507 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{37956:(e,t,r)=>{Promise.resolve().then(r.bind(r,32337))},32337:(e,t,r)=>{"use strict";r.d(t,{default:()=>t3});var n=r(5364);let a={type:"doc",content:[{type:"heading",attrs:{level:2},content:[{type:"text",text:"Welcome to Your Rich Text Editor"}]},{type:"paragraph",content:[{type:"text",text:"This is a powerful WYSIWYG editor with modern features. Built with "},{type:"text",marks:[{type:"link",attrs:{href:"https://tiptap.dev/",target:"_blank"}}],text:"Tiptap"},{type:"text",text:" for a seamless editing experience."}]},{type:"heading",attrs:{level:3},content:[{type:"text",text:"Getting Started"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:"npm install your-editor-package"}]},{type:"heading",attrs:{level:3},content:[{type:"text",text:"Basic Usage"}]},{type:"codeBlock",attrs:{language:null},content:[{type:"text",text:'import { Editor } from "your-editor-package";\n\nexport default function App() {\n  return (\n     <Editor />\n  )\n}'}]},{type:"heading",attrs:{level:3},content:[{type:"text",text:"Features"}]},{type:"orderedList",attrs:{tight:!0,start:1},content:[{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:"Slash menu & bubble menu"}]}]}
1,{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:"Smart autocompletion (type "},{type:"text",marks:[{type:"code"}],text:"++"},{type:"text",text:" to activate, or select from slash menu)"}]}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:"Image uploads (drag & drop / copy & paste, or select from slash menu) "}]}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:"Social media embeds from the slash menu:"}]},{type:"twitter",attrs:{src:"https://x.com/elonmusk/status/1800759252224729577"}}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:"Mathematical symbols with LaTeX expression:"}]},{type:"orderedList",attrs:{tight:!0,start:1},content:[{type:"listItem",content:[{type:"paragraph",content:[{type:"math",attrs:{latex:"E = mc^2"}}]}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"math",attrs:{latex:"a^2 = \\sqrt{b^2 + c^2}"}}]}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"math",attrs:{latex:"\\hat{f} (\\xi)=\\int_{-\\infty}^{\\infty}f(x)e^{-2\\pi ix\\xi}dx"}}]}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"math",attrs:{latex:"A=\\begin{bmatrix}a&b\\\\c&d \\end{bmatrix}"}}]}]},{type:"listItem",content:[{type:"paragraph",content:[{type:"math",attrs:{latex:"\\sum_{i=0}^n x_i"}}]}]}]}]}]},{type:"image",attrs:{src:"https://public.blob.vercel-storage.com/pJrjXbdONOnAeZAZ/banner-2wQk82qTwyVgvlhTW21GIkWgqPGD2C.png",alt:"editor-banner.png",title:"editor-banner.png",width:null,height:null}},{type:"horizontalRule"},{type:"heading",attrs:{level:3},content:[{type:"text",text:"Documentation"}]},{type:"taskList",content:[{type:"taskItem",attrs:{checked:!1},content:[{type:"paragraph",content:[{type:"text",text:"Read the documentation"}]}]},{type:"taskItem",attrs:{checked:!1},content:[{type:"paragraph",content:[{type:"text",text:"Explore editor extensions"}]}]},{type:"taskItem",attrs:{checked:!1},content:[{type:"paragraph",content:[{type:"text",text:"Customize to match your needs"}]}]}]}]};var s=r(11552),o=r(92501),i=r(26584),l=r(42660),d=r(71913),c=r(8100),u=r(26678),m=r(11070),p=r(61792),h=r(65358),g=r(94444),x=r(78143),f=r(34578),v=r(3125),b=r(75951),y=r(26775),w=r(82364),A=r(43380),j=r(2084),N=r(42621),k=r(99237),C=r(28458),L=r(62146),T=r(77194),R=r
1(58703),S=r(13547),M=r(6050),E=r(95065),z=r(78111),H=r(32725),B=r(92455),I=r(99367),O=r(31937),P=Object.defineProperty,D=Object.getOwnPropertyDescriptor,_=Object.getOwnPropertyNames,U=Object.prototype.hasOwnProperty,F=(e,t,r,n)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let a of _(t))U.call(e,a)||a===r||P(e,a,{get:()=>t[a],enumerable:!(n=D(t,a))||n.enumerable});return e},V={};((e,t)=>{for(var r in t)P(e,r,{get:t[r],enumerable:!0})})(V,{skrivaStore:()=>Y}),((e,t,r)=>(F(e,t,"default"),r&&F(r,t,"default")))(V,c);var Y=(0,d.y$)(),q=(0,d.eU)(""),$=(0,d.eU)(null),K=(0,i.createContext)({}),W=e=>{let{query:t,range:r}=e,a=(0,o.Xr)(q,{store:Y}),s=(0,o.Xr)($,{store:Y});return(0,i.useEffect)(()=>{a(t)},[t,a]),(0,i.useEffect)(()=>{s(r)},[r,s]),(0,i.useEffect)(()=>{let e=["ArrowUp","ArrowDown","Enter"],t=t=>{if(e.includes(t.key)){t.preventDefault();let e=document.querySelector("#slash-command");return e&&e.dispatchEvent(new KeyboardEvent("keydown",{key:t.key,cancelable:!0,bubbles:!0})),!1}};return document.addEventListener("keydown",t),()=>{document.removeEventListener("keydown",t)}},[]),(0,n.jsx)(K.Consumer,{children:e=>(0,n.jsx)(e.Out,{})})},Z=(0,i.forwardRef)((e,t)=>{let{children:r,className:a,...s}=e,[i,l]=(0,o.fp)(q);return(0,n.jsx)(K.Consumer,{children:e=>(0,n.jsx)(e.In,{children:(0,n.jsxs)(u.uB,{ref:t,onKeyDown:e=>{e.stopPropagation()},id:"slash-command",className:a,...s,children:[(0,n.jsx)(u.uB.Input,{value:i,onValueChange:l,style:{display:"none"}}),r]})})})}),G=u.uB.List;Z.displayName="EditorCommand";var X=e=>{let{children:t}=e,r=(0,i.useRef)((0,l.A)()).current;return(0,n.jsx)(o.Kq,{store:Y,children:(0,n.jsx)(K.Provider,{value:r,children:t})})},Q=(0,i.forwardRef)((e,t)=>{let{className:r,children:a,initialContent:o,...i}=e;return(0,n.jsx)("div",{ref:t,className:r,children:(0,n.jsx)(s.zz,{...i,content:o,children:a})})});Q.displayName="EditorContent";var J=(0,i.forwardRef)((e,t)=>{let{children:r,tippyOptions:a,...o}=e,{editor:l}=(0,s.aA)(),d=(0,i.useRef)(null);(0,i.useEffect)(()=>{var e;d.current&&(null==a?void 0:a.placement)&&(d.current.setProps({placement:a.placement}),null===(e=d.current.popperInstance)||void 0===e||e.update())},[null==a?void 0:a.placement]);let c=(0,i.useMemo)(()=>({shouldShow:e=>{let{editor:t,state:r}=e,{selection:n}=r,{empty:a}=n;return!(!t.isEditable||t.isActive("image")||a||(0,m.BQ)(n))},tippyOptions:{onCreate:e=>{var t;d.current=e,null===(t=d.current.popper.firstChild)||void 0===t||t.addEventListener("blur",e=>{e.preventDefault(),e.stopImmediatePropagation()})},moveTransition:"transform 0.15s ease-out",...a},editor:l,...o}),[o,a]);return l?(0,n.jsx)("div",{ref:t,children:(0,n.jsx)(s.mM,{...c,children:r})}):null});J.displayName="EditorBubble";var ee=(0,i.forwardRef)((e,t)=>{let{children:r,asChild:a,onSelect:o,...i}=e,{editor:l}=(0,s.aA)(),d=a?p.DX:"div";return l?(0,n.jsx)(d,{ref:t,...i,onClick:()=>null==o?void 0:o(l),children:r}):null});ee.displayName="EditorBubbleItem";var et=(0,i.forwardRef)((e,t)=>{let{children:r,onCommand:a,...i}=e,{editor:l}=(0,s.aA)(),d=(0,o.md)($);return l&&d?(0,n.jsx)(u.h_,{ref:t,...i,onSelect:()=>a({editor:l,range:d}),children:r}):null});et.displayName="EditorCommandItem";var er=u.xL,en=m.YY.create({name:"CustomKeymap",addCommands:()=>({selectTextWithinNodeBoundaries:()=>e=>{let{editor:t,commands:r}=e,{state:n}=t,{tr:a}=n,s=a.selection.$from.start(),o=a.selection.$to.end();return r.setTextSelection({from:s,to:o})}}),addKeyboardShortcuts:()=>({"Mod-a":e=>{let{editor:t}=e,{state:r}=t,{tr:n}=r,a=n.selection.from,s=n.selection.to,o=n.selection.$from.start(),i=n.selection.$to.end();return(a>o||s<i)&&(t.chain().selectTextWithinNodeBoundaries().run(),!0)}})}),ea=()=>{let{editor:e}=(0,s.aA)();if(!(null==e?void 0:e.isActive("image")))return null;let t=()=>{let t=document.querySelector(".ProseMirror-selectednode");if(t){let r=e.state.selection;(0,e.commands.setImage)({src:t.src,width:Number(t.style.width.replace("px","")),height:Number(t.style.height.replace("px",""))}),e.commands.setNodeSelection(r.from)}};return(0,n.jsx)(C.Ay,{target:document.querySelector(".ProseMirror-selectednode"),container:null,origin:!1,edge:!1,throttleDrag:0,keepRatio:!0,resizable:!0,throttleResize:0,onResize:e=>{let{target:t,width:r,height:n,delta:a}=e;a[0]&&(t.style.width="".concat(r,"px")),a[1]&&(t.style.height="".concat(n,"px"))},onResizeEnd:()=>{t()},scalable:!0,throttleScale:0,renderDirections:["w","e"],onScale:e=>{let{target:t,transform:r}=e;t.style.transform=r}}
1)},es=/(https?:\/\/)?(www\.)?x\.com\/([a-zA-Z0-9_]{1,15})(\/status\/(\d+))?(\/\S*)?/g,eo=/^https?:\/\/(www\.)?x\.com\/([a-zA-Z0-9_]{1,15})(\/status\/(\d+))?(\/\S*)?$/,ei=e=>e.match(eo),el=e=>{var t,r;let{node:a}=e,o=null==a?void 0:null===(r=a.attrs)||void 0===r?void 0:null===(t=r.src)||void 0===t?void 0:t.split("/").pop();return o?(0,n.jsx)(s.VR,{children:(0,n.jsx)("div",{"data-twitter":"",children:(0,n.jsx)(L.Y,{id:o})})}):null},ed=m.bP.create({name:"twitter",addOptions:()=>({addPasteHandler:!0,HTMLAttributes:{},inline:!1,origin:""}),addNodeView(){return(0,s.gu)(el,{attrs:this.options.HTMLAttributes})},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null}}),parseHTML:()=>[{tag:"div[data-twitter]"}],addCommands(){return{setTweet:e=>t=>{let{commands:r}=t;return!!ei(e.src)&&r.insertContent({type:this.name,attrs:e})}}},addPasteRules(){return this.options.addPasteHandler?[(0,m.gg)({find:es,type:this.type,getAttributes:e=>({src:e.input})})]:[]},renderHTML(e){let{HTMLAttributes:t}=e;return["div",(0,m.KV)({"data-twitter":""},t)]}}),ec=m.bP.create({name:"math",inline:!0,group:"inline",atom:!0,selectable:!0,marks:"",addAttributes:()=>({latex:""}),addOptions:()=>({shouldRender:(e,t)=>{let r=e.doc.resolve(t);return!!r.parent.isTextblock&&"codeBlock"!==r.parent.type.name},katexOptions:{throwOnError:!1},HTMLAttributes:{}}),addCommands(){return{setLatex:e=>{let{latex:t}=e;return e=>{let{chain:r,state:n}=e;if(!t)return!1;let{from:a,to:s,$anchor:o}=n.selection;return!!this.options.shouldRender(n,o.pos)&&r().insertContentAt({from:a,to:s},{type:"math",attrs:{latex:t}}).setTextSelection({from:a,to:a+1}).run()}},unsetLatex:()=>e=>{let{editor:t,state:r,chain:n}=e,a=t.getAttributes(this.name).latex;if("string"!=typeof a)return!1;let{from:s,to:o}=r.selection;return n().command(e=>{let{tr:t}=e;return t.insertText(a,s,o),!0}).setTextSelection({from:s,to:s+a.length}).run()}}},parseHTML(){return[{tag:'span[data-type="'.concat(this.name,'"]')}]},renderHTML(e){var t;let{node:r,HTMLAttributes:n}=e,a=null!==(t=r.attrs.latex)&&void 0!==t?t:"";return["span",(0,m.KV)(n,{"data-type":this.name}),a]},renderText(e){var t;let{node:r}=e;return null!==(t=r.attrs.latex)&&void 0!==t?t:""},addNodeView(){return e=>{var t;let{node:r,HTMLAttributes:n,getPos:a,editor:s}=e,o=document.createElement("span"),i=null!==(t=r.attrs.latex)&&void 0!==t?t:"";return Object.entries(this.options.HTMLAttributes).forEach(e=>{let[t,r]=e;o.setAttribute(t,r)}),Object.entries(n).forEach(e=>{let[t,r]=e;o.setAttribute(t,r)}),o.addEventListener("click",e=>{if(s.isEditable&&"function"==typeof a){let e=a(),t=r.nodeSize;s.commands.setTextSelection({from:e,to:e+t})}}),o.contentEditable="false",o.innerHTML=T.Ay.renderToString(i,this.options.katexOptions),{dom:o}}}}),eu=f.Ay.extend({name:"image",addAttributes(){var e;return{...null===(e=this.parent)||void 0===e?void 0:e.call(this),width:{default:null},height:{default:null}}}}),em=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/,ep=/(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g,eh=m.CU.create({name:"ai-highlight",addOptions:()=>({HTMLAttributes:{}}),addAttributes:()=>({color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:"background-color: ".concat(e.color,"; color: inherit")}:{}}}),parseHTML:()=>[{tag:"mark"}],renderHTML(e){let{HTMLAttributes:t}=e;return["mark",(0,m.KV)(this.options.HTMLAttributes,t),0]},addCommands(){return{setAIHighlight:e=>t=>{let{commands:r}=t;return r.setMark(this.name,e)},toggleAIHighlight:e=>t=>{let{commands:r}=t;return r.toggleMark(this.name,e)},unsetAIHighlight:()=>e=>{let{commands:t}=e;return t.unsetMark(this.name)}}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleAIHighlight()}},addInputRules(){return[(0,m.OX)({find:em,type:this.type})]}
1,addPasteRules(){return[(0,m.Zc)({find:ep,type:this.type})]}}),eg=e=>{let t=e.state.tr;t.removeMark(0,e.state.doc.nodeSize-2,e.state.schema.marks["ai-highlight"]),e.view.dispatch(t)},ex=(e,t)=>{e.chain().setAIHighlight({color:null!=t?t:"#c1ecf970"}).run()},ef=m.YY.create({name:"slash-command",addOptions:()=>({suggestion:{char:"/",command:e=>{let{editor:t,range:r,props:n}=e;n.command({editor:t,range:r})}}}),addProseMirrorPlugins(){return[(0,z.Ay)({editor:this.editor,...this.options.suggestion})]}}),ev=e=>{if(["ArrowUp","ArrowDown","Enter"].includes(e.key)&&document.querySelector("#slash-command"))return!0},eb=b.A.configure({placeholder:e=>{let{node:t}=e;return"heading"===t.type.name?"Heading ".concat(t.attrs.level):"Press '/' for commands"},includeChildren:!0}),ey=g.Ay.configure({multicolor:!0}),ew=k.o.configure({html:!1,transformCopiedText:!0}),eA=x.A.extend({addInputRules(){return[new m.fV({find:/^(?:---|—-|___\s|\*\*\*\s)$/u,handler:e=>{let{state:t,range:r}=e,{tr:n}=t,a=r.from,s=r.to;n.insert(a-1,this.type.create({})).delete(n.mapping.map(a),n.mapping.map(s))}})]}}),ej=new B.hs("upload-image"),eN=e=>{let{imageClass:t}=e;return new B.k_({key:ej,state:{init:()=>I.zF.empty,apply(e,r){r=r.map(e.mapping,e.doc);let n=e.getMeta(this);if(null==n?void 0:n.add){let{id:a,pos:s,src:o}=n.add,i=document.createElement("div");i.setAttribute("class","img-placeholder");let l=document.createElement("img");l.setAttribute("class",t),l.src=o,i.appendChild(l);let d=I.NZ.widget(s+1,i,{id:a});r=r.add(e.doc,[d])}else(null==n?void 0:n.remove)&&(r=r.remove(r.find(void 0,void 0,e=>e.id==n.remove.id)));return r}},props:{decorations(e){return this.getState(e)}}})},ek=(e,t,r)=>{var n;if(null===(n=t.clipboardData)||void 0===n?void 0:n.files.length){t.preventDefault();let[n]=Array.from(t.clipboardData.files),a=e.state.selection.from;return n&&r(n,e,a),!0}return!1},eC=(e,t,r,n)=>{var a,s;if(!r&&(null===(a=t.dataTransfer)||void 0===a?void 0:a.files.length)){t.preventDefault();let[r]=Array.from(t.dataTransfer.files),a=e.posAtCoords({left:t.clientX,top:t.clientY});return r&&n(r,e,null!==(s=null==a?void 0:a.pos)&&void 0!==s?s:-1),!0}return!1},eL=(e,t)=>{let r=[];e.state.doc.forEach((e,n)=>!(n>=t)&&(r.push(e),!0));let n=O.FK.fromArray(r),a=e.state.doc.copy(n);return e.storage.markdown.serializer.serialize(a)},eT=r(52011),eR=r(82608),eS=r(54309),eM=r(17223);let eE=v.Ay.configure({HTMLAttributes:{class:(0,eR.cx)("text-muted-foreground underline underline-offset-[3px] hover:text-primary transition-colors cursor-pointer")}}),ez=f.Ay.extend({addProseMirrorPlugins:()=>[eN({imageClass:(0,eR.cx)("opacity-40 rounded-lg border border-stone-200")})]}).configure({allowBase64:!0,HTMLAttributes:{class:(0,eR.cx)("rounded-lg border border-muted")}}),eH=eu.configure({HTMLAttributes:{class:(0,eR.cx)("rounded-lg border border-muted")}}),eB=w._.configure({HTMLAttributes:{class:(0,eR.cx)("not-prose pl-2 ")}}),eI=y.L2.configure({HTMLAttributes:{class:(0,eR.cx)("flex gap-2 items-start my-4")},nested:!0}),eO=eA.configure({HTMLAttributes:{class:(0,eR.cx)("mt-4 mb-6 border-t border-muted-foreground")}}),eP=N.A.configure({bulletList:{HTMLAttributes:{class:(0,eR.cx)("list-disc list-outside leading-3 -mt-2")}},orderedList:{HTMLAttributes:{class:(0,eR.cx)("list-decimal list-outside leading-3 -mt-2")}},listItem:{HTMLAttributes:{class:(0,eR.cx)("leading-normal -mb-2")}},blockquote:{HTMLAttributes:{class:(0,eR.cx)("border-l-4 border-primary")}},codeBlock:{HTMLAttributes:{class:(0,eR.cx)("rounded-md bg-muted text-muted-foreground border p-5 font-mono font-medium")}},code:{HTMLAttributes:{class:(0,eR.cx)("rounded-md bg-muted  px-1.5 py-1 font-mono font-medium"),spellcheck:"false"}},horizontalRule:!1,dropcursor:{color:"#DBEAFE",width:4},gapcursor:!1}),eD=S.A.configure({lowlight:(0,eS.$)(eM.l)}),e_=M.A.configure({HTMLAttributes:{class:(0,eR.cx)("rounded-lg border border-muted")},inline:!1}),eU=ed.configure({HTMLAttributes:{class:(0,eR.cx)("not-prose")},inline:!1}),eF=ec.configure({HTMLAttributes:{class:(0,eR.cx)("text-foreground rounded p-1 hover:bg-accent cursor-pointer")},katexOptions:{throwOnError:!1}}),eV=R.A.configure(),eY=ew.configure({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}),eq=[eP,eb,eE,ez,eH,eB,eI,eO,eh,eD,e_,eU,eF,eV,j.A,eY,ey,A.A,h.Q,en,E.A];var e$=r(79153),eK=r(85901),eW=r(92129),eZ=r(34782),eG=r(65727);function eX(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,eG.QP)((0,eZ.$)(t))}let eQ=(0,eR.F)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),eJ=i.forwardRef((e,t)=>
1{let{className:r,variant:a,size:s,asChild:o=!1,...i}=e,l=o?eW.DX:"button";return(0,n.jsx)(l,{className:eX(eQ({variant:a,size:s,className:r})),ref:t,...i})});eJ.displayName="Button";var e0=r(36311);let e1=e0.bL,e2=e0.l9,e3=i.forwardRef((e,t)=>{let{className:r,align:a="center",sideOffset:s=4,...o}=e;return(0,n.jsx)(e0.ZL,{children:(0,n.jsx)(e0.UC,{ref:t,align:a,sideOffset:s,className:eX("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...o})})});e3.displayName=e0.UC.displayName;let e5=[{name:"Default",color:"var(--skriva-black)"},{name:"Purple",color:"#9333EA"},{name:"Red",color:"#E00000"},{name:"Yellow",color:"#EAB308"},{name:"Blue",color:"#2563EB"},{name:"Green",color:"#008A00"},{name:"Orange",color:"#FFA500"},{name:"Pink",color:"#BA4081"},{name:"Gray",color:"#A8A29E"}],e4=[{name:"Default",color:"var(--skriva-highlight-default)"},{name:"Purple",color:"var(--skriva-highlight-purple)"},{name:"Red",color:"var(--skriva-highlight-red)"},{name:"Yellow",color:"var(--skriva-highlight-yellow)"},{name:"Blue",color:"var(--skriva-highlight-blue)"},{name:"Green",color:"var(--skriva-highlight-green)"},{name:"Orange",color:"var(--skriva-highlight-orange)"},{name:"Pink",color:"var(--skriva-highlight-pink)"},{name:"Gray",color:"var(--skriva-highlight-gray)"}],e6=e=>{let{open:t,onOpenChange:r}=e,{editor:a}=(0,s.aA)();if(!a)return null;let o=e5.find(e=>{let{color:t}=e;return a.isActive("textStyle",{color:t})}),i=e4.find(e=>{let{color:t}=e;return a.isActive("highlight",{color:t})});return(0,n.jsxs)(e1,{modal:!0,open:t,onOpenChange:r,children:[(0,n.jsx)(e2,{asChild:!0,children:(0,n.jsxs)(eJ,{size:"sm",className:"gap-2 rounded-none",variant:"ghost",children:[(0,n.jsx)("span",{className:"rounded-sm px-1",style:{color:null==o?void 0:o.color,backgroundColor:null==i?void 0:i.color},children:"A"}),(0,n.jsx)(e$.A,{className:"h-4 w-4"})]})}),(0,n.jsxs)(e3,{sideOffset:5,className:"my-1 flex max-h-80 w-48 flex-col overflow-hidden overflow-y-auto rounded border p-1 shadow-xl ",align:"start",children:[(0,n.jsxs)("div",{className:"flex flex-col",children:[(0,n.jsx)("div",{className:"my-1 px-2 text-sm font-semibold text-muted-foreground",children:"Color"}),e5.map(e=>{let{name:t,color:s}=e;return(0,n.jsx)(ee,{onSelect:()=>{a.commands.unsetColor(),"Default"!==t&&a.chain().focus().setColor(s||"").run(),r(!1)},className:"flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"rounded-sm border px-2 py-px font-medium",style:{color:s},children:"A"}),(0,n.jsx)("span",{children:t})]})},t)})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"my-1 px-2 text-sm font-semibold text-muted-foreground",children:"Backgroun
1d"}),e4.map(e=>{let{name:t,color:s}=e;return(0,n.jsxs)(ee,{onSelect:()=>{a.commands.unsetHighlight(),"Default"!==t&&a.chain().focus().setHighlight({color:s}).run(),r(!1)},className:"flex cursor-pointer items-center justify-between px-2 py-1 text-sm hover:bg-accent",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"rounded-sm border px-2 py-px font-medium",style:{backgroundColor:s},children:"A"}),(0,n.jsx)("span",{children:t})]}),a.isActive("highlight",{color:s})&&(0,n.jsx)(eK.A,{className:"h-4 w-4"})]},t)})]})]})]})};var e7=r(84767);let e8=e=>{let{open:t,onOpenChange:r}=e,a=(0,i.useRef)(null),{editor:o}=(0,s.aA)();return((0,i.useEffect)(()=>{var e;null===(e=a.current)||void 0===e||e.focus()}),o)?(0,n.jsxs)(e0.AM,{modal:!0,open:t,onOpenChange:r,children:[(0,n.jsx)(e0.Wv,{asChild:!0,children:(0,n.jsxs)(eJ,{size:"sm",variant:"ghost",className:"gap-2 rounded-none border-none",children:[(0,n.jsx)("p",{className:"text-base",children:"↗"}),(0,n.jsx)("p",{className:eX("underline decoration-stone-400 underline-offset-4",{"text-blue-500":o.isActive("link")}),children:"Link"})]})}),(0,n.jsx)(e3,{align:"start",className:"w-60 p-0",sideOffset:10,children:(0,n.jsxs)("form",{onSubmit:e=>{let t=e.currentTarget;e.preventDefault();let n=function(e){if(function(e){try{return new URL(e),!0}catch(e){return!1}}(e))return e;try{if(e.includes(".")&&!e.includes(" "))return new URL("https://".concat(e)).toString()}catch(e){return null}}(t[0].value);n&&(o.chain().focus().setLink({href:n}).run(),r(!1))},className:"flex  p-1 ",children:[(0,n.jsx)("input",{ref:a,type:"text",placeholder:"Paste a link",className:"flex-1 bg-background p-1 text-sm outline-none",defaultValue:o.getAttributes("link").href||""}),o.getAttributes("link").href?(0,n.jsx)(eJ,{size:"icon",variant:"outline",type:"button",className:"flex h-8 items-center rounded-sm p-1 text-red-600 transition-all hover:bg-red-100 dark:hover:bg-red-800",onClick:()=>{o.chain().focus().unsetLink().run(),a.current.value="",r(!1)},children:(0,n.jsx)(e7.A,{className:"h-4 w-4"})}):(0,n.jsx)(eJ,{size:"icon",className:"h-8",children:(0,n.jsx)(eK.A,{className:"h-4 w-4"})})]})})]}):null};var e9=r(31858);let te=()=>{let{editor:e}=(0,s.aA)();return e?(0,n.jsx)(eJ,{variant:"ghost",size:"sm",className:"rounded-none w-12",onClick:t=>{if(e.isActive("math"))e.chain().focus().unsetLatex().run();else{let{from:t,to:r}=e.state.selection,n=e.state.doc.textBetween(t,r);if(!n)return;e.chain().focus().setLatex({latex:n}).run()}},children:(0,n.jsx)(e9.A,{className:eX("size-4",{"text-blue-500":e.isActive("math")}),strokeWidth:2.3})}):null};var tt=r(68048),tr=r(74105),tn=r(57120),ta=r(9763),ts=r(74170),to=r(52359),ti=r(74481),tl=r(93042);let td=[{name:"Text",icon:tt.A,command:e=>e.chain().focus().clearNodes().run(),isActive:e=>e.isActive("paragraph")&&!e.isActive("bulletList")&&!e.isActive("orderedList")},{name:"Heading 1",icon:tr.A,command:e=>e.chain().focus().clearNodes().toggleHeading({level:1}).run(),isActive:e=>e.isActive("heading",{level:1})},{name:"Heading 2",icon:tn.A,command:e=>e.chain().focus().clearNodes().toggleHeading({level:2}).run(),isActive:e=>e.isActive("heading",{level:2})},{name:"Heading 3",icon:ta.A,command:e=>e.chain().focus().clearNodes().toggleHeading({level:3}).run(),isActive:e=>e.isActive("heading",{level:3})},{name:"To-do List",icon:ts.A,command:e=>e.chain().focus().clearNodes().toggleTaskList().run(),isActive:e=>e.isActive("taskItem")},{name:"Bullet List",icon:to.A,command:e=>e.chain().focus().clearNodes().toggleBulletList().run(),isActive:e=>e.isActive("bulletList")},{name:"Numbered List",icon:to.A,command:e=>e.chain().focus().clearNodes().toggleOrderedList().run(),isActive:e=>e.isActive("orderedList")},{name:"Quote",icon:ti.A,command:e=>e.chain().focus().clearNodes().toggleBlockquote().run(),isActive:e=>e.isActive("blockquote")},{name:"Code",icon:tl.A,command:e=>e.chain().focus().clearNodes().toggleCodeBlock().run(),isActive:e=>e.isActive("codeBlock")}],tc=e=>{var t;let{open:r,onOpenChange:a}=e,{editor:o}=(0,s.aA)();if(!o)return null;let i=null!==(t=td.filter(e=>e.isActive(o)).pop())&&void 0!==t?t:{name:"Multiple"};return(0,n.jsxs)(e0.AM,{modal:!0,open:r,onOpenChange:a,children:[(0,n.jsx)(e2,{asChild:!0,className:"gap-2 rounded-none border-none hover:bg-accent focus:ring-0",children:(0,n.jsxs)(eJ,{size:"sm",variant:"ghost",className:"gap-2",children:[(0,n.jsx)("span",{className:"whitespace-nowrap text-sm",children:i.name}),(0,n.jsx)(e$.A,{className:"h-4 w-4"})]})}
1),(0,n.jsx)(e3,{sideOffset:5,align:"start",className:"w-48 p-1",children:td.map(e=>(0,n.jsxs)(ee,{onSelect:t=>{e.command(t),a(!1)},className:"flex cursor-pointer items-center justify-between rounded-sm px-2 py-1 text-sm hover:bg-accent",children:[(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)("div",{className:"rounded-sm border p-1",children:(0,n.jsx)(e.icon,{className:"h-3 w-3"})}),(0,n.jsx)("span",{children:e.name})]}),i.name===e.name&&(0,n.jsx)(eK.A,{className:"h-4 w-4"})]},e.name))})]})};var tu=r(33915);let tm=i.forwardRef((e,t)=>{let{className:r,orientation:a="horizontal",decorative:s=!0,...o}=e;return(0,n.jsx)(tu.b,{ref:t,decorative:s,orientation:a,className:eX("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":" w-[1px]",r),...o})});function tp(e){let{className:t}=e;return(0,n.jsxs)("svg",{width:"469",height:"469",viewBox:"0 0 469 469",fill:"none",xmlns:"http://www.w3.org/2000/svg",shapeRendering:"geometricPrecision",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",className:t,children:[(0,n.jsx)("title",{children:"Magic AI icon"}),(0,n.jsx)("path",{d:"M237.092 62.3004L266.754 71.4198C267.156 71.5285 267.51 71.765 267.765 72.0934C268.02 72.4218 268.161 72.8243 268.166 73.2399C268.172 73.6555 268.042 74.0616 267.796 74.3967C267.55 74.7318 267.201 74.9777 266.803 75.097L237.141 84.3145C236.84 84.4058 236.566 84.5699 236.344 84.7922C236.121 85.0146 235.957 85.2883 235.866 85.5893L226.747 115.252C226.638 115.653 226.401 116.008 226.073 116.263C225.745 116.517 225.342 116.658 224.926 116.664C224.511 116.669 224.105 116.539 223.77 116.293C223.435 116.047 223.189 115.699 223.069 115.301L213.852 85.6383C213.761 85.3374 213.597 85.0636 213.374 84.8412C213.152 84.6189 212.878 84.4548 212.577 84.3635L182.914 75.2441C182.513 75.1354 182.158 74.8989 181.904 74.5705C181.649 74.2421 181.508 73.8396 181.503 73.424C181.497 73.0084 181.627 72.6023 181.873 72.2672C182.119 71.9321 182.467 71.6863 182.865 71.5669L212.528 62.3494C212.829 62.2582 213.103 62.0941 213.325 61.8717C213.547 61.6494 213.712 61.3756 213.803 61.0747L222.922 31.4121C223.031 31.0109 223.267 30.656 223.596 30.4013C223.924 30.1465 224.327 30.0057 224.742 30.0002C225.158 29.9946 225.564 30.1247 225.899 30.3706C226.234 30.6165 226.48 30.9649 226.599 31.363L235.817 61.0257C235.908 61.3266 236.072 61.6003 236.295 61.8227C236.517 62.0451 236.791 62.2091 237.092 62.3004Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M155.948 155.848L202.771 168.939C203.449 169.131 204.045 169.539 204.47 170.101C204.895 170.663 205.125 171.348 205.125 172.052C205.125 172.757 204.895 173.442 204.47 174.004C204.045 174.566 203.449 174.974 202.771 175.166L155.899 188.06C155.361 188.209 154.87 188.496 154.475 188.891C154.079 189.286 153.793 189.777 153.644 190.316L140.553 237.138C140.361 237.816 139.953 238.413 139.391 238.838C138.829 239.262 138.144 239.492 137.44 239.492C136.735 239.492 136.05 239.262 135.488 238.838C134.927 238.413 134.519 237.816 134.327 237.138L121.432 190.267C121.283 189.728 120.997 189.237 120.601 188.842C120.206 188.446 119.715 188.16 119.177 188.011L72.3537 174.92C71.676 174.728 71.0795 174.32 70.6547 173.759C70.2299 173.197 70 172.512 70 171.807C70 171.103 70.2299 170.418 70.6547 169.856C71.0795 169.294 71.676 168.886 72.3537 168.694L119.226 155.799C119.764 155.65 120.255 155.364 120.65 154.969C121.046 154.573 121.332 154.082 121.481 153.544L134.572 106.721C134.764 106.043 135.172 105.447 135.734 105.022C136.295 104.597 136.981 104.367 137.685 104.367C138.389 104.367 139.075 104.597 139.637 105.022C140.198 105.447 140.606 106.043 140.798 106.721L153.693 153.593C153.842 154.131 154.128 154.622 154.524 155.018C154.919 155.413 155.41 155.699 155.948 155.848Z",fill:"currentColor"}),(0,n.jsx)("path",{d:"M386.827 289.992C404.33 292.149 403.84 305.828 386.876 307.299C346.623 310.829 298.869 316.271 282.199 360.005C274.844 379.192 269.942 403.2 267.49 432.029C267.427 432.846 267.211 433.626 266.856 434.319C266.501 435.012 266.015 435.602 265.431 436.05C254.988 444.041 251.212 434.186 250.183 425.606C239.2 332.353 214.588 316.909 124.668 306.122C123.892 306.031 123.151 305.767 122.504 305.35C121.857 304.933 121.322 304.375 120.942 303.72C116.399 295.679 119.324 291.038 129.718 289.796C224.688 278.47 236.062 262.83 250.183 169.331C252.177 156.355 257.259 154.083 265.431 162.516C266.51 163.593 267.202 165.099 267.392 166.782C279.257 258.564 293.328 278.617 386.827 289.992Z",fill:"currentColor"})]})}tm.displayName=tu.b.displayName;var th=r(82786),tg=r(1926),tx=r(157);tg.bL,tg.l9;let tf=tg.ZL;tg.bm;let tv=i.forwardRef((e,t)=>
1{let{className:r,...a}=e;return(0,n.jsx)(tg.hJ,{ref:t,className:eX("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a})});tv.displayName=tg.hJ.displayName,i.forwardRef((e,t)=>{let{className:r,children:a,...s}=e;return(0,n.jsxs)(tf,{children:[(0,n.jsx)(tv,{}),(0,n.jsxs)(tg.UC,{ref:t,className:eX("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...s,children:[a,(0,n.jsxs)(tg.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(tx.A,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}).displayName=tg.UC.displayName,i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(tg.hE,{ref:t,className:eX("text-lg font-semibold leading-none tracking-tight",r),...a})}).displayName=tg.hE.displayName,i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(tg.VY,{ref:t,className:eX("text-sm text-muted-foreground",r),...a})}).displayName=tg.VY.displayName;let tb=i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(th.uB,{ref:t,className:eX("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",r),...a})});tb.displayName=th.uB.displayName;let ty=i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsxs)("div",{className:"flex items-center border-b px-4","cmdk-input-wrapper":"",children:[(0,n.jsx)(tp,{className:"mr-2 h-4 w-4 shrink-0 text-purple-500 "}),(0,n.jsx)(th.uB.Input,{ref:t,className:eX("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...a})]})});ty.displayName=th.uB.Input.displayName,i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(th.uB.List,{ref:t,className:eX("max-h-[300px] overflow-y-auto overflow-x-hidden",r),...a})}).displayName=th.uB.List.displayName,i.forwardRef((e,t)=>(0,n.jsx)(th.uB.Empty,{ref:t,className:"py-6 text-center text-sm",...e})).displayName=th.uB.Empty.displayName;let tw=i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(th.uB.Group,{ref:t,className:eX("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",r),...a})});tw.displayName=th.uB.Group.displayName;let tA=i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(th.uB.Separator,{ref:t,className:eX("-mx-1 h-px bg-border",r),...a})});tA.displayName=th.uB.Separator.displayName;let tj=i.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,n.jsx)(th.uB.Item,{ref:t,className:eX("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled='true']:pointer-events-none data-[disabled='true']:opacity-50",r),...a})});tj.displayName=th.uB.Item.displayName;var tN=r(58432),tk=r(36418),tC=r(23010),tL=r(38596);let tT=()=>(0,n.jsxs)("div",{className:"flex items-center justify-center gap-0.5",children:[(0,n.jsx)("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.3s]"}),(0,n.jsx)("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500 [animation-delay:-0.15s]"}),(0,n.jsx)("div",{className:"h-1.5 w-1.5 animate-bounce rounded-full bg-purple-500"})]});var tR=r(50638);let tS=i.forwardRef((e,t)=>
1{let{className:r,children:a,...s}=e;return(0,n.jsxs)(tR.bL,{ref:t,className:eX("relative overflow-hidden",r),...s,children:[(0,n.jsx)(tR.LM,{className:"h-full w-full rounded-[inherit]",children:a}),(0,n.jsx)(tM,{}),(0,n.jsx)(tR.OK,{})]})});tS.displayName=tR.bL.displayName;let tM=i.forwardRef((e,t)=>{let{className:r,orientation:a="vertical",...s}=e;return(0,n.jsx)(tR.VM,{ref:t,orientation:a,className:eX("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...s,children:(0,n.jsx)(tR.lr,{className:"relative flex-1 rounded-full bg-border"})})});tM.displayName=tR.VM.displayName;let tE=e=>{let{completion:t,onDiscard:r}=e,{editor:a}=(0,s.aA)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(tw,{children:[(0,n.jsxs)(tj,{className:"gap-2 px-4",value:"replace",onSelect:()=>{let e=a.view.state.selection;a.chain().focus().insertContentAt({from:e.from,to:e.to},t).run()},children:[(0,n.jsx)(eK.A,{className:"h-4 w-4 text-muted-foreground"}),"Replace selection"]}),(0,n.jsxs)(tj,{className:"gap-2 px-4",value:"insert",onSelect:()=>{let e=a.view.state.selection;a.chain().focus().insertContentAt(e.to+1,t).run()},children:[(0,n.jsx)(ti.A,{className:"h-4 w-4 text-muted-foreground"}),"Insert below"]})]}),(0,n.jsx)(tA,{}),(0,n.jsx)(tw,{children:(0,n.jsxs)(tj,{onSelect:r,value:"thrash",className:"gap-2 px-4",children:[(0,n.jsx)(e7.A,{className:"h-4 w-4 text-muted-foreground"}),"Discard"]})})]})};var tz=r(32574),tH=r(95120),tB=r(64543),tI=r(88677),tO=r(12153);let tP=[{value:"improve",label:"Improve writing",icon:tz.A},{value:"fix",label:"Fix grammar",icon:tH.A},{value:"shorter",label:"Make shorter",icon:tB.A},{value:"longer",label:"Make longer",icon:tI.A}],tD=e=>{let{onSelect:t}=e,{editor:r}=(0,s.aA)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(tw,{heading:"Edit or review selection",children:tP.map(e=>(0,n.jsxs)(tj,{onSelect:e=>{let n=r.state.selection.content();t(r.storage.markdown.serializer.serialize(n.content),e)},className:"flex gap-2 px-4",value:e.value,children:[(0,n.jsx)(e.icon,{className:"h-4 w-4 text-purple-500"}),e.label]},e.value))}),(0,n.jsx)(tA,{}),(0,n.jsx)(tw,{heading:"Use AI to do more",children:(0,n.jsxs)(tj,{onSelect:()=>{let e=r.state.selection.from;t(eL(r,e),"continue")},value:"continue",className:"gap-2 px-4",children:[(0,n.jsx)(tO.A,{className:"h-4 w-4 text-purple-500"}),"Continue writing"]})})]})};function t_(e){let{onOpenChange:t}=e,{editor:r}=(0,s.aA)(),[a,o]=(0,i.useState)(""),{completion:l,complete:d,isLoading:c}=(0,tN.sQ)({api:"/api/generate",onResponse:e=>{if(429===e.status){tL.oR.error("You have reached your request limit for the day.");return}},onError:e=>{tL.oR.error(e.message)}}),u=l.length>0;return(0,n.jsxs)(tb,{className:"w-[350px]",children:[u&&(0,n.jsx)("div",{className:"flex max-h-[400px]",children:(0,n.jsx)(tS,{children:(0,n.jsx)("div",{className:"prose p-2 px-4 prose-sm",children:(0,n.jsx)(tC.o,{children:l})})})}),c&&(0,n.jsxs)("div",{className:"flex h-12 w-full items-center px-4 text-sm font-medium text-muted-foreground text-purple-500",children:[(0,n.jsx)(tp,{className:"mr-2 h-4 w-4 shrink-0  "}),"AI is thinking",(0,n.jsx)("div",{className:"ml-2 mt-1",children:(0,n.jsx)(tT,{})})]}),!c&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)(ty,{value:a,onValueChange:o,autoFocus:!0,placeholder:u?"Tell AI what to do next":"Ask AI to edit or generate...",onFocus:()=>ex(r)}),(0,n.jsx)(eJ,{size:"icon",className:"absolute right-2 top-1/2 h-6 w-6 -translate-y-1/2 rounded-full bg-purple-500 hover:bg-purple-900",onClick:()=>{if(l)return d(l,{body:{option:"zap",command:a}}).then(()=>o(""));let e=r.state.selection.content();d(r.storage.markdown.serializer.serialize(e.content),{body:{option:"zap",command:a}}).then(()=>o(""))},children:(0,n.jsx)(tk.A,{className:"h-4 w-4"})})]}),u?(0,n.jsx)(tE,{onDiscard:()=>{r.chain().unsetHighlight().focus().run(),t(!1)},completion:l}):(0,n.jsx)(tD,{onSelect:(e,t)=>d(e,{body:{option:t}})})]})]})}let tU=e=>{let{children:t,open:r,onOpenChange:a}=e,{editor:o}=(0,s.aA)();return(0,i.useEffect)(()=>{r||eg(o)},[r]),(0,n.jsxs)(J,{tippyOptions:{placement:r?"bottom-start":"top",onHidden:()=>{a(!1),o.chain().unsetHighlight().run()}},className:"flex w-fit max-w-[90vw] overflow-hidden rounded-md border border-muted bg-background shadow-xl",children:[r&&(0,n.jsx)(t_,{open:r,onOpenChange:a}),!r&&(0,n.jsxs)(i.Fragment,{children:[(0,n.jsxs)(eJ,{className:"gap-1 rounded-none text-purple-500",variant:"ghost",onClick:()=>a(!0),size:"sm",children:[(0,n.jsx)(tp,{className:"h-5 w-5"}),"Ask AI"]}),t]})]})},tF=(e=>{let{validateFn:t,onUpload:r}=e;return(e,n,a)=>
1{if(!(null==t?void 0:t(e)))return;let s={},o=n.state.tr;o.selection.empty||o.deleteSelection();let i=new FileReader;i.readAsDataURL(e),i.onload=()=>{o.setMeta(ej,{add:{id:s,pos:a,src:i.result}}),n.dispatch(o)},r(e).then(e=>{var t;let{schema:r}=n.state,a=function(e,t){var r;let n=ej.getState(e).find(void 0,void 0,e=>e.id==t);return n.length?null===(r=n[0])||void 0===r?void 0:r.from:null}(n.state,s);if(null==a)return;let o="object"==typeof e?i.result:e,l=null===(t=r.nodes.image)||void 0===t?void 0:t.create({src:o});if(!l)return;let d=n.state.tr.replaceWith(a,a,l).setMeta(ej,{remove:{id:s}});n.dispatch(d)},()=>{let e=n.state.tr.delete(a,a).setMeta(ej,{remove:{id:s}});n.dispatch(e)})}})({onUpload:e=>{let t=fetch("/api/upload",{method:"POST",headers:{"content-type":(null==e?void 0:e.type)||"application/octet-stream","x-vercel-filename":(null==e?void 0:e.name)||"image.png"},body:e});return new Promise((r,n)=>{tL.oR.promise(t.then(async t=>{if(200===t.status){let{url:e}=await t.json(),n=new Image;n.src=e,n.onload=()=>{r(e)}}else if(401===t.status)throw r(e),Error("`BLOB_READ_WRITE_TOKEN` environment variable not found, reading image locally instead.");else throw Error("Error uploading image. Please try again.")}),{loading:"Uploading image...",success:"Image uploaded successfully.",error:e=>(n(e),e.message)})})},validateFn:e=>e.type.includes("image/")?!(e.size/1024/1024>20)||(tL.oR.error("File size too big (max 20MB)."),!1):(tL.oR.error("File type not supported."),!1)});var tV=r(68472),tY=r(68151),tq=r(77829),t$=r(30834);let tK=()=>{let{editor:e}=(0,s.aA)();if(!e)return null;let t=[{name:"bold",isActive:e=>e.isActive("bold"),command:e=>e.chain().focus().toggleBold().run(),icon:tV.A},{name:"italic",isActive:e=>e.isActive("italic"),command:e=>e.chain().focus().toggleItalic().run(),icon:tY.A},{name:"underline",isActive:e=>e.isActive("underline"),command:e=>e.chain().focus().toggleUnderline().run(),icon:tq.A},{name:"strike",isActive:e=>e.isActive("strike"),command:e=>e.chain().focus().toggleStrike().run(),icon:t$.A},{name:"code",isActive:e=>e.isActive("code"),command:e=>e.chain().focus().toggleCode().run(),icon:tl.A}];return(0,n.jsx)("div",{className:"flex",children:t.map(t=>(0,n.jsx)(ee,{onSelect:e=>{t.command(e)},children:(0,n.jsx)(eJ,{size:"sm",className:"rounded-none",variant:"ghost",type:"button",children:(0,n.jsx)(t.icon,{className:eX("h-4 w-4",{"text-blue-500":t.isActive(e)})})})},t.name))})};var tW=r(8293),tZ=r(51507),tG=r(1636),tX=r(8656),tQ=r(85202);let tJ=[{title:"Send Feedback",description:"Let us know how we can improve.",icon:(0,n.jsx)(tW.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).run(),window.open("/feedback","_blank")}},{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:(0,n.jsx)(tt.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:(0,n.jsx)(ts.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:(0,n.jsx)(tr.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:(0,n.jsx)(tn.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:(0,n.jsx)(ta.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:(0,n.jsx)(tZ.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:(0,n.jsx)(to.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).toggleOrderedList().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:(0,n.jsx)(ti.A,{size:18}),command:e=>{let{editor:t,range:r}=e;return t.chain().focus().deleteRange(r).toggleNode("paragraph","paragraph").toggleBlockquote().run()}},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:(0,n.jsx)(tl.A,{size:18}),command:e=>{let{editor:t,range:r}=e;return t.chain().focus().deleteRange(r).toggleCodeBlock().run()}},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:(0,n.jsx)(tG.A,{size:18}),command:e=>{let{editor:t,range:r}=e;t.chain().focus().deleteRange(r).run();let n=document.createElement("input");n.type="file",n.accept="image/*",n.onchange=async()=>{var e;if(null===(e=n.files)||void 0===e?void 0:e.length){let e=n.files[0],r=t.view.state.selection.from;tF(e,t.view,r)}},n.click()}},{title:"Youtube",description:"Embed a Youtube video.",searchTerms:["video","youtube","embed"],icon:(0,n.jsx)(tX.A,{size:18}),command:e=>{let{editor:t,range:r}=e,n=prompt("Please enter Youtube Video Link");new RegExp(/^((?:https?:)?\/\/)?((?:www|m)\.)?((?:youtube\.com|youtu.be))(\/(?:[\w\-]+\?v=|embed\/|v\/)?)([\w\-]+)(\S+)?$/).test(n)?t.chain().focus().deleteRange(r).setYoutubeVideo({src:n}).run():null!==n&&alert("Please enter a correct Youtube Video Link")}},{title:"Twitter",description:"Embed a Tweet.",searchTerms:["twitter","embed"],icon:(0,n.jsx)(tQ.A,{size:18}),command:e=>{let{editor:t,range:r}=e,n=prompt("Please enter Twitter Link");new RegExp(/^https?:\/\/(www\.)?x\.com\/([a-zA-Z0-9_]{1,15})(\/status\/(\d+))?(\/\S*)?$/).test(n)?t.chain().focus().deleteRange(r).setTweet({src:n}).run():null!==n&&alert("Please enter a correct Twitter Link")}}],t0=ef.configure({suggestion:{items:()=>tJ,render:e=>{let t=null,r=null;return{onStart:n=>{t=new s.NV(W,{props:n,editor:n.editor});let{selection:a}=n.editor.state;if("codeBlock"===a.$from.node(a.$from.depth).type.name)return!1;r=(0,H.Ay)("body",{getReferenceClientRect:n.clientRect,appendTo:()=>e?e.current:document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:e=>{var n;null==t||t.updateProps(e),null==r||null===(n=r[0])||void 0===n||n.setProps({getReferenceClientRect:e.clientRect})},onKeyDown:e=>{var n,a;return"Escape"===e.event.key?(null==r||null===(n=r[0])||void 0===n||n.hide(),!0):null==t?void 0:null===(a=t.ref)||void 0===a?void 0:a.onKeyDown(e)},onExit:()=>{var e;null==r||null===(e=r[0])||void 0===e||e.destroy(),null==t||t.destroy()}}}}}),t1=r(77695),t2=[...eq,t0],t3=()=>{let[e,t]=(0,i.useState)(null),[r,s]=(0,i.useState)("Saved"),[o,l]=(0,i.useState)(),[d,c]=(0,i.useState)(!1),[u,m]=(0,i.useState)(!1),[p,h]=(0,i.useState)(!1),[g,x]=(0,i.useState)(!1),f=e=>{let t=new DOMParser().parseFromString(e,"text/html");
1return t.querySelectorAll("pre code").forEach(e=>{t1.highlightElement(e)}),new XMLSerializer().serializeToString(t)},v=(0,eT.YQ)(async e=>{let t=e.getJSON();l(e.storage.characterCount.words()),window.localStorage.setItem("html-content",f(e.getHTML())),window.localStorage.setItem("skriva-content",JSON.stringify(t)),window.localStorage.setItem("markdown",e.storage.markdown.getMarkdown()),s("Saved")},500);return((0,i.useEffect)(()=>{let e=window.localStorage.getItem("skriva-content");e?t(JSON.parse(e)):t(a)},[]),e)?(0,n.jsxs)("div",{className:"relative w-full max-w-screen-lg",children:[(0,n.jsxs)("div",{className:"flex absolute right-5 top-5 z-10 mb-5 gap-2",children:[(0,n.jsx)("div",{className:"rounded-lg bg-accent px-2 py-1 text-sm text-muted-foreground",children:r}),(0,n.jsxs)("div",{className:o?"rounded-lg bg-accent px-2 py-1 text-sm text-muted-foreground":"hidden",children:[o," Words"]})]}),(0,n.jsx)(X,{children:(0,n.jsxs)(Q,{initialContent:e,extensions:t2,className:"relative min-h-[500px] w-full max-w-screen-lg border-muted bg-background sm:mb-[calc(20vh)] sm:rounded-lg sm:border sm:shadow-lg",editorProps:{handleDOMEvents:{keydown:(e,t)=>ev(t)},handlePaste:(e,t)=>
1ek(e,t,tF),handleDrop:(e,t,r,n)=>eC(e,t,n,tF),attributes:{class:"prose prose-lg dark:prose-invert prose-headings:font-title font-default focus:outline-none max-w-full"}},onUpdate:e=>{let{editor:t}=e;v(t),s("Unsaved")},slotAfter:(0,n.jsx)(ea,{}),children:[(0,n.jsxs)(Z,{className:"z-50 h-auto max-h-[330px] overflow-y-auto rounded-md border border-muted bg-background px-1 py-2 shadow-md transition-all",children:[(0,n.jsx)(er,{className:"px-2 text-muted-foreground",children:"No results"}),(0,n.jsx)(G,{children:tJ.map(e=>(0,n.jsxs)(et,{value:e.title,onCommand:t=>e.command(t),className:"flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm hover:bg-accent aria-selected:bg-accent",children:[(0,n.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-muted bg-background",children:e.icon}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"font-medium",children:e.title}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:e.description})]})]},e.title))})]}),(0,n.jsxs)(tU,{open:g,onOpenChange:x,children:[(0,n.jsx)(tm,{orientation:"vertical"}),(0,n.jsx)(tc,{open:d,onOpenChange:c}),(0,n.jsx)(tm,{orientation:"vertical"}),(0,n.jsx)(e8,{open:p,onOpenChange:h}),(0,n.jsx)(tm,{orientation:"vertical"}),(0,n.jsx)(te,{}),(0,n.jsx)(tm,{orientation:"vertical"}),(0,n.jsx)(tK,{}),(0,n.jsx)(tm,{orientation:"vertical"}),(0,n.jsx)(e6,{open:u,onOpenChange:m})]})]})})]}):null}}},e=>{var t=t=>e(e.s=t);e.O(0,[679,359,395,835,882,596,194,858,127,358],()=>t(37956)),_N_E=e.O()}]);
2//# sourceMappingURL=page-926d38beb50d6d1a.js.map

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.