@pickaxeproject/react 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/Icons/download.svg.js +1 -0
- package/dist/cjs/components/Pickaxe/Chat/History/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/History/Item.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/History/Response.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeLottie.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/common/Action.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/cjs/src/components/Pickaxe/common/PickaxeLottie.d.ts +7 -0
- package/dist/{esm/src/components/Pickaxe/common/PickaxeMarkdown/A.d.ts → cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.d.ts} +1 -1
- package/dist/{esm/src/components/Pickaxe/common/PickaxeMarkdown/Img.d.ts → cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.d.ts} +1 -1
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.d.ts +4 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Custom/common/Action.d.ts +5 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts +2 -2
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/index.d.ts +1 -1
- package/dist/esm/components/Icons/download.svg.js +1 -0
- package/dist/esm/components/Pickaxe/Chat/History/index.js +1 -1
- package/dist/esm/components/Pickaxe/Form/History/Item.js +1 -1
- package/dist/esm/components/Pickaxe/Form/History/Response.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeLottie.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/common/Action.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/esm/src/components/Pickaxe/common/PickaxeLottie.d.ts +7 -0
- package/dist/{cjs/src/components/Pickaxe/common/PickaxeMarkdown/A.d.ts → esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.d.ts} +1 -1
- package/dist/{cjs/src/components/Pickaxe/common/PickaxeMarkdown/Img.d.ts → esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.d.ts} +1 -1
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/P/index.d.ts +4 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Custom/common/Action.d.ts +5 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts +2 -2
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/index.d.ts +1 -1
- package/package.json +3 -4
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/A.js +0 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Img.js +0 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/A.js +0 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Img.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function e(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}Object.defineProperty(exports,"__esModule",{value:!0});var r,t=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},n.apply(null,arguments)}var o=e=>t.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),r||(r=t.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21H3M7 10l5 5 5-5M12 15V3"})));exports.default=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../../hooks/studio/useStyleFontSize.js"),i=require("../../../../hooks/pickaxe/useConversation.js"),o=require("../../../Icons/circle-info.svg.js"),r=require("../../common/PickaxeIcon.js"),c=require("../../../Core/ErrorAlert.js"),n=require("../../Addons/Scroll/ScrollLockView.js"),d=require("../../common/PickaxeInfoModal.js"),x=require("../../common/PickaxeUpgradeCard.js"),u=require("./Message.js"),m=require("../../../../common/cn.js");exports.default=()=>{var p,j;const{pickaxe:f,styles:g,colors:h,isNewChat:v,responsiveBy:b,setChatId:y}=t.usePickaxeContext(),{messages:w,status:k,limitData:E,error:N}=a.useResponseContext(),C=i.useConversation(),[O,q]=s.useState(!1),S=l.useStyleFontSize({type:"body"}),P=s.useMemo((()=>!!C.data&&!(C.data.messages.length<=1)),[C.data]),F=s.useMemo((()=>C.isSuccess&&v&&!P),[C.isSuccess,v,P]);return e.jsxs("div",Object.assign({className:"relative flex flex-grow flex-col justify-end"},{children:[O&&e.jsx(d.default,{isOpen:O,onChangeIsOpen:q}),e.jsxs("div",Object.assign({className:m.default("absolute left-1/2 top-5 flex w-full max-w-[400px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",F&&"top-1/3 opacity-100")},{children:[e.jsx("button",Object.assign({className:"duration-300 hover:opacity-90 active:opacity-100 outline-none",onClick:()=>y("")},{children:e.jsx(r.default,{src:null==f?void 0:f.coverphoto,alt:`${null==f?void 0:f.formtitle}'s Profile Picture`,width:90,height:90,className:"h-[90px] w-[90px] rounded-full"})})),e.jsxs("div",Object.assign({className:"flex flex-col items-center"},{children:[e.jsxs("h2",Object.assign({className:m.default("mt-6 text-center font-semibold opacity-70","viewport"===b?"min-[767px]:text-lg":"@[767px]/pickaxe-root:text-lg")},{children:[`${null==f?void 0:f.formtitle.slice(0,130)}${(null!==(p=null==f?void 0:f.formtitle)&&void 0!==p?p:"").length>130?"...":""}`,e.jsx("button",Object.assign({className:"ml-2 inline-block outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>q(!0)},{children:e.jsx(o.default,{className:"h-5 w-5 shrink-0",style:{color:h.accent}})}))]})),e.jsx("p",Object.assign({className:S("mt-2 line-clamp-3 whitespace-pre-line max-w-[600px] text-center font-semilight opacity-70")},{children:null==f?void 0:f.formdescription}))]}))]})),e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:C.isLoading?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[e.jsx("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===g.theme?"#1E1E1F":"#E5E7EB"}}),e.jsx("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===g.theme?"#1E1E1F":"#E5E7EB"}}),e.jsx("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===g.theme?"#1E1E1F":"#E5E7EB"}})]})):C.isError?e.jsx("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e.jsxs("p",Object.assign({className:"text-center text-xl font-semibold"},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help"},{children:"contact us"}))," ","for help."]}))})):e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:m.default("relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-6","viewport"===b?"min-[767px]:pt-10":"@[767px]/pickaxe-root:pt-10")},{children:[C.data.messages.map(((s,t)=>e.jsx(u.default,{message:s},t))),w.map(((s,t)=>e.jsx(u.default,{message:s},t))),"fetching"===k?e.jsxs("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==f?void 0:f.chaticon)&&e.jsx(r.default,{src:null!==(j=null==f?void 0:f.chaticon)&&void 0!==j?j:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==f?void 0:f.formid}.png`,alt:`${null==f?void 0:f.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:h.text}),e.jsxs("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4",style:{backgroundColor:h.secondary+"80",color:h.secondaryText}},{children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:h.secondaryText}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full",style:{backgroundColor:h.secondaryText}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:h.secondaryText}})]}))]})):E?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(x.default,{})})):N?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(c.default,{error:N})})):null]})),e.jsx(n.default,{className:"w-full"})]}))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("date-fns"),r=require("../../common/PickaxeMarkdown/index.js"),l=require("../../common/PickaxeMarkdown/Renderer.js"),o=require("../../../Icons/message-square-notes.svg.js"),i=require("../../../Icons/visitor.svg.js"),n=require("../../common/PickaxeIcon.js"),c=require("../../common/PickaxeSimpleButton.js"),d=require("../../common/PickaxeCopyButton.js");exports.default=({item:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("date-fns"),r=require("../../common/PickaxeMarkdown/index.js"),l=require("../../common/PickaxeMarkdown/Renderer.js"),o=require("../../../Icons/message-square-notes.svg.js"),i=require("../../../Icons/visitor.svg.js"),n=require("../../common/PickaxeIcon.js"),c=require("../../common/PickaxeSimpleButton.js"),d=require("../../common/PickaxeCopyButton.js");exports.default=({item:x})=>{const{pickaxe:m,styles:u,colors:h,setChatId:p,setIsNewChat:j}=a.usePickaxeContext(),f=s.useMemo((()=>t.format(x.createdAt,"hh:mm a MMM dd, yy")),[x]),g=s.useMemo((()=>x&&x.messages?x.messages.length:0),[x]),v=s.useMemo((()=>{var e,s,a,t;if("form"===x.type){return(null!==(e=x.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}return null!==(t=null===(a=null===(s=x.messages)||void 0===s?void 0:s[0])||void 0===a?void 0:a.message)&&void 0!==t?t:""}),[x]),b=s.useMemo((()=>{var e,s,a,t;return"form"===x.type?null!==(e=x.questionResponse)&&void 0!==e?e:"":null!==(t=null===(a=null===(s=x.messages)||void 0===s?void 0:s[1])||void 0===a?void 0:a.message)&&void 0!==t?t:""}),[x]);return e.jsxs("div",Object.assign({className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e.jsxs("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:h.primary,color:h.text}},{children:[e.jsx("div",Object.assign({className:"shrink-0 pt-1"},{children:e.jsx(i.default,{className:"h-6 w-6"})})),e.jsxs("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-1.5 scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[e.jsx("input",{id:`${x.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:v.length<280}),e.jsx("div",{className:"danger-html hidden flex-col peer-checked:flex",dangerouslySetInnerHTML:{__html:v}}),e.jsx("label",Object.assign({htmlFor:`${x.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:hidden hover:cursor-pointer",style:{color:h.accent}},{children:"See input"})),e.jsx("label",Object.assign({htmlFor:`${x.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:flex hover:cursor-pointer",style:{color:h.accent}},{children:"Hide input"}))]}))]})),e.jsxs("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:h.secondary,color:h.secondaryText}},{children:[e.jsx(n.default,{src:null==m?void 0:m.chaticon,alt:`${null==m?void 0:m.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:h.secondaryText}),e.jsxs("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[e.jsx(r.PickaxeMarkdown,Object.assign({theme:u.theme,accentColor:h.accent,linkPreviews:!0,actions:!0},{children:e.jsx(l.PickaxeMarkdownRenderer,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:b})})),e.jsxs("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==m?void 0:m.enablechatresponses)&&e.jsxs(c.default,Object.assign({color:h.accent,onClick:()=>{return e=x.responseId,j(!1),void p(e);var e}},{children:[e.jsx(o.default,{className:"h-4 w-4 shrink-0"}),e.jsx("p",Object.assign({className:"text-sm font-semibold"},{children:g+1}))]})),e.jsx(d.default,{color:h.accent,text:b})]})),e.jsx("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:e.jsx("p",Object.assign({className:"text-sm font-semibold uppercase opacity-30"},{children:f}))}))]}))]}))]}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/pickaxe/useResponseContext.js"),r=require("date-fns"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/pickaxe/useResponseContext.js"),r=require("date-fns"),n=require("../../common/PickaxeMarkdown/index.js"),o=require("../../common/PickaxeMarkdown/Renderer.js"),l=require("../../../Icons/message-square-notes.svg.js"),i=require("../../../Icons/visitor.svg.js"),c=require("../../common/PickaxeIcon.js"),d=require("../../common/PickaxeSimpleButton.js"),x=require("../../Addons/Scroll/ScrollLockView.js"),u=require("../../common/PickaxeCopyButton.js");exports.default=()=>{var h;const{pickaxe:m,styles:p,colors:j,setChatId:f,setIsNewChat:g}=t.usePickaxeContext(),{response:b}=a.useResponseContext(),k=s.useMemo((()=>b?r.format(b.createdAt,"hh:mm a MMM dd, yy"):r.format(new Date,"hh:mm a MMM dd, yy")),[b]),v=s.useMemo((()=>{var e;if(!b)return"";return(null!==(e=b.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[b]);return b?e.jsxs("div",Object.assign({className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e.jsxs("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:j.primary,color:j.text}},{children:[e.jsx("div",Object.assign({className:"shrink-0 pt-1"},{children:e.jsx(i.default,{className:"h-6 w-6"})})),e.jsxs("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[e.jsx("input",{id:`${b.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:v.length<280}),e.jsx("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:v}}),e.jsx("label",Object.assign({htmlFor:`${b.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer",style:{color:j.accent}},{children:"See input"})),e.jsx("label",Object.assign({htmlFor:`${b.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer",style:{color:j.accent}},{children:"Hide input"}))]}))]})),e.jsxs("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:j.secondary,color:j.secondaryText}},{children:[e.jsx(c.default,{src:null==m?void 0:m.chaticon,alt:`${null==m?void 0:m.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:j.secondaryText}),e.jsxs("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[e.jsx(n.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:j.accent,linkPreviews:!0,actions:!0},{children:e.jsx(o.PickaxeMarkdownRenderer,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:b.questionResponse})})),e.jsxs("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==m?void 0:m.enablechatresponses)&&e.jsxs(d.default,Object.assign({color:j.accent,onClick:()=>{return e=b.responseId,g(!1),void f(e);var e}},{children:[e.jsx(l.default,{className:"h-4 w-4 shrink-0"}),e.jsx("p",Object.assign({className:"text-sm font-semibold"},{children:b.messages.length+1}))]})),e.jsx(u.default,{color:j.accent,text:null!==(h=b.questionResponse)&&void 0!==h?h:""})]})),e.jsx("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:e.jsx("p",Object.assign({className:"text-sm font-semibold uppercase opacity-30"},{children:k}))}))]}))]}))]})),e.jsx(x.default,{})]})):null};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("@tanstack/react-query"),i=require("react");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}const u=i.lazy((()=>Promise.resolve().then((function(){return n(require("lottie-react"))}))));exports.PickaxeLottie=s=>{var{getJson:a,id:o,ref:c}=s,d=e.__rest(s,["getJson","id","ref"]);const{data:l}=r.useQuery({queryKey:[o],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return Promise.resolve().then((function(){return n(require("lottie-react"))})),a()})),enabled:"undefined"!=typeof window});return l?t.jsx(i.Suspense,Object.assign({fallback:t.jsx("div",{style:{height:d.height,width:d.width}})},{children:t.jsx(u,Object.assign({animationData:l},d))})):t.jsx("div",{style:{height:d.height,width:d.width}})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),r=require("../common/Action.js"),s=require("../Img/index.js");exports.default=({node:i,href:n="",children:o})=>{const{accentColor:a,linkPreviews:l,actions:c}=t.usePickaxeMarkdownContext(),u=(n||"").startsWith("www.")?`https://${n}`:n,d=u.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(d&&(null==d?void 0:d[1]))return e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${d[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return u.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e.jsx(s.default,{src:u,alt:"string"==typeof o?o:"Markdown Image"}):c&&u.includes("pickaxe")&&(u.includes("/api/fn/result")||u.includes("/api/function_call_results"))?e.jsx(r.default,{jobUrl:u}):e.jsx("a",Object.assign({href:u,target:"_blank",rel:"noopener noreferrer"},l&&{className:"marked-link-possible-preview-render"},{style:{color:a,fontWeight:600}},{children:o}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("react"),t=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../../../../../../hooks/core/useHover.js"),s=require("framer-motion"),n=require("../../../../../Icons/download.svg.js");exports.default=({node:a,src:l,alt:d})=>{const{accentColor:c}=t.usePickaxeMarkdownContext(),[u,x]=o.useState(!1),p=i.useHover(),{isHover:b}=p,h=e.__rest(p,["isHover"]);return r.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:b?"translateY(-5px)":"translateY(0)"}},h,{children:u?r.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):r.jsxs(r.Fragment,{children:[r.jsx(s.motion.button,Object.assign({initial:"hidden",animate:b?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",top:"10px",right:"10px",backgroundColor:"#007bff",color:"#fff",border:"none",borderRadius:"4px",padding:"0.5rem 0.75rem",cursor:"pointer",fontSize:"0.875rem",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease"},whileHover:{backgroundColor:c},whileTap:{scale:.95},onClick:()=>window.open(l,"_blank")},{children:r.jsx(n.default,{width:24,height:24,style:{flexShrink:0}})})),r.jsx("img",{src:l,alt:d,style:{borderRadius:"8px",maxWidth:"680px"},onError:()=>x(!0)})]})}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../common/Action.js");exports.default=({node:n,children:i})=>{const{actions:l}=t.usePickaxeMarkdownContext();if(l&&"string"==typeof i&&i.includes("pickaxe")&&(i.includes("/api/fn/result")||i.includes("/api/function_call_results"))){const t=i.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),n=i.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("p",Object.assign({style:{fontWeight:350}},{children:t})),e.jsx(s.default,{jobUrl:(null==n?void 0:n[0])||""})]}))}return e.jsx("p",Object.assign({style:{fontWeight:350}},{children:i}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),r=require("@tanstack/react-query"),o=require("../../hooks/usePickaxeMarkdownContext.js"),n=require("../../../../../../common/lotties/loader-black.js"),a=require("../../../../../../common/lotties/loader-white.js"),s=require("../../../PickaxeLottie.js"),d=require("../../../../../../common/api/streamer.js"),c=require("../../Renderer.js"),l=require("framer-motion"),u=require("../../../../../../common/api/utils.js"),m=require("../../../../../../common/error.js");exports.default=({jobUrl:v})=>{var p,x;const{theme:j}=o.usePickaxeMarkdownContext(),[y,f]=i.useState(""),h=i.useRef(null),k=r.useQuery({queryKey:[v],queryFn:()=>(t=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if(!t||t.includes("undefined"))throw new Error("Invalid action job URL");const e=yield fetch(t);return yield e.json()}catch(e){const t=m.default(e);return"development"===process.env.NODE_ENV&&console.error("[getJobResult]",t),{success:!1,error:t}}})))(v),enabled:"undefined"!=typeof window,retry:10,onSuccess:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!t.success)return;if("text"in t)return void f(t.text||"");if(!("fcid"in t)){const e=(yield d.streamer({formId:t.formId,responseId:t.responseId,data:t.encodedData})).body;if(!e)return;let i=!0,r="";const o=e.getReader(),n=new TextDecoder;for(;i;){const{value:e,done:t}=yield o.read();i=!t;r+=n.decode(e),f(r)}return f(r),yield u.default.post("/fn/update",{id:t.jobId,data:Object.assign(Object.assign({},t),{text:r})}),void console.log("[Action] streaming done")}yield new Promise((e=>setTimeout(e,3e3))),k.refetch(),"development"===process.env.NODE_ENV&&console.log(`[Action] refetching <${v}>`)}))});return console.log("[ActionResult]",k.data,y),t.jsx("div",Object.assign({ref:h,className:"pxe-action"},{children:t.jsx(l.AnimatePresence,{children:k.error||(null===(p=k.data)||void 0===p?void 0:p.error)?t.jsx(l.motion.div,Object.assign({initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3}},{children:t.jsx(c.PickaxeMarkdownRenderer,{value:`> ${(null===(x=k.data)||void 0===x?void 0:x.error)||"Failed to process, please try again."}`})})):y?t.jsx(l.motion.div,Object.assign({initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"mt-4"},{children:t.jsx(c.PickaxeMarkdownRenderer,{value:y})})):t.jsx(l.motion.div,Object.assign({initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3}},{children:t.jsx(s.PickaxeLottie,{id:"dark"===j?"loader-white":"loader-black",getJson:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return"dark"===j?a.loaderWhite:n.loaderBlack})),autoplay:!0,loop:!0,style:{cursor:"default",pointerEvents:"none",width:"100%",maxWidth:"150px",height:"150px"}})}))})}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),r=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),s=require("react-syntax-highlighter"),n=require("react-markdown"),l=require("remark-gfm"),d=require("remark-math"),a=require("rehype-katex"),c=require("./Custom/A/index.js"),o=require("./Custom/P/index.js"),h=require("./Custom/Img/index.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=u(n),g=u(l),j=u(d),x=u(a);exports.PickaxeMarkdownRenderer=({className:n,style:l,value:d})=>{const{theme:a,syntaxTheme:u}=t.usePickaxeMarkdownContext(),b=r.useRef(null),f={h1:({node:e,children:r})=>i.jsx("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem"}},{children:r})),h2:({node:e,children:r})=>i.jsx("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem"}},{children:r})),h3:({node:e,children:r})=>i.jsx("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem"}},{children:r})),h4:({node:e,children:r})=>i.jsx("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem"}},{children:r})),h5:({node:e,children:r})=>i.jsx("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:r})),p:o.default,a:c.default,ol:({node:e,children:r})=>i.jsx("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem"}},{children:r})),ul:({node:e,children:r})=>i.jsx("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem"}},{children:r})),li:({node:e,children:r})=>i.jsx("li",{children:r}),table:({children:e})=>i.jsx("div",Object.assign({className:"overflow-auto"},{children:i.jsx("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:e}))})),th:({node:e,children:r})=>i.jsx("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:r})),tr:({node:e,children:r})=>i.jsx("tr",Object.assign({style:{border:"dark"===a?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>i.jsx("td",Object.assign({style:{padding:"0.75em 1em"}},{children:r})),code:r=>{var{node:t,children:n,className:l}=r,d=e.__rest(r,["node","children","className"]);const a=/language-(\w+)/.exec(l||"");return a?i.jsx(s.Prism,Object.assign({},d,{PreTag:"div",language:a[1],style:u,showLineNumbers:!0},{children:String(n).replace(/\n$/,"")})):i.jsx("code",Object.assign({},d,{className:l},{children:n}))},blockquote:({node:e,children:r})=>i.jsx("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===a?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===a?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:r})),img:h.default};return i.jsx("div",Object.assign({className:"pxe-markdown",ref:b,style:Object.assign({position:"relative",whiteSpace:"pre-wrap"},l)},{children:i.jsx(m.default,Object.assign({},n&&{className:n},{components:f,remarkPlugins:[g.default,j.default],rehypePlugins:[x.default]},{children:(null!=d?d:"").replace(/\u200B/g,"")}))}))};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type LottieComponentProps } from "lottie-react";
|
|
2
|
+
interface PickaxeLottieProps<T extends Record<string, unknown>> {
|
|
3
|
+
getJson: () => Promise<T>;
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const PickaxeLottie: <T extends Record<string, unknown>>({ getJson, id, ref: _, ...props }: PickaxeLottieProps<T> & Omit<LottieComponentProps, "animationData">) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const usePickaxeMarkdownContext: () => {
|
|
3
|
-
theme?: ("
|
|
3
|
+
theme?: import("..").PickaxeMarkdownTheme | undefined;
|
|
4
4
|
syntaxTheme?: Record<string, import("react").CSSProperties> | undefined;
|
|
5
5
|
accentColor?: string | undefined;
|
|
6
6
|
linkPreviews?: boolean | undefined;
|
|
7
7
|
actions?: boolean | undefined;
|
|
8
|
-
setTheme?: import("../../../../../types/common").SetState<"
|
|
8
|
+
setTheme?: import("../../../../../types/common").SetState<import("..").PickaxeMarkdownTheme> | undefined;
|
|
9
9
|
setAccentColor?: import("../../../../../types/common").SetState<string> | undefined;
|
|
10
10
|
setLinkPreviews?: import("../../../../../types/common").SetState<boolean> | undefined;
|
|
11
11
|
setActions?: import("../../../../../types/common").SetState<boolean> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SetState } from "../../../../types/common";
|
|
2
2
|
import { type CSSProperties, type ReactNode } from "react";
|
|
3
|
-
type PickaxeMarkdownTheme = "light" | "dark";
|
|
3
|
+
export type PickaxeMarkdownTheme = "light" | "dark";
|
|
4
4
|
type PickaxeMarkdownContextType = {
|
|
5
5
|
theme?: PickaxeMarkdownTheme;
|
|
6
6
|
syntaxTheme?: Record<string, CSSProperties>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as r from"react";var e;function t(){return t=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},t.apply(null,arguments)}var n=n=>r.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},n),e||(e=r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21H3M7 10l5 5 5-5M12 15V3"})));export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useState as t,useMemo as
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useState as t,useMemo as o}from"react";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as l}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as c}from"../../../../hooks/pickaxe/useConversation.js";import r from"../../../Icons/circle-info.svg.js";import n from"../../common/PickaxeIcon.js";import d from"../../../Core/ErrorAlert.js";import m from"../../Addons/Scroll/ScrollLockView.js";import p from"../../common/PickaxeInfoModal.js";import x from"../../common/PickaxeUpgradeCard.js";import u from"./Message.js";import f from"../../../../common/cn.js";const g=()=>{var g,h;const{pickaxe:v,styles:b,colors:j,isNewChat:w,responsiveBy:y,setChatId:k}=a(),{messages:E,status:N,limitData:O,error:C}=i(),B=c(),[F,P]=t(!1),S=l({type:"body"}),I=o((()=>!!B.data&&!(B.data.messages.length<=1)),[B.data]),$=o((()=>B.isSuccess&&w&&!I),[B.isSuccess,w,I]);return e("div",Object.assign({className:"relative flex flex-grow flex-col justify-end"},{children:[F&&s(p,{isOpen:F,onChangeIsOpen:P}),e("div",Object.assign({className:f("absolute left-1/2 top-5 flex w-full max-w-[400px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",$&&"top-1/3 opacity-100")},{children:[s("button",Object.assign({className:"duration-300 hover:opacity-90 active:opacity-100 outline-none",onClick:()=>k("")},{children:s(n,{src:null==v?void 0:v.coverphoto,alt:`${null==v?void 0:v.formtitle}'s Profile Picture`,width:90,height:90,className:"h-[90px] w-[90px] rounded-full"})})),e("div",Object.assign({className:"flex flex-col items-center"},{children:[e("h2",Object.assign({className:f("mt-6 text-center font-semibold opacity-70","viewport"===y?"min-[767px]:text-lg":"@[767px]/pickaxe-root:text-lg")},{children:[`${null==v?void 0:v.formtitle.slice(0,130)}${(null!==(g=null==v?void 0:v.formtitle)&&void 0!==g?g:"").length>130?"...":""}`,s("button",Object.assign({className:"ml-2 inline-block outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>P(!0)},{children:s(r,{className:"h-5 w-5 shrink-0",style:{color:j.accent}})}))]})),s("p",Object.assign({className:S("mt-2 line-clamp-3 whitespace-pre-line max-w-[600px] text-center font-semilight opacity-70")},{children:null==v?void 0:v.formdescription}))]}))]})),s("div",Object.assign({className:"flex w-full justify-center"},{children:B.isLoading?e("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[s("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===b.theme?"#1E1E1F":"#E5E7EB"}}),s("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===b.theme?"#1E1E1F":"#E5E7EB"}}),s("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===b.theme?"#1E1E1F":"#E5E7EB"}})]})):B.isError?s("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e("p",Object.assign({className:"text-center text-xl font-semibold"},{children:["Something went wrong. Please try again, or"," ",s("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help"},{children:"contact us"}))," ","for help."]}))})):e("div",Object.assign({className:"flex flex-col w-full"},{children:[e("div",Object.assign({className:f("relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-6","viewport"===y?"min-[767px]:pt-10":"@[767px]/pickaxe-root:pt-10")},{children:[B.data.messages.map(((e,t)=>s(u,{message:e},t))),E.map(((e,t)=>s(u,{message:e},t))),"fetching"===N?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==v?void 0:v.chaticon)&&s(n,{src:null!==(h=null==v?void 0:v.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==v?void 0:v.formid}.png`,alt:`${null==v?void 0:v.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:j.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4",style:{backgroundColor:j.secondary+"80",color:j.secondaryText}},{children:[s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:j.secondaryText}}),s("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full",style:{backgroundColor:j.secondaryText}}),s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:j.secondaryText}})]}))]})):O?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:s(x,{})})):C?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:s(d,{error:C})})):null]})),s(m,{className:"w-full"})]}))}))]}))};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{format as
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{format as n}from"date-fns";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as i}from"../../common/PickaxeMarkdown/Renderer.js";import l from"../../../Icons/message-square-notes.svg.js";import r from"../../../Icons/visitor.svg.js";import c from"../../common/PickaxeIcon.js";import d from"../../common/PickaxeSimpleButton.js";import m from"../../common/PickaxeCopyButton.js";const p=({item:p})=>{const{pickaxe:h,styles:f,colors:x,setChatId:u,setIsNewChat:g}=t(),v=o((()=>n(p.createdAt,"hh:mm a MMM dd, yy")),[p]),b=o((()=>p&&p.messages?p.messages.length:0),[p]),y=o((()=>{var e,s,o,t;if("form"===p.type){return(null!==(e=p.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}return null!==(t=null===(o=null===(s=p.messages)||void 0===s?void 0:s[0])||void 0===o?void 0:o.message)&&void 0!==t?t:""}),[p]),j=o((()=>{var e,s,o,t;return"form"===p.type?null!==(e=p.questionResponse)&&void 0!==e?e:"":null!==(t=null===(o=null===(s=p.messages)||void 0===s?void 0:s[1])||void 0===o?void 0:o.message)&&void 0!==t?t:""}),[p]);return e("div",Object.assign({className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:x.primary,color:x.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(r,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-1.5 scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${p.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:y.length<280}),s("div",{className:"danger-html hidden flex-col peer-checked:flex",dangerouslySetInnerHTML:{__html:y}}),s("label",Object.assign({htmlFor:`${p.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:hidden hover:cursor-pointer",style:{color:x.accent}},{children:"See input"})),s("label",Object.assign({htmlFor:`${p.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:flex hover:cursor-pointer",style:{color:x.accent}},{children:"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:x.secondary,color:x.secondaryText}},{children:[s(c,{src:null==h?void 0:h.chaticon,alt:`${null==h?void 0:h.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:x.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(a,Object.assign({theme:f.theme,accentColor:x.accent,linkPreviews:!0,actions:!0},{children:s(i,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:j})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==h?void 0:h.enablechatresponses)&&e(d,Object.assign({color:x.accent,onClick:()=>{return e=p.responseId,g(!1),void u(e);var e}},{children:[s(l,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:"text-sm font-semibold"},{children:b+1}))]})),s(m,{color:x.accent,text:j})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:"text-sm font-semibold uppercase opacity-30"},{children:v}))}))]}))]}))]}))]}))};export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{format as r}from"date-fns";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import i from"../../../Icons/message-square-notes.svg.js";import l from"../../../Icons/visitor.svg.js";import m from"../../common/PickaxeIcon.js";import d from"../../common/PickaxeSimpleButton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import h from"../../common/PickaxeCopyButton.js";const x=()=>{var x;const{pickaxe:f,styles:u,colors:g,setChatId:b,setIsNewChat:v}=t(),{response:k}=n(),j=o((()=>r(k?k.createdAt:new Date,"hh:mm a MMM dd, yy")),[k]),y=o((()=>{var e;if(!k)return"";return(null!==(e=k.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[k]);return k?e("div",Object.assign({className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:g.primary,color:g.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(l,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${k.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:y.length<280}),s("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:y}}),s("label",Object.assign({htmlFor:`${k.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer",style:{color:g.accent}},{children:"See input"})),s("label",Object.assign({htmlFor:`${k.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer",style:{color:g.accent}},{children:"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:g.secondary,color:g.secondaryText}},{children:[s(m,{src:null==f?void 0:f.chaticon,alt:`${null==f?void 0:f.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:g.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(a,Object.assign({theme:u.theme,accentColor:g.accent,linkPreviews:!0,actions:!0},{children:s(c,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:k.questionResponse})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==f?void 0:f.enablechatresponses)&&e(d,Object.assign({color:g.accent,onClick:()=>{return e=k.responseId,v(!1),void b(e);var e}},{children:[s(i,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:"text-sm font-semibold"},{children:k.messages.length+1}))]})),s(h,{color:g.accent,text:null!==(x=k.questionResponse)&&void 0!==x?x:""})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:"text-sm font-semibold uppercase opacity-30"},{children:j}))}))]}))]}))]})),s(p,{})]})):null};export{x as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as t,__awaiter as i}from"../../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{useQuery as r}from"@tanstack/react-query";import{Suspense as o,lazy as a}from"react";const n=a((()=>import("lottie-react"))),d=a=>{var{getJson:d,id:s,ref:c}=a,h=t(a,["getJson","id","ref"]);const{data:m}=r({queryKey:[s],queryFn:()=>i(void 0,void 0,void 0,(function*(){return import("lottie-react"),d()})),enabled:"undefined"!=typeof window});return m?e(o,Object.assign({fallback:e("div",{style:{height:h.height,width:h.width}})},{children:e(n,Object.assign({animationData:m},h))})):e("div",{style:{height:h.height,width:h.width}})};export{d as PickaxeLottie};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as t}from"../../hooks/usePickaxeMarkdownContext.js";import r from"../common/Action.js";import i from"../Img/index.js";const o=({node:o,href:n="",children:s})=>{const{accentColor:a,linkPreviews:l,actions:c}=t(),m=(n||"").startsWith("www.")?`https://${n}`:n,d=m.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(d&&(null==d?void 0:d[1]))return e("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${d[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return m.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e(i,{src:m,alt:"string"==typeof s?s:"Markdown Image"}):c&&m.includes("pickaxe")&&(m.includes("/api/fn/result")||m.includes("/api/function_call_results"))?e(r,{jobUrl:m}):e("a",Object.assign({href:m,target:"_blank",rel:"noopener noreferrer"},l&&{className:"marked-link-possible-preview-render"},{style:{color:a,fontWeight:600}},{children:s}))};export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as o}from"../../../../../../_virtual/_tslib.js";import{jsx as r,jsxs as e,Fragment as t}from"react/jsx-runtime";import{useState as i}from"react";import{usePickaxeMarkdownContext as n}from"../../hooks/usePickaxeMarkdownContext.js";import{useHover as s}from"../../../../../../hooks/core/useHover.js";import{motion as a}from"framer-motion";import l from"../../../../../Icons/download.svg.js";const d=({node:d,src:c,alt:p})=>{const{accentColor:m}=n(),[f,b]=i(!1),h=s(),{isHover:x}=h,u=o(h,["isHover"]);return r("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:x?"translateY(-5px)":"translateY(0)"}},u,{children:f?r("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e(t,{children:[r(a.button,Object.assign({initial:"hidden",animate:x?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",top:"10px",right:"10px",backgroundColor:"#007bff",color:"#fff",border:"none",borderRadius:"4px",padding:"0.5rem 0.75rem",cursor:"pointer",fontSize:"0.875rem",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease"},whileHover:{backgroundColor:m},whileTap:{scale:.95},onClick:()=>window.open(c,"_blank")},{children:r(l,{width:24,height:24,style:{flexShrink:0}})})),r("img",{src:c,alt:p,style:{borderRadius:"8px",maxWidth:"680px"},onError:()=>b(!0)})]})}))};export{d as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as n}from"../../hooks/usePickaxeMarkdownContext.js";import s from"../common/Action.js";const i=({node:i,children:l})=>{const{actions:c}=n();if(c&&"string"==typeof l&&l.includes("pickaxe")&&(l.includes("/api/fn/result")||l.includes("/api/function_call_results"))){const n=l.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=l.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return t("div",Object.assign({className:"flex flex-col"},{children:[e("p",Object.assign({style:{fontWeight:350}},{children:n})),e(s,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e("p",Object.assign({style:{fontWeight:350}},{children:l}))};export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{useState as t,useRef as i}from"react";import{useQuery as r}from"@tanstack/react-query";import{usePickaxeMarkdownContext as n}from"../../hooks/usePickaxeMarkdownContext.js";import{loaderBlack as a}from"../../../../../../common/lotties/loader-black.js";import{loaderWhite as s}from"../../../../../../common/lotties/loader-white.js";import{PickaxeLottie as d}from"../../../PickaxeLottie.js";import{streamer as c}from"../../../../../../common/api/streamer.js";import{PickaxeMarkdownRenderer as l}from"../../Renderer.js";import{AnimatePresence as m,motion as p}from"framer-motion";import u from"../../../../../../common/api/utils.js";import f from"../../../../../../common/error.js";const v=({jobUrl:v})=>{var y,j;const{theme:h}=n(),[g,x]=t(""),b=i(null),w=r({queryKey:[v],queryFn:()=>(o=>e(void 0,void 0,void 0,(function*(){try{if(!o||o.includes("undefined"))throw new Error("Invalid action job URL");const e=yield fetch(o);return yield e.json()}catch(e){const o=f(e);return"development"===process.env.NODE_ENV&&console.error("[getJobResult]",o),{success:!1,error:o}}})))(v),enabled:"undefined"!=typeof window,retry:10,onSuccess:o=>e(void 0,void 0,void 0,(function*(){if(!o.success)return;if("text"in o)return void x(o.text||"");if(!("fcid"in o)){const e=(yield c({formId:o.formId,responseId:o.responseId,data:o.encodedData})).body;if(!e)return;let t=!0,i="";const r=e.getReader(),n=new TextDecoder;for(;t;){const{value:e,done:o}=yield r.read();t=!o;i+=n.decode(e),x(i)}return x(i),yield u.post("/fn/update",{id:o.jobId,data:Object.assign(Object.assign({},o),{text:i})}),void console.log("[Action] streaming done")}yield new Promise((e=>setTimeout(e,3e3))),w.refetch(),"development"===process.env.NODE_ENV&&console.log(`[Action] refetching <${v}>`)}))});return console.log("[ActionResult]",w.data,g),o("div",Object.assign({ref:b,className:"pxe-action"},{children:o(m,{children:w.error||(null===(y=w.data)||void 0===y?void 0:y.error)?o(p.div,Object.assign({initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3}},{children:o(l,{value:`> ${(null===(j=w.data)||void 0===j?void 0:j.error)||"Failed to process, please try again."}`})})):o(p.div,g?Object.assign({initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"mt-4"},{children:o(l,{value:g})}):Object.assign({initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3}},{children:o(d,{id:"dark"===h?"loader-white":"loader-black",getJson:()=>e(void 0,void 0,void 0,(function*(){return"dark"===h?s:a})),autoplay:!0,loop:!0,style:{cursor:"default",pointerEvents:"none",width:"100%",maxWidth:"150px",height:"150px"}})}))})}))};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsx as i}from"react/jsx-runtime";import{useRef as
|
|
1
|
+
import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsx as i}from"react/jsx-runtime";import{useRef as t}from"react";import{usePickaxeMarkdownContext as r}from"./hooks/usePickaxeMarkdownContext.js";import{Prism as n}from"react-syntax-highlighter";import l from"react-markdown";import s from"remark-gfm";import o from"remark-math";import d from"rehype-katex";import c from"./Custom/A/index.js";import a from"./Custom/P/index.js";import m from"./Custom/Img/index.js";const h=({className:h,style:g,value:p})=>{const{theme:f,syntaxTheme:b}=r(),y=t(null),j={h1:({node:e,children:t})=>i("h1",Object.assign({style:{fontSize:"2.25rem",lineHeight:"2.5rem"}},{children:t})),h2:({node:e,children:t})=>i("h2",Object.assign({style:{fontSize:"1.875rem",lineHeight:"2.25rem"}},{children:t})),h3:({node:e,children:t})=>i("h3",Object.assign({style:{fontSize:"1.5rem",lineHeight:"2rem"}},{children:t})),h4:({node:e,children:t})=>i("h4",Object.assign({className:"mt-2 text-xl",style:{fontSize:"1.25rem",lineHeight:"1.75rem"}},{children:t})),h5:({node:e,children:t})=>i("h5",Object.assign({style:{fontSize:"1.125rem",lineHeight:"1.75rem"}},{children:t})),p:a,a:c,ol:({node:e,children:t})=>i("ol",Object.assign({style:{listStyleType:"decimal",listStylePosition:"inside",paddingLeft:"1.5rem"}},{children:t})),ul:({node:e,children:t})=>i("ul",Object.assign({style:{listStyleType:"disc",listStylePosition:"inside",paddingLeft:"1.5rem"}},{children:t})),li:({node:e,children:t})=>i("li",{children:t}),table:({children:e})=>i("div",Object.assign({className:"overflow-auto"},{children:i("table",Object.assign({style:{tableLayout:"fixed",fontSize:"0.875rem",lineHeight:"1.24rem"}},{children:e}))})),th:({node:e,children:t})=>i("th",Object.assign({style:{padding:"0.75em 1em",fontWeight:600,textAlign:"left"}},{children:t})),tr:({node:e,children:t})=>i("tr",Object.assign({style:{border:"dark"===f?"1px solid #30363D":"1px solid #D0D7DE"}},{children:t})),td:({node:e,children:t})=>i("td",Object.assign({style:{padding:"0.75em 1em"}},{children:t})),code:t=>{var{node:r,children:l,className:s}=t,o=e(t,["node","children","className"]);const d=/language-(\w+)/.exec(s||"");return d?i(n,Object.assign({},o,{PreTag:"div",language:d[1],style:b,showLineNumbers:!0},{children:String(l).replace(/\n$/,"")})):i("code",Object.assign({},o,{className:s},{children:l}))},blockquote:({node:e,children:t})=>i("blockquote",Object.assign({style:{lineHeight:"15px",borderLeft:"dark"===f?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===f?"#8B8B8B":"#656D76",paddingLeft:"1rem",marginBottom:"1rem"}},{children:t})),img:m};return i("div",Object.assign({className:"pxe-markdown",ref:y,style:Object.assign({position:"relative",whiteSpace:"pre-wrap"},g)},{children:i(l,Object.assign({},h&&{className:h},{components:j,remarkPlugins:[s,o],rehypePlugins:[d]},{children:(null!=p?p:"").replace(/\u200B/g,"")}))}))};export{h as PickaxeMarkdownRenderer};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type LottieComponentProps } from "lottie-react";
|
|
2
|
+
interface PickaxeLottieProps<T extends Record<string, unknown>> {
|
|
3
|
+
getJson: () => Promise<T>;
|
|
4
|
+
id: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const PickaxeLottie: <T extends Record<string, unknown>>({ getJson, id, ref: _, ...props }: PickaxeLottieProps<T> & Omit<LottieComponentProps, "animationData">) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const usePickaxeMarkdownContext: () => {
|
|
3
|
-
theme?: ("
|
|
3
|
+
theme?: import("..").PickaxeMarkdownTheme | undefined;
|
|
4
4
|
syntaxTheme?: Record<string, import("react").CSSProperties> | undefined;
|
|
5
5
|
accentColor?: string | undefined;
|
|
6
6
|
linkPreviews?: boolean | undefined;
|
|
7
7
|
actions?: boolean | undefined;
|
|
8
|
-
setTheme?: import("../../../../../types/common").SetState<"
|
|
8
|
+
setTheme?: import("../../../../../types/common").SetState<import("..").PickaxeMarkdownTheme> | undefined;
|
|
9
9
|
setAccentColor?: import("../../../../../types/common").SetState<string> | undefined;
|
|
10
10
|
setLinkPreviews?: import("../../../../../types/common").SetState<boolean> | undefined;
|
|
11
11
|
setActions?: import("../../../../../types/common").SetState<boolean> | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SetState } from "../../../../types/common";
|
|
2
2
|
import { type CSSProperties, type ReactNode } from "react";
|
|
3
|
-
type PickaxeMarkdownTheme = "light" | "dark";
|
|
3
|
+
export type PickaxeMarkdownTheme = "light" | "dark";
|
|
4
4
|
type PickaxeMarkdownContextType = {
|
|
5
5
|
theme?: PickaxeMarkdownTheme;
|
|
6
6
|
syntaxTheme?: Record<string, CSSProperties>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pickaxeproject/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.37",
|
|
4
4
|
"description": "Client utility library for Pickaxe",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"@types/node": "^18.11.18",
|
|
70
70
|
"@types/react": "^18.0.26",
|
|
71
71
|
"@types/react-dom": "^18.0.10",
|
|
72
|
-
"@types/react-lottie": "^1.2.10",
|
|
73
72
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
74
73
|
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
|
75
74
|
"@typescript-eslint/parser": "^5.48.1",
|
|
@@ -93,13 +92,13 @@
|
|
|
93
92
|
"isomorphic-dompurify": "^2.20.0",
|
|
94
93
|
"katex": "^0.16.19",
|
|
95
94
|
"lint-staged": "^13.1.0",
|
|
95
|
+
"lottie-react": "^2.4.0",
|
|
96
96
|
"postcss": "^8.4.49",
|
|
97
97
|
"prettier": "^2.8.2",
|
|
98
98
|
"prismjs": "^1.29.0",
|
|
99
99
|
"react": "^18.2.0",
|
|
100
100
|
"react-dom": "^18.2.0",
|
|
101
101
|
"react-intersection-observer": "^9.14.1",
|
|
102
|
-
"react-lottie": "^1.2.10",
|
|
103
102
|
"react-markdown": "^9.0.3",
|
|
104
103
|
"react-syntax-highlighter": "^15.6.1",
|
|
105
104
|
"react-textarea-autosize": "^8.5.7",
|
|
@@ -138,11 +137,11 @@
|
|
|
138
137
|
"framer-motion": "^11.17.0",
|
|
139
138
|
"isomorphic-dompurify": "^2.20.0",
|
|
140
139
|
"katex": "^0.16.19",
|
|
140
|
+
"lottie-react": "^2.4.0",
|
|
141
141
|
"prismjs": "^1.29.0",
|
|
142
142
|
"react": "^16.8.0 || ^17 || ^18",
|
|
143
143
|
"react-dom": "^16.8.0 || ^17 || ^18",
|
|
144
144
|
"react-intersection-observer": "^9.14.1",
|
|
145
|
-
"react-lottie": "^1.2.10",
|
|
146
145
|
"react-markdown": "^9.0.3",
|
|
147
146
|
"react-syntax-highlighter": "^15.6.1",
|
|
148
147
|
"react-tooltip": "^5.28.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./hooks/usePickaxeMarkdownContext.js"),r=require("../../../../common/lotties/loader-black.js"),i=require("../../../../common/lotties/loader-white.js"),s=require("react-lottie"),a=require("./Img.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(s);exports.default=({node:s,href:o="",children:l})=>{const{theme:c,accentColor:u,linkPreviews:d,actions:m}=t.usePickaxeMarkdownContext(),p=(o||"").startsWith("www.")?`https://${o}`:o,f=p.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(f&&(null==f?void 0:f[1]))return e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${f[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return p.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e.jsx(a.default,{src:p,alt:"string"==typeof l?l:"Markdown Image"}):m&&p.includes("pickaxe")&&(p.includes("/api/fn/result")||p.includes("/api/function_call_results"))?e.jsx("div",Object.assign({className:"marked-link-function-calling-loader",style:{width:"100%",maxWidth:"150px",minHeight:"150px"}},{children:e.jsx(n.default,{style:{cursor:"default",pointerEvents:"none"},options:{autoplay:!0,loop:!0,animationData:"dark"===c?i.loaderWhite:r.loaderBlack},isClickToPauseDisabled:!0,width:150,height:150})})):e.jsx("a",Object.assign({href:p,target:"_blank",rel:"noopener noreferrer"},d&&{className:"marked-link-possible-preview-render"},{style:{color:u,fontWeight:600}},{children:l}))};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");exports.default=({node:r,src:s,alt:i})=>{const[n,a]=t.useState(!1);return e.jsx("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:n?e.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e.jsx("img",{src:s,alt:i,style:{borderRadius:"8px",maxWidth:"680px"},onError:()=>a(!0)})}))};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{usePickaxeMarkdownContext as t}from"./hooks/usePickaxeMarkdownContext.js";import{loaderBlack as i}from"../../../../common/lotties/loader-black.js";import{loaderWhite as o}from"../../../../common/lotties/loader-white.js";import r from"react-lottie";import s from"./Img.js";const n=({node:n,href:a="",children:l})=>{const{theme:c,accentColor:m,linkPreviews:d,actions:p}=t(),u=(a||"").startsWith("www.")?`https://${a}`:a,f=u.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(f&&(null==f?void 0:f[1]))return e("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${f[1]}`,style:{width:"100%",maxWidth:"560px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));return u.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif)$/)?e(s,{src:u,alt:"string"==typeof l?l:"Markdown Image"}):p&&u.includes("pickaxe")&&(u.includes("/api/fn/result")||u.includes("/api/function_call_results"))?e("div",Object.assign({className:"marked-link-function-calling-loader",style:{width:"100%",maxWidth:"150px",minHeight:"150px"}},{children:e(r,{style:{cursor:"default",pointerEvents:"none"},options:{autoplay:!0,loop:!0,animationData:"dark"===c?o:i},isClickToPauseDisabled:!0,width:150,height:150})})):e("a",Object.assign({href:u,target:"_blank",rel:"noopener noreferrer"},d&&{className:"marked-link-possible-preview-render"},{style:{color:m,fontWeight:600}},{children:l}))};export{n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import{useState as e}from"react";const r=({node:r,src:i,alt:n})=>{const[o,s]=e(!1);return t("div",Object.assign({style:{marginTop:"2.5rem",marginBottom:"2.5rem",display:"flex",width:"100%",justifyContent:"center"}},{children:o?t("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):t("img",{src:i,alt:n,style:{borderRadius:"8px",maxWidth:"680px"},onError:()=>s(!0)})}))};export{r as default};
|