@pickaxeproject/react 2.1.9 → 2.1.11

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js"),t=require("../../../../common/utils.js"),r=require("../../../../hooks/pickaxe/useDocumentData.js"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),c=require("../../../Icons/file.svg.js");exports.default=({documentId:n})=>{const i=r.useDocumentData({documentId:n}),{colors:u,styles:l}=a.usePickaxeContext(),d=o.useStyleFontSize();return"success"!==i.status?e.jsx("div",{}):e.jsxs("a",Object.assign({href:i.data.storageUrl?i.data.storageUrl:"#",target:"_blank",className:"gap-x-[10px] w-full max-w-[500px] flex items-center px-2 h-[56px] border",style:{borderRadius:l.cornerRadius,borderColor:u.secondary+"50"},rel:"noreferrer"},{children:[e.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:u.secondary,borderRadius:l.cornerRadius}},{children:e.jsx(c.default,{className:"w-5 h-5",style:{color:u.secondaryText}})})),e.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[e.jsx("p",Object.assign({className:(s.default(d.b3),"font-medium truncate")},{children:i.data.name})),e.jsxs("p",Object.assign({className:s.default(d.b4,"opacity-80 truncate")},{children:[i.data.extension&&i.data.extension.toUpperCase()+", ",t.formatBytes(i.data.size)]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../../common/cn.js"),t=require("../../../../common/utils.js"),r=require("../../../../hooks/pickaxe/useDocumentData.js"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),c=require("../../../../hooks/studio/useStyleFontSize.js"),o=require("../../../Icons/file.svg.js");exports.default=({documentId:i})=>{const n=r.useDocumentData({documentId:i}),{colors:l,styles:u,isRtl:d}=a.usePickaxeContext(),x=c.useStyleFontSize();return"success"!==n.status?e.jsx("div",{}):e.jsxs("a",Object.assign({href:n.data.storageUrl?n.data.storageUrl:"#",target:"_blank",className:s.default("gap-x-[10px] w-full max-w-[500px] flex items-center px-2 h-[56px] border",d&&"flex-row-reverse"),style:{borderRadius:u.cornerRadius,borderColor:l.secondary+"50"},rel:"noreferrer"},{children:[e.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:l.accent,borderRadius:u.cornerRadius}},{children:e.jsx(o.default,{className:"w-5 h-5",style:{color:l.accentText}})})),e.jsxs("div",Object.assign({className:s.default("flex flex-col justify-center truncate",d?"text-right":"text-left")},{children:[e.jsx("p",Object.assign({className:(s.default(x.b3),"font-medium truncate")},{children:n.data.name})),e.jsxs("p",Object.assign({className:s.default(x.b4,"opacity-80 truncate")},{children:[n.data.extension&&n.data.extension.toUpperCase()+", ",t.formatBytes(n.data.size)]}))]}))]}))};
@@ -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/studio/useStyleFontSize.js"),c=require("../../common/PickaxeMarkdown/index.js"),i=require("../../common/PickaxeMarkdown/Renderer.js"),n=require("../../common/PickaxeIcon.js"),o=require("./Document.js"),r=require("../../common/PickaxeCopyButton.js"),l=require("../../../../common/cn.js");exports.default=({index:d,message:x,isIntroExpand:m})=>{var u,p;const{formId:j,pickaxe:h,styles:k,colors:f,misc:g,responsiveBy:v,isNewChat:b}=t.usePickaxeContext(),w=a.useStyleFontSize(),y=null!==(u=null==h?void 0:h.chaticon)&&void 0!==u?u:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${j}.png`;return"assistant"===x.role?e.jsx("div",Object.assign({className:l.default("flex flex-col",0===d&&b&&"viewport"===v&&"min-[767px]:max-w-[80%]",0===d&&b&&"container"===v&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:e.jsxs("div",Object.assign({className:"flex gap-x-3"},{children:[g.isChatImage&&"NONE"!==y&&e.jsx(n.default,{src:y,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:f.text}),e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("div",Object.assign({className:l.default(w.b2,"chat-message pt-3")},{children:e.jsx(c.PickaxeMarkdown,Object.assign({theme:k.theme,accentColor:f.accent,actions:!0},{children:e.jsx(i.PickaxeMarkdownRenderer,Object.assign({value:x.content},0===d&&b&&x.content.length>470&&3===(null!==(p=null==h?void 0:h.icebreakers)&&void 0!==p?p:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:m?void 0:12}))}))})),e.jsx("div",Object.assign({className:"mt-4 flex gap-3"},{children:e.jsx(r.default,{color:f.accent,text:x.content})}))]}))]}))})):"user"===x.role?e.jsx("div",Object.assign({className:l.default("flex gap-x-3 justify-self-end pl-9","viewport"===v?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:e.jsxs("div",Object.assign({className:l.default(w.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:f.secondary+"80",color:f.secondaryText,borderRadius:k.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e.jsx("div",Object.assign({className:"flex flex-col items-end"},{children:x.documentIds.map((t=>e.jsx(s.Fragment,{children:t.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:k.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e.jsx(o.default,{documentId:t})},t)))})),e.jsx(c.PickaxeMarkdown,Object.assign({theme:k.theme,accentColor:f.accent},{children:e.jsx(i.PickaxeMarkdownRenderer,{value:x.content})}))]}))})):e.jsx("div",{})};
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/studio/useStyleFontSize.js"),i=require("../../common/PickaxeMarkdown/index.js"),c=require("../../common/PickaxeMarkdown/Renderer.js"),r=require("../../common/PickaxeIcon.js"),l=require("./Document.js"),n=require("../../common/PickaxeCopyButton.js"),o=require("../../../../common/cn.js");exports.default=({index:d,message:x,isIntroExpand:u})=>{var m,j;const{formId:p,pickaxe:h,styles:f,colors:g,misc:v,responsiveBy:k,isNewChat:b,isRtl:w}=t.usePickaxeContext(),y=a.useStyleFontSize(),N=null!==(m=null==h?void 0:h.chaticon)&&void 0!==m?m:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${p}.png`;return"assistant"===x.role?e.jsx("div",Object.assign({className:o.default("flex w-full",w?"justify-end":"justify-start")},{children:e.jsx("div",Object.assign({className:o.default("flex flex-col",0===d&&b&&"viewport"===k&&"min-[767px]:max-w-[80%]",0===d&&b&&"container"===k&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:e.jsxs("div",Object.assign({className:o.default("flex gap-x-3",w&&"flex-row-reverse")},{children:[v.isChatImage&&"NONE"!==N&&e.jsx(r.default,{src:N,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:g.text}),e.jsxs("div",Object.assign({className:o.default("flex flex-col",w?"items-end":"items-start")},{children:[e.jsx("div",Object.assign({className:o.default(y.b2,"chat-message pt-3",w?"text-right":"text-left")},{children:e.jsx(i.PickaxeMarkdown,Object.assign({theme:f.theme,accentColor:g.accent,actions:!0},{children:e.jsx(c.PickaxeMarkdownRenderer,Object.assign({value:x.content},0===d&&b&&x.content.length>470&&3===(null!==(j=null==h?void 0:h.icebreakers)&&void 0!==j?j:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:u?void 0:12}))}))})),e.jsx("div",Object.assign({className:"mt-4 flex gap-3"},{children:e.jsx(n.default,{color:g.accent,text:x.content})}))]}))]}))}))})):"user"===x.role?e.jsx("div",Object.assign({className:o.default("flex w-full",w?"justify-start":"justify-end")},{children:e.jsx("div",Object.assign({className:o.default("flex gap-x-3 max-w-[80%]",w?"pr-9":"pl-9","viewport"===k?w?"min-[767px]:pr-0":"min-[767px]:pl-0":w?"@[767px]/pickaxe-root:pr-0":"@[767px]/pickaxe-root:pl-0")},{children:e.jsxs("div",Object.assign({className:o.default(y.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",w?"text-right":"text-left"),style:{backgroundColor:g.secondary+"80",color:g.secondaryText,borderRadius:f.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e.jsx("div",Object.assign({className:o.default("flex flex-col",w?"items-start":"items-end")},{children:x.documentIds.map((t=>e.jsx(s.Fragment,{children:t.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:f.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e.jsx(l.default,{documentId:t})},t)))})),e.jsx(i.PickaxeMarkdown,Object.assign({theme:f.theme,accentColor:g.accent},{children:e.jsx(c.PickaxeMarkdownRenderer,{value:x.content})}))]}))}))})):e.jsx("div",{})};
@@ -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("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../../hooks/pickaxe/useDimensionContext.js"),i=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),n=require("../../../../hooks/pickaxe/useConversation.js"),r=require("../../common/PickaxeIcon.js"),c=require("../../../Core/ErrorAlert.js"),d=require("../../../Core/Skeleton.js"),u=require("../../Addons/Scroll/ScrollLockView.js"),x=require("../../common/PickaxeHead.js"),m=require("../../common/PickaxeCompactHead.js"),f=require("../../common/PickaxeUpgradeCard.js"),j=require("./Message.js"),h=require("../../common/PickaxeBranding.js"),p=require("../../../../common/cn.js");exports.default=({hideInfo:g,isInputFocused:w})=>{var v;const N=n.useConversation(),b=o.useStyleFontSize(),{pickaxe:k,colors:C,misc:y,isNewChat:q,isEmbed:O,setChatId:S}=a.usePickaxeContext(),{scrollContainerRef:P}=i.useScrollContext(),{messages:I,status:L,limitData:E,error:M}=t.useResponseContext(),{height:A}=l.useDimensionContext(),H=s.useMemo((()=>!!N.data&&!(N.data.messages.length<=1)),[N.data]),z=s.useMemo((()=>!g&&N.isSuccess&&q&&!H),[g,N.isSuccess,q,H]),D=s.useMemo((()=>{var e,s;return!!I.length&&!(null!==(s=null===(e=null==I?void 0:I[I.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[I]);return e.jsx("div",Object.assign({ref:P,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${A}px - 74px)`}},{children:e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(z||!O)&&!y.isWhiteLabel&&e.jsx(h.default,{className:p.default("absolute top-4 right-4",!z&&!O&&"top-2"),animateHover:!0}),e.jsx(x.default,{className:p.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",z&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>S("")}),O&&!N.isLoading&&e.jsx(m.default,{className:p.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!z&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>S("")}),e.jsx("div",Object.assign({className:p.default("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",O&&!N.isLoading&&!z&&"mt-0")},{children:N.isLoading&&!(null==k?void 0:k.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[q&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(d.default,{className:"w-[72px] h-[72px]"}),e.jsx(d.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(d.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(d.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(d.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):N.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:p.default(b.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):N.data?e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[N.data.messages.map(((s,a)=>e.jsx(j.default,Object.assign({index:a,message:s},0===a&&{isIntroExpand:w}),a))),I.map(((s,a)=>e.jsx(j.default,{index:N.data.messages.length+a,message:s},a))),"fetching"===L||D?e.jsxs("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==k?void 0:k.chaticon)&&e.jsx(r.default,{src:null!==(v=null==k?void 0:k.chaticon)&&void 0!==v?v:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==k?void 0:k.formid}.png`,alt:`${null==k?void 0:k.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e.jsx("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e.jsx("div",{className:p.default("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:C.secondaryText}},a)))}))]})):E?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(f.default,{})})):M?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(c.default,{error:M})})):null]})),e.jsx(u.default,{className:"w-full"})]})):null}))]}))}))};
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("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../../hooks/pickaxe/useDimensionContext.js"),i=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),n=require("../../../../hooks/pickaxe/useConversation.js"),r=require("../../common/PickaxeIcon.js"),c=require("../../../Core/ErrorAlert.js"),d=require("../../../Core/Skeleton.js"),u=require("../../Addons/Scroll/ScrollLockView.js"),x=require("../../common/PickaxeHead.js"),m=require("../../common/PickaxeCompactHead.js"),f=require("../../common/PickaxeUpgradeCard.js"),j=require("./Message.js"),h=require("../../common/PickaxeBranding.js"),p=require("../../../../common/cn.js");exports.default=({hideInfo:g,isInputFocused:w})=>{var v;const N=n.useConversation(),b=o.useStyleFontSize(),{pickaxe:k,colors:y,misc:C,isNewChat:q,isRtl:O,isEmbed:S,setChatId:P}=a.usePickaxeContext(),{scrollContainerRef:I}=i.useScrollContext(),{messages:L,status:E,limitData:M,error:A}=t.useResponseContext(),{height:H}=l.useDimensionContext(),R=s.useMemo((()=>!!N.data&&!(N.data.messages.length<=1)),[N.data]),z=s.useMemo((()=>!g&&N.isSuccess&&q&&!R),[g,N.isSuccess,q,R]),D=s.useMemo((()=>{var e,s;return!!L.length&&!(null!==(s=null===(e=null==L?void 0:L[L.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[L]);return e.jsx("div",Object.assign({ref:I,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${H}px - 74px)`}},{children:e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(z||!S)&&!C.isWhiteLabel&&e.jsx(h.default,{className:p.default("absolute top-4 right-4",!z&&!S&&"top-2"),animateHover:!0}),e.jsx(x.default,{className:p.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",z&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>P("")}),S&&!N.isLoading&&e.jsx(m.default,{className:p.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!z&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>P("")}),e.jsx("div",Object.assign({className:p.default("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",S&&!N.isLoading&&!z&&"mt-0")},{children:N.isLoading&&!(null==k?void 0:k.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[q&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(d.default,{className:"w-[72px] h-[72px]"}),e.jsx(d.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(d.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(d.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(d.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):N.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:p.default(b.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):N.data?e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[N.data.messages.map(((s,a)=>e.jsx(j.default,Object.assign({index:a,message:s},0===a&&{isIntroExpand:w}),a))),L.map(((s,a)=>e.jsx(j.default,{index:N.data.messages.length+a,message:s},a))),"fetching"===E||D?e.jsxs("div",Object.assign({className:p.default("flex max-w-[80%] items-center gap-x-3 ",O?"justify-end":"justify-start")},{children:["NONE"!==(null==k?void 0:k.chaticon)&&e.jsx(r.default,{src:null!==(v=null==k?void 0:k.chaticon)&&void 0!==v?v:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==k?void 0:k.formid}.png`,alt:`${null==k?void 0:k.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:y.text}),e.jsx("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e.jsx("div",{className:p.default("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:y.secondaryText}},a)))}))]})):M?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(f.default,{})})):A?e.jsx("div",Object.assign({className:p.default("flex items-center gap-x-3",O?"justify-end":"justify-start")},{children:e.jsx(c.default,{error:A})})):null]})),e.jsx(u.default,{className:"w-full"})]})):null}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),o=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../hooks/studio/useStyleInput.js"),n=require("../../../hooks/studio/useStyleFontSize.js"),i=require("../../../hooks/pickaxe/useConversation.js"),a=require("../../../hooks/pickaxe/useSubmit.js"),d=require("../Addons/Document/hooks/useDocument.js"),c=require("../Addons/Scroll/hooks/useScroll.js"),u=require("../../../hooks/core/useHover.js"),m=require("../../../common/utils.js"),x=require("../../../common/documents.js"),f=require("eventsource-parser"),p=require("../../Icons/attach-vertical.svg.js"),h=require("../../Icons/spinner-lines.svg.js"),g=require("../../Icons/file.svg.js"),b=require("../../Icons/x.svg.js"),j=require("../../Icons/arrow-right.svg.js"),v=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),k=require("../../../common/error.js"),w=require("../../../common/cn.js");exports.default=({isFocused:I,onFocus:N,onBlur:O})=>{var C;const{formId:q,chatId:S,userId:R,studioUserId:_,embedUserId:T,deploymentId:A,pickaxe:F,styles:B,colors:D,responsiveBy:U,isNewChat:H,setIsNewChat:E,setIsShowIceBreaker:z,onGenerateComplete:M}=o.usePickaxeContext(),{messages:P,status:L,limits:$,isGenerating:G,setMessages:J,setStatus:K,setLimitData:W,setError:Q}=r.useResponseContext(),{documents:V,isUploading:X,isImageUploadAllowed:Y,setDocuments:Z,onFileUpload:ee}=d.useDocument(),{scrollStartSession:se,scrollEndSession:te,scrollToBottom:oe}=c.useScroll({auto:!0}),re=i.useConversation(),le=a.useSubmit(),[ne,ie]=t.useState(""),ae=t.useRef(null),de=u.useHover(),{isHover:ce}=de,ue=e.__rest(de,["isHover"]),me=u.useHover(),{isHover:xe}=me,fe=e.__rest(me,["isHover"]),pe=n.useStyleFontSize(),he=l.useStyleInput(),ge=t.useMemo((()=>{var e,s,t;return!!H&&(!!F&&(!re.isLoading&&(!((null!==(s=null===(e=re.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=F.icebreakers)||void 0===t?void 0:t.length))))}),[F,H,re.data,re.isLoading]),be=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==L||X)return;const e=null!=s?s:ne;if(!e)return;Q(""),W(null),ie(""),E(!1),K("fetching"),se(),oe();const t=V.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=t.length?t[t.length-1].documentId:"",r="enduserupload"===(null==F?void 0:F.documentuploadtype)&&o,l=[...Array.from(P),Object.assign({id:P.length+1,role:"user",content:e},r&&{documentIds:[o]})];J(l),oe(),r&&Z([]);const n=(yield le.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:q,responseId:S,value:e},r&&{documentId:o}),R&&{userId:R}),_&&{studioUserId:_}),T&&{embedUserId:T}),A&&{deploymentId:A}))).body;if(!n)throw new Error("Streaming error");const i=l.length,a=new TextDecoder,d=n.getReader();let c="",u=!0,m=!1;const x=f.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=s,J([...l.slice(0,i),{id:P.length+1,role:"assistant",content:c}])}else if("error"===e.event){const s=JSON.parse(e.data);Q(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:s}=yield d.read();if(s){u=!1;break}const t=a.decode(e);t&&(m||(K("streaming"),m=!0),x.feed(t))}null==M||M(S)}catch(e){let s=k.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries($).find((([e])=>s.includes(e)));t?W(t[1]):Q(s)}finally{oe(),K("idle"),te()}}));return t.useEffect((()=>{z(ge)}),[ge]),s.jsx("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1"},{children:s.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[s.jsx("div",Object.assign({className:"absolute right-0 bottom-full"},{children:s.jsx("div",Object.assign({className:w.default("flex justify-end flex-col gap-2 pb-4 px-2","viewport"===U?"min-[767px]:items-end":"@[767px]/pickaxe-root:items-end")},{children:ge&&!I&&s.jsx(v.default,{data:(null==F?void 0:F.icebreakers)||[],onSend:be})}))})),s.jsxs("div",Object.assign({className:w.default("flex flex-col gap-y-2 px-4 py-3","block"===B.formFieldStyle&&"shadow"),style:he},{children:["idle"===L&&V.length>0&&s.jsx("div",Object.assign({className:w.default("grid grid-cols-1","viewport"===U?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:V.map((e=>{var o,r,l;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:he.borderRadius,borderColor:D.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:D.accent,borderRadius:he.borderRadius}},{children:X?s.jsx(h.default,{className:"w-5 h-5 animate-spin",style:{color:D.accentText}}):s.jsx(g.default,{className:"w-5 h-5",style:{color:D.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(w.default(pe.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:w.default(pe.b4,"opacity-80 truncate")},{children:m.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:D.accent,borderColor:he.backgroundColor},disabled:X||"idle"!==L,onClick:()=>Z([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:D.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:he.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:he.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:he.borderRadius,backgroundColor:D.secondary}}),s.jsx("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:D.accent,borderColor:he.backgroundColor},disabled:X||"idle"!==L,onClick:()=>Z([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:D.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:"flex items-end gap-x-2"},{children:[s.jsx(y.default,{className:w.default(pe.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!ne.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:ne,placeholder:null!==(C=null==F?void 0:F.placeholdertext)&&void 0!==C?C:"What do you want to talk about?",onChange:e=>ie(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),X||"idle"!==L||be()))},onFocus:N,onBlur:O}),s.jsxs("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==F?void 0:F.documentuploadtype)&&s.jsxs("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:xe?D.accent+"10":void 0},disabled:X||"idle"!==L,onClick:()=>{var e;return null===(e=ae.current)||void 0===e?void 0:e.click()}},fe,{children:[s.jsx("input",{id:"file-upload",ref:ae,type:"file",accept:[...x.allowedFileMimeTypes,...Y?x.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield ee(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(p.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:xe?D.accent:D.accent+"80"}})]})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(ce||ne.length||V.length&&V.every((e=>"finished"===e.status)))&&!G?D.accent:D.accent+"10"},disabled:X||"idle"!==L,onClick:()=>be()},ue,{children:s.jsx(j.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(ce||ne.length||V.length&&V.every((e=>"finished"===e.status)))&&!G?D.accentText:D.accent+"80"}})}))]}))]}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../hooks/studio/useStyleInput.js"),i=require("../../../hooks/studio/useStyleFontSize.js"),a=require("../../../hooks/pickaxe/useConversation.js"),n=require("../../../hooks/pickaxe/useSubmit.js"),d=require("../Addons/Document/hooks/useDocument.js"),c=require("../Addons/Scroll/hooks/useScroll.js"),u=require("../../../hooks/core/useHover.js"),m=require("../../../common/utils.js"),f=require("../../../common/documents.js"),x=require("eventsource-parser"),h=require("../../Icons/attach-vertical.svg.js"),p=require("../../Icons/spinner-lines.svg.js"),g=require("../../Icons/file.svg.js"),b=require("../../Icons/x.svg.js"),j=require("../../Icons/arrow-right.svg.js"),v=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),k=require("../../../common/error.js"),w=require("../../../common/cn.js");exports.default=({isFocused:I,onFocus:N,onBlur:O})=>{var C;const{formId:q,isRtl:S,chatId:R,userId:_,studioUserId:T,embedUserId:A,deploymentId:F,pickaxe:B,styles:D,colors:U,responsiveBy:H,isNewChat:E,setIsNewChat:z,setIsShowIceBreaker:M,onGenerateComplete:P}=r.usePickaxeContext(),{messages:L,status:$,limits:G,isGenerating:J,setMessages:K,setStatus:W,setLimitData:Q,setError:V}=o.useResponseContext(),{documents:X,isUploading:Y,isImageUploadAllowed:Z,setDocuments:ee,onFileUpload:se}=d.useDocument(),{scrollStartSession:te,scrollEndSession:re,scrollToBottom:oe}=c.useScroll({auto:!0}),le=a.useConversation(),ie=n.useSubmit(),[ae,ne]=t.useState(""),de=t.useRef(null),ce=u.useHover(),{isHover:ue}=ce,me=e.__rest(ce,["isHover"]),fe=u.useHover(),{isHover:xe}=fe,he=e.__rest(fe,["isHover"]),pe=i.useStyleFontSize(),ge=l.useStyleInput(),be=t.useMemo((()=>{var e,s,t;return!!E&&(!!B&&(!le.isLoading&&(!((null!==(s=null===(e=le.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=B.icebreakers)||void 0===t?void 0:t.length))))}),[B,E,le.data,le.isLoading]),je=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==$||Y)return;const e=null!=s?s:ae;if(!e)return;V(""),Q(null),ne(""),z(!1),W("fetching"),te(),oe();const t=X.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),r=t.length?t[t.length-1].documentId:"",o="enduserupload"===(null==B?void 0:B.documentuploadtype)&&r,l=[...Array.from(L),Object.assign({id:L.length+1,role:"user",content:e},o&&{documentIds:[r]})];K(l),oe(),o&&ee([]);const i=(yield ie.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:q,responseId:R,value:e},o&&{documentId:r}),_&&{userId:_}),T&&{studioUserId:T}),A&&{embedUserId:A}),F&&{deploymentId:F}))).body;if(!i)throw new Error("Streaming error");const a=l.length,n=new TextDecoder,d=i.getReader();let c="",u=!0,m=!1;const f=x.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=s,K([...l.slice(0,a),{id:L.length+1,role:"assistant",content:c}])}else if("error"===e.event){const s=JSON.parse(e.data);V(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:s}=yield d.read();if(s){u=!1;break}const t=n.decode(e);t&&(m||(W("streaming"),m=!0),f.feed(t))}null==P||P(R)}catch(e){let s=k.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(G).find((([e])=>s.includes(e)));t?Q(t[1]):V(s)}finally{oe(),W("idle"),re()}}));return t.useEffect((()=>{M(be)}),[be]),s.jsx("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1",dir:S?"rtl":"ltr"},{children:s.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[s.jsx("div",Object.assign({className:w.default("absolute bottom-full",S?"left-0":"right-0")},{children:s.jsx("div",Object.assign({className:w.default("flex flex-col gap-2 pb-4 px-2",S?"justify-start":"justify-end","viewport"===H?S?"min-[767px]:items-start":"min-[767px]:items-end":S?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:be&&!I&&s.jsx(v.default,{data:(null==B?void 0:B.icebreakers)||[],onSend:je})}))})),s.jsxs("div",Object.assign({className:w.default("flex flex-col gap-y-2 px-4 py-3","block"===D.formFieldStyle&&"shadow"),style:ge},{children:["idle"===$&&X.length>0&&s.jsx("div",Object.assign({className:w.default("grid grid-cols-1","viewport"===H?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:X.map((e=>{var r,o,l;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:w.default("relative gap-x-[10px] flex items-center px-2 h-[56px] border",S&&"flex-row-reverse"),style:{borderRadius:ge.borderRadius,borderColor:U.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:U.accent,borderRadius:ge.borderRadius}},{children:Y?s.jsx(p.default,{className:"w-5 h-5 animate-spin",style:{color:U.accentText}}):s.jsx(g.default,{className:"w-5 h-5",style:{color:U.accentText}})})),s.jsxs("div",Object.assign({className:w.default("flex flex-col justify-center truncate",S?"text-right items-end":"text-left items-start")},{children:[s.jsx("p",Object.assign({className:(w.default(pe.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:w.default(pe.b4,"opacity-80 truncate")},{children:m.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",className:w.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",S?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:ge.backgroundColor},disabled:Y||"idle"!==$,onClick:()=>ee([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ge.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:ge.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[1]}.${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ge.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",className:w.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",S?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:ge.backgroundColor},disabled:Y||"idle"!==$,onClick:()=>ee([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:w.default("flex items-end gap-x-2",S&&"flex-row-reverse")},{children:[s.jsx(y.default,{className:w.default(pe.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!ae.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",S?"text-right":"text-left"),value:ae,placeholder:S?"بماذا تريد أن تتحدث؟":null!==(C=null==B?void 0:B.placeholdertext)&&void 0!==C?C:"What do you want to talk about?",onChange:e=>ne(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),Y||"idle"!==$||je()))},onFocus:N,onBlur:O,dir:S?"rtl":"ltr"}),s.jsxs("div",Object.assign({className:w.default("flex items-center gap-x-2")},{children:["enduserupload"===(null==B?void 0:B.documentuploadtype)&&s.jsxs("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:xe?U.accent+"10":void 0},disabled:Y||"idle"!==$,onClick:()=>{var e;return null===(e=de.current)||void 0===e?void 0:e.click()}},he,{children:[s.jsx("input",{id:"file-upload",ref:de,type:"file",accept:[...f.allowedFileMimeTypes,...Z?f.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield se(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(h.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:xe?U.accent:U.accent+"80"}})]})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(ue||ae.length||X.length&&X.every((e=>"finished"===e.status)))&&!J?U.accent:U.accent+"10"},disabled:Y||"idle"!==$,onClick:()=>je()},me,{children:s.jsx(j.default,{className:w.default("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",S&&"transform scale-x-[-1]"),style:{color:(ue||ae.length||X.length&&X.every((e=>"finished"===e.status)))&&!J?U.accentText:U.accent+"80"}})}))]}))]}))]}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("./Addons/Document/Provider.js"),i=require("./ResponseProvider.js"),r=require("./DimensionProvider.js");const o=s.createContext({});exports.PickaxeContext=o,exports.PickaxeProvider=({children:a,userId:n="",studioUserId:d="",deploymentId:c="",embedUserId:l="",styles:u,colors:p,limits:h={},misc:m={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:F,responsiveBy:b="viewport",isEmbed:x=!1,forceMobile:I=!1,loadFont:y=!0,onGenerateComplete:f})=>{const[g,S]=s.useState(""),[j,P]=s.useState(""),[v,w]=s.useState(null),[k,C]=s.useState(!1),[O,q]=s.useState(!0),[D,H]=s.useState(!0),[U,B]=s.useState(!1);return s.useEffect((()=>{C(!1)}),[null==u?void 0:u.font]),e.jsx(o.Provider,Object.assign({value:Object.assign({formId:g,chatId:j,userId:n,studioUserId:d,deploymentId:c,embedUserId:l,pickaxe:v,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},u),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},p),misc:m,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},F),responsiveBy:b,isFontLoaded:k,isNewChat:O,isShowIceBreaker:D,isShowHistory:U,loadFont:y,forceMobile:I,isEmbed:x,setIsFontLoaded:C,setFormId:S,setChatId:P,setPickaxe:w,setIsNewChat:q,setIsShowIceBreaker:H,setIsShowHistory:B},f&&{onGenerateComplete:f})},{children:e.jsx(i.default,Object.assign({limits:h},{children:e.jsx(r.default,{children:e.jsx(t.default,{children:a})})}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("./Addons/Document/Provider.js"),i=require("./ResponseProvider.js"),r=require("./DimensionProvider.js");const o=s.createContext({});exports.PickaxeContext=o,exports.PickaxeProvider=({children:a,isRtl:n=!1,userId:d="",studioUserId:l="",deploymentId:c="",embedUserId:u="",styles:p,colors:h,limits:m={},misc:F={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:b,responsiveBy:x="viewport",isEmbed:I=!1,forceMobile:y=!1,loadFont:f=!0,onGenerateComplete:g})=>{const[S,j]=s.useState(""),[P,v]=s.useState(""),[w,k]=s.useState(null),[C,O]=s.useState(!1),[q,D]=s.useState(!0),[H,R]=s.useState(!0),[U,B]=s.useState(!1);return s.useEffect((()=>{O(!1)}),[null==p?void 0:p.font]),e.jsx(o.Provider,Object.assign({value:Object.assign({formId:S,isRtl:n,chatId:P,userId:d,studioUserId:l,deploymentId:c,embedUserId:u,pickaxe:w,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},p),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},h),misc:F,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},b),responsiveBy:x,isFontLoaded:C,isNewChat:q,isShowIceBreaker:H,isShowHistory:U,loadFont:f,forceMobile:y,isEmbed:I,setIsFontLoaded:O,setFormId:j,setChatId:v,setPickaxe:k,setIsNewChat:D,setIsShowIceBreaker:R,setIsShowHistory:B},g&&{onGenerateComplete:g})},{children:e.jsx(i.default,Object.assign({limits:m},{children:e.jsx(r.default,{children:e.jsx(t.default,{children:a})})}))}))};
@@ -35,6 +35,7 @@ export type PickaxeMisc = {
35
35
  };
36
36
  type PickaxeContextType = {
37
37
  formId: string;
38
+ isRtl?: boolean;
38
39
  chatId: string;
39
40
  userId: string;
40
41
  studioUserId: string;
@@ -64,6 +65,7 @@ type PickaxeContextType = {
64
65
  };
65
66
  export interface IPickaxeProviderProps {
66
67
  children: ReactNode;
68
+ isRtl?: boolean;
67
69
  userId?: string;
68
70
  studioUserId?: string;
69
71
  deploymentId?: string;
@@ -80,5 +82,5 @@ export interface IPickaxeProviderProps {
80
82
  onGenerateComplete?: (responseId: string) => void;
81
83
  }
82
84
  export declare const PickaxeContext: import("react").Context<PickaxeContextType>;
83
- export declare const PickaxeProvider: ({ children, userId, studioUserId, deploymentId, embedUserId, styles, colors, limits, misc, translations, responsiveBy, isEmbed, forceMobile, loadFont, onGenerateComplete, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
85
+ export declare const PickaxeProvider: ({ children, isRtl, userId, studioUserId, deploymentId, embedUserId, styles, colors, limits, misc, translations, responsiveBy, isEmbed, forceMobile, loadFont, onGenerateComplete, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
84
86
  export {};
@@ -1,5 +1,6 @@
1
1
  export interface PickaxeProps {
2
2
  formId: string;
3
+ isRtl?: boolean;
3
4
  className?: string;
4
5
  }
5
6
  export declare const Pickaxe: ({ formId: _formId, className }: PickaxeProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  export declare const usePickaxeContext: () => {
2
2
  formId: string;
3
+ isRtl?: boolean | undefined;
3
4
  chatId: string;
4
5
  userId: string;
5
6
  studioUserId: string;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import t from"../../../../common/cn.js";import{formatBytes as r}from"../../../../common/utils.js";import{useDocumentData as o}from"../../../../hooks/pickaxe/useDocumentData.js";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import n from"../../../Icons/file.svg.js";const i=({documentId:i})=>{const l=o({documentId:i}),{colors:m,styles:d}=a(),u=c();return"success"!==l.status?e("div",{}):s("a",Object.assign({href:l.data.storageUrl?l.data.storageUrl:"#",target:"_blank",className:"gap-x-[10px] w-full max-w-[500px] flex items-center px-2 h-[56px] border",style:{borderRadius:d.cornerRadius,borderColor:m.secondary+"50"},rel:"noreferrer"},{children:[e("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:m.secondary,borderRadius:d.cornerRadius}},{children:e(n,{className:"w-5 h-5",style:{color:m.secondaryText}})})),s("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[e("p",Object.assign({className:(t(u.b3),"font-medium truncate")},{children:l.data.name})),s("p",Object.assign({className:t(u.b4,"opacity-80 truncate")},{children:[l.data.extension&&l.data.extension.toUpperCase()+", ",r(l.data.size)]}))]}))]}))};export{i as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import s from"../../../../common/cn.js";import{formatBytes as r}from"../../../../common/utils.js";import{useDocumentData as o}from"../../../../hooks/pickaxe/useDocumentData.js";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import n from"../../../Icons/file.svg.js";const i=({documentId:i})=>{const l=o({documentId:i}),{colors:m,styles:d,isRtl:u}=a(),x=c();return"success"!==l.status?e("div",{}):t("a",Object.assign({href:l.data.storageUrl?l.data.storageUrl:"#",target:"_blank",className:s("gap-x-[10px] w-full max-w-[500px] flex items-center px-2 h-[56px] border",u&&"flex-row-reverse"),style:{borderRadius:d.cornerRadius,borderColor:m.secondary+"50"},rel:"noreferrer"},{children:[e("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:m.accent,borderRadius:d.cornerRadius}},{children:e(n,{className:"w-5 h-5",style:{color:m.accentText}})})),t("div",Object.assign({className:s("flex flex-col justify-center truncate",u?"text-right":"text-left")},{children:[e("p",Object.assign({className:(s(x.b3),"font-medium truncate")},{children:l.data.name})),t("p",Object.assign({className:s(x.b4,"opacity-80 truncate")},{children:[l.data.extension&&l.data.extension.toUpperCase()+", ",r(l.data.size)]}))]}))]}))};export{i as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as i}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import r from"./Document.js";import l from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:p,isIntroExpand:x})=>{var h,u;const{formId:f,pickaxe:g,styles:v,colors:b,misc:j,responsiveBy:k,isNewChat:w}=o(),N=c(),y=null!==(h=null==g?void 0:g.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===p.role?e("div",Object.assign({className:m("flex flex-col",0===d&&w&&"viewport"===k&&"min-[767px]:max-w-[80%]",0===d&&w&&"container"===k&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:"flex gap-x-3"},{children:[j.isChatImage&&"NONE"!==y&&e(n,{src:y,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:b.text}),s("div",Object.assign({className:"flex flex-col"},{children:[e("div",Object.assign({className:m(N.b2,"chat-message pt-3")},{children:e(a,Object.assign({theme:v.theme,accentColor:b.accent,actions:!0},{children:e(i,Object.assign({value:p.content},0===d&&w&&p.content.length>470&&3===(null!==(u=null==g?void 0:g.icebreakers)&&void 0!==u?u:[]).length&&!p.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:x?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(l,{color:b.accent,text:p.content})}))]}))]}))})):"user"===p.role?e("div",Object.assign({className:m("flex gap-x-3 justify-self-end pl-9","viewport"===k?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:m(N.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:b.secondary+"80",color:b.secondaryText,borderRadius:v.cornerRadius}},{children:[p.documentIds&&p.documentIds.length>0&&e("div",Object.assign({className:"flex flex-col items-end"},{children:p.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:v.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(r,{documentId:s})},s)))})),e(a,Object.assign({theme:v.theme,accentColor:b.accent},{children:e(i,{value:p.content})}))]}))})):e("div",{})};export{d as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Fragment as s}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import r from"./Document.js";import l from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:x,isIntroExpand:p})=>{var h,u;const{formId:f,pickaxe:g,styles:j,colors:v,misc:b,responsiveBy:w,isNewChat:k,isRtl:y}=o(),N=i(),O=null!==(h=null==g?void 0:g.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===x.role?e("div",Object.assign({className:m("flex w-full",y?"justify-end":"justify-start")},{children:e("div",Object.assign({className:m("flex flex-col",0===d&&k&&"viewport"===w&&"min-[767px]:max-w-[80%]",0===d&&k&&"container"===w&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:t("div",Object.assign({className:m("flex gap-x-3",y&&"flex-row-reverse")},{children:[b.isChatImage&&"NONE"!==O&&e(n,{src:O,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:v.text}),t("div",Object.assign({className:m("flex flex-col",y?"items-end":"items-start")},{children:[e("div",Object.assign({className:m(N.b2,"chat-message pt-3",y?"text-right":"text-left")},{children:e(a,Object.assign({theme:j.theme,accentColor:v.accent,actions:!0},{children:e(c,Object.assign({value:x.content},0===d&&k&&x.content.length>470&&3===(null!==(u=null==g?void 0:g.icebreakers)&&void 0!==u?u:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:p?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(l,{color:v.accent,text:x.content})}))]}))]}))}))})):"user"===x.role?e("div",Object.assign({className:m("flex w-full",y?"justify-start":"justify-end")},{children:e("div",Object.assign({className:m("flex gap-x-3 max-w-[80%]",y?"pr-9":"pl-9","viewport"===w?y?"min-[767px]:pr-0":"min-[767px]:pl-0":y?"@[767px]/pickaxe-root:pr-0":"@[767px]/pickaxe-root:pl-0")},{children:t("div",Object.assign({className:m(N.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",y?"text-right":"text-left"),style:{backgroundColor:v.secondary+"80",color:v.secondaryText,borderRadius:j.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e("div",Object.assign({className:m("flex flex-col",y?"items-start":"items-end")},{children:x.documentIds.map((t=>e(s,{children:t.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:j.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${t.split("-")[2]}/${t.split("-")[1]}.${null==t?void 0:t.split("-")[2]}`,alt:""})})):e(r,{documentId:t})},t)))})),e(a,Object.assign({theme:j.theme,accentColor:v.accent},{children:e(c,{value:x.content})}))]}))}))})):e("div",{})};export{d as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as i}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as l}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as n}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as r}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../common/PickaxeIcon.js";import m from"../../../Core/ErrorAlert.js";import d from"../../../Core/Skeleton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import x from"../../common/PickaxeHead.js";import f from"../../common/PickaxeCompactHead.js";import u from"../../common/PickaxeUpgradeCard.js";import h from"./Message.js";import g from"../../common/PickaxeBranding.js";import j from"../../../../common/cn.js";const w=({hideInfo:w,isInputFocused:v})=>{var N;const b=r(),k=n(),{pickaxe:y,colors:C,misc:O,isNewChat:S,isEmbed:I,setChatId:P}=o(),{scrollContainerRef:L}=l(),{messages:E,status:A,limitData:H,error:$}=t(),{height:z}=i(),D=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!D),[w,b.isSuccess,S,D]),R=a((()=>{var e,s;return!!E.length&&!(null!==(s=null===(e=null==E?void 0:E[E.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[E]);return e("div",Object.assign({ref:L,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${z}px - 74px)`}},{children:s("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(F||!I)&&!O.isWhiteLabel&&e(g,{className:j("absolute top-4 right-4",!F&&!I&&"top-2"),animateHover:!0}),e(x,{className:j("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",F&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>P("")}),I&&!b.isLoading&&e(f,{className:j("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!F&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>P("")}),e("div",Object.assign({className:j("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",I&&!b.isLoading&&!F&&"mt-0")},{children:b.isLoading&&!(null==y?void 0:y.enablechatresponses)?s("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[S&&s("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e(d,{className:"w-[72px] h-[72px]"}),e(d,{className:"h-[20px] mt-6 w-full"}),e(d,{className:"h-[20px] mt-2 w-full"}),e(d,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(d,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(d,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(d,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):b.isError?e("div",Object.assign({className:"flex w-full justify-center"},{children:s("p",Object.assign({className:j(k.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):b.data?s("div",Object.assign({className:"flex flex-col w-full"},{children:[s("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[b.data.messages.map(((s,a)=>e(h,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),E.map(((s,a)=>e(h,{index:b.data.messages.length+a,message:s},a))),"fetching"===A||R?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==y?void 0:y.chaticon)&&e(c,{src:null!==(N=null==y?void 0:y.chaticon)&&void 0!==N?N:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e("div",{className:j("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:C.secondaryText}},a)))}))]})):H?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):$?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(m,{error:$})})):null]})),e(p,{className:"w-full"})]})):null}))]}))}))};export{w as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useMemo as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as i}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as l}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as n}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as r}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../common/PickaxeIcon.js";import m from"../../../Core/ErrorAlert.js";import d from"../../../Core/Skeleton.js";import p from"../../Addons/Scroll/ScrollLockView.js";import f from"../../common/PickaxeHead.js";import x from"../../common/PickaxeCompactHead.js";import u from"../../common/PickaxeUpgradeCard.js";import h from"./Message.js";import g from"../../common/PickaxeBranding.js";import j from"../../../../common/cn.js";const w=({hideInfo:w,isInputFocused:v})=>{var N;const b=r(),k=n(),{pickaxe:y,colors:C,misc:O,isNewChat:S,isRtl:I,isEmbed:P,setChatId:L}=o(),{scrollContainerRef:E}=l(),{messages:A,status:H,limitData:R,error:$}=t(),{height:z}=i(),D=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!D),[w,b.isSuccess,S,D]),B=a((()=>{var e,s;return!!A.length&&!(null!==(s=null===(e=null==A?void 0:A[A.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[A]);return e("div",Object.assign({ref:E,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${z}px - 74px)`}},{children:s("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(F||!P)&&!O.isWhiteLabel&&e(g,{className:j("absolute top-4 right-4",!F&&!P&&"top-2"),animateHover:!0}),e(f,{className:j("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",F&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>L("")}),P&&!b.isLoading&&e(x,{className:j("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!F&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>L("")}),e("div",Object.assign({className:j("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",P&&!b.isLoading&&!F&&"mt-0")},{children:b.isLoading&&!(null==y?void 0:y.enablechatresponses)?s("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[S&&s("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e(d,{className:"w-[72px] h-[72px]"}),e(d,{className:"h-[20px] mt-6 w-full"}),e(d,{className:"h-[20px] mt-2 w-full"}),e(d,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(d,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(d,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(d,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):b.isError?e("div",Object.assign({className:"flex w-full justify-center"},{children:s("p",Object.assign({className:j(k.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):b.data?s("div",Object.assign({className:"flex flex-col w-full"},{children:[s("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[b.data.messages.map(((s,a)=>e(h,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),A.map(((s,a)=>e(h,{index:b.data.messages.length+a,message:s},a))),"fetching"===H||B?s("div",Object.assign({className:j("flex max-w-[80%] items-center gap-x-3 ",I?"justify-end":"justify-start")},{children:["NONE"!==(null==y?void 0:y.chaticon)&&e(c,{src:null!==(N=null==y?void 0:y.chaticon)&&void 0!==N?N:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4"},{children:Array.from({length:3}).map(((s,a)=>e("div",{className:j("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:C.secondaryText}},a)))}))]})):R?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):$?e("div",Object.assign({className:j("flex items-center gap-x-3",I?"justify-end":"justify-start")},{children:e(m,{error:$})})):null]})),e(p,{className:"w-full"})]})):null}))]}))}))};export{w as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as n,useMemo as i,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as d}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{useDocument as h}from"../Addons/Document/hooks/useDocument.js";import{useScroll as g}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as b}from"../../../hooks/core/useHover.js";import{formatBytes as v}from"../../../common/utils.js";import{allowedFileMimeTypes as x,allowedImageMimeTypes as y}from"../../../common/documents.js";import{createParser as j}from"eventsource-parser";import k from"../../Icons/attach-vertical.svg.js";import w from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import I from"../../Icons/x.svg.js";import O from"../../Icons/arrow-right.svg.js";import C from"../Addons/IceBreaker/index.js";import S from"../../Core/Textarea.js";import R from"../../../common/error.js";import A from"../../../common/cn.js";const T=({isFocused:T,onFocus:U,onBlur:B})=>{var D;const{formId:F,chatId:E,userId:H,studioUserId:z,embedUserId:L,deploymentId:$,pickaxe:G,styles:J,colors:K,responsiveBy:P,isNewChat:W,setIsNewChat:_,setIsShowIceBreaker:M,onGenerateComplete:q}=c(),{messages:Q,status:V,limits:X,isGenerating:Y,setMessages:Z,setStatus:ee,setLimitData:te,setError:se}=d(),{documents:oe,isUploading:re,isImageUploadAllowed:ne,setDocuments:ie,onFileUpload:le}=h(),{scrollStartSession:ae,scrollEndSession:ce,scrollToBottom:de}=g({auto:!0}),ue=p(),me=f(),[pe,fe]=r(""),he=n(null),ge=b(),{isHover:be}=ge,ve=e(ge,["isHover"]),xe=b(),{isHover:ye}=xe,je=e(xe,["isHover"]),ke=m(),we=u(),Ne=i((()=>{var e,t,s;return!!W&&(!!G&&(!ue.isLoading&&(!((null!==(t=null===(e=ue.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=G.icebreakers)||void 0===s?void 0:s.length))))}),[G,W,ue.data,ue.isLoading]),Ie=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==V||re)return;const t=null!=e?e:pe;if(!t)return;se(""),te(null),fe(""),_(!1),ee("fetching"),ae(),de();const s=oe.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=s.length?s[s.length-1].documentId:"",r="enduserupload"===(null==G?void 0:G.documentuploadtype)&&o,n=[...Array.from(Q),Object.assign({id:Q.length+1,role:"user",content:t},r&&{documentIds:[o]})];Z(n),de(),r&&ie([]);const i=(yield me.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:E,value:t},r&&{documentId:o}),H&&{userId:H}),z&&{studioUserId:z}),L&&{embedUserId:L}),$&&{deploymentId:$}))).body;if(!i)throw new Error("Streaming error");const l=n.length,a=new TextDecoder,c=i.getReader();let d="",u=!0,m=!1;const p=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");d+=t,Z([...n.slice(0,l),{id:Q.length+1,role:"assistant",content:d}])}else if("error"===e.event){const t=JSON.parse(e.data);se(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:t}=yield c.read();if(t){u=!1;break}const s=a.decode(e);s&&(m||(ee("streaming"),m=!0),p.feed(s))}null==q||q(E)}catch(e){let t=R(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(X).find((([e])=>t.includes(e)));s?te(s[1]):se(t)}finally{de(),ee("idle"),ce()}}));return l((()=>{M(Ne)}),[Ne]),s("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[s("div",Object.assign({className:"absolute right-0 bottom-full"},{children:s("div",Object.assign({className:A("flex justify-end flex-col gap-2 pb-4 px-2","viewport"===P?"min-[767px]:items-end":"@[767px]/pickaxe-root:items-end")},{children:Ne&&!T&&s(C,{data:(null==G?void 0:G.icebreakers)||[],onSend:Ie})}))})),o("div",Object.assign({className:A("flex flex-col gap-y-2 px-4 py-3","block"===J.formFieldStyle&&"shadow"),style:we},{children:["idle"===V&&oe.length>0&&s("div",Object.assign({className:A("grid grid-cols-1","viewport"===P?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:oe.map((e=>{var t,r,n;return s(a,{children:"document"===e.type?o("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:we.borderRadius,borderColor:K.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:K.accent,borderRadius:we.borderRadius}},{children:re?s(w,{className:"w-5 h-5 animate-spin",style:{color:K.accentText}}):s(N,{className:"w-5 h-5",style:{color:K.accentText}})})),o("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s("p",Object.assign({className:(A(ke.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:A(ke.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:K.accent,borderColor:we.backgroundColor},disabled:re||"idle"!==V,onClick:()=>ie([])},{children:s(I,{className:"w-4 h-4",style:{color:K.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:we.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:we.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(n=e.documentId)||void 0===n?void 0:n.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:we.borderRadius,backgroundColor:K.secondary}}),s("button",Object.assign({type:"button",className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:K.accent,borderColor:we.backgroundColor},disabled:re||"idle"!==V,onClick:()=>ie([])},{children:s(I,{className:"w-4 h-4",style:{color:K.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:"flex items-end gap-x-2"},{children:[s(S,{className:A(ke.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!pe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:pe,placeholder:null!==(D=null==G?void 0:G.placeholdertext)&&void 0!==D?D:"What do you want to talk about?",onChange:e=>fe(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),re||"idle"!==V||Ie()))},onFocus:U,onBlur:B}),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==G?void 0:G.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:ye?K.accent+"10":void 0},disabled:re||"idle"!==V,onClick:()=>{var e;return null===(e=he.current)||void 0===e?void 0:e.click()}},je,{children:[s("input",{id:"file-upload",ref:he,type:"file",accept:[...x,...ne?y:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield le(Array.from(e.target.files||[])),e.target.value=""}))}),s(k,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:ye?K.accent:K.accent+"80"}})]})),s("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(be||pe.length||oe.length&&oe.every((e=>"finished"===e.status)))&&!Y?K.accent:K.accent+"10"},disabled:re||"idle"!==V,onClick:()=>Ie()},ve,{children:s(O,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(be||pe.length||oe.length&&oe.every((e=>"finished"===e.status)))&&!Y?K.accentText:K.accent+"80"}})}))]}))]}))]}))]}))}))};export{T as default};
1
+ import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as d}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{useDocument as h}from"../Addons/Document/hooks/useDocument.js";import{useScroll as g}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as b}from"../../../hooks/core/useHover.js";import{formatBytes as v}from"../../../common/utils.js";import{allowedFileMimeTypes as x,allowedImageMimeTypes as y}from"../../../common/documents.js";import{createParser as j}from"eventsource-parser";import k from"../../Icons/attach-vertical.svg.js";import w from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import I from"../../Icons/x.svg.js";import O from"../../Icons/arrow-right.svg.js";import C from"../Addons/IceBreaker/index.js";import S from"../../Core/Textarea.js";import R from"../../../common/error.js";import A from"../../../common/cn.js";const T=({isFocused:T,onFocus:U,onBlur:B})=>{var D;const{formId:F,isRtl:E,chatId:H,userId:z,studioUserId:L,embedUserId:$,deploymentId:G,pickaxe:J,styles:K,colors:P,responsiveBy:W,isNewChat:_,setIsNewChat:M,setIsShowIceBreaker:q,onGenerateComplete:Q}=c(),{messages:V,status:X,limits:Y,isGenerating:Z,setMessages:ee,setStatus:te,setLimitData:se,setError:oe}=d(),{documents:re,isUploading:ie,isImageUploadAllowed:ne,setDocuments:le,onFileUpload:ae}=h(),{scrollStartSession:ce,scrollEndSession:de,scrollToBottom:ue}=g({auto:!0}),me=p(),pe=f(),[fe,he]=r(""),ge=i(null),be=b(),{isHover:ve}=be,xe=e(be,["isHover"]),ye=b(),{isHover:je}=ye,ke=e(ye,["isHover"]),we=m(),Ne=u(),Ie=n((()=>{var e,t,s;return!!_&&(!!J&&(!me.isLoading&&(!((null!==(t=null===(e=me.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=J.icebreakers)||void 0===s?void 0:s.length))))}),[J,_,me.data,me.isLoading]),Oe=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==X||ie)return;const t=null!=e?e:fe;if(!t)return;oe(""),se(null),he(""),M(!1),te("fetching"),ce(),ue();const s=re.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=s.length?s[s.length-1].documentId:"",r="enduserupload"===(null==J?void 0:J.documentuploadtype)&&o,i=[...Array.from(V),Object.assign({id:V.length+1,role:"user",content:t},r&&{documentIds:[o]})];ee(i),ue(),r&&le([]);const n=(yield pe.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,value:t},r&&{documentId:o}),z&&{userId:z}),L&&{studioUserId:L}),$&&{embedUserId:$}),G&&{deploymentId:G}))).body;if(!n)throw new Error("Streaming error");const l=i.length,a=new TextDecoder,c=n.getReader();let d="",u=!0,m=!1;const p=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");d+=t,ee([...i.slice(0,l),{id:V.length+1,role:"assistant",content:d}])}else if("error"===e.event){const t=JSON.parse(e.data);oe(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:t}=yield c.read();if(t){u=!1;break}const s=a.decode(e);s&&(m||(te("streaming"),m=!0),p.feed(s))}null==Q||Q(H)}catch(e){let t=R(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(Y).find((([e])=>t.includes(e)));s?se(s[1]):oe(t)}finally{ue(),te("idle"),de()}}));return l((()=>{q(Ie)}),[Ie]),s("div",Object.assign({className:"px-4 pb-4 w-full flex flex-col items-center absolute bottom-0 left-0 z-1",dir:E?"rtl":"ltr"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[s("div",Object.assign({className:A("absolute bottom-full",E?"left-0":"right-0")},{children:s("div",Object.assign({className:A("flex flex-col gap-2 pb-4 px-2",E?"justify-start":"justify-end","viewport"===W?E?"min-[767px]:items-start":"min-[767px]:items-end":E?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:Ie&&!T&&s(C,{data:(null==J?void 0:J.icebreakers)||[],onSend:Oe})}))})),o("div",Object.assign({className:A("flex flex-col gap-y-2 px-4 py-3","block"===K.formFieldStyle&&"shadow"),style:Ne},{children:["idle"===X&&re.length>0&&s("div",Object.assign({className:A("grid grid-cols-1","viewport"===W?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:re.map((e=>{var t,r,i;return s(a,{children:"document"===e.type?o("div",Object.assign({className:A("relative gap-x-[10px] flex items-center px-2 h-[56px] border",E&&"flex-row-reverse"),style:{borderRadius:Ne.borderRadius,borderColor:P.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:P.accent,borderRadius:Ne.borderRadius}},{children:ie?s(w,{className:"w-5 h-5 animate-spin",style:{color:P.accentText}}):s(N,{className:"w-5 h-5",style:{color:P.accentText}})})),o("div",Object.assign({className:A("flex flex-col justify-center truncate",E?"text-right items-end":"text-left items-start")},{children:[s("p",Object.assign({className:(A(we.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:A(we.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:A("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",E?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:P.accent,borderColor:Ne.backgroundColor},disabled:ie||"idle"!==X,onClick:()=>le([])},{children:s(I,{className:"w-4 h-4",style:{color:P.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Ne.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:Ne.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:Ne.borderRadius,backgroundColor:P.secondary}}),s("button",Object.assign({type:"button",className:A("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",E?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:P.accent,borderColor:Ne.backgroundColor},disabled:ie||"idle"!==X,onClick:()=>le([])},{children:s(I,{className:"w-4 h-4",style:{color:P.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:A("flex items-end gap-x-2",E&&"flex-row-reverse")},{children:[s(S,{className:A(we.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!fe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",E?"text-right":"text-left"),value:fe,placeholder:E?"بماذا تريد أن تتحدث؟":null!==(D=null==J?void 0:J.placeholdertext)&&void 0!==D?D:"What do you want to talk about?",onChange:e=>he(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ie||"idle"!==X||Oe()))},onFocus:U,onBlur:B,dir:E?"rtl":"ltr"}),o("div",Object.assign({className:A("flex items-center gap-x-2")},{children:["enduserupload"===(null==J?void 0:J.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:je?P.accent+"10":void 0},disabled:ie||"idle"!==X,onClick:()=>{var e;return null===(e=ge.current)||void 0===e?void 0:e.click()}},ke,{children:[s("input",{id:"file-upload",ref:ge,type:"file",accept:[...x,...ne?y:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield ae(Array.from(e.target.files||[])),e.target.value=""}))}),s(k,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:je?P.accent:P.accent+"80"}})]})),s("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(ve||fe.length||re.length&&re.every((e=>"finished"===e.status)))&&!Z?P.accent:P.accent+"10"},disabled:ie||"idle"!==X,onClick:()=>Oe()},xe,{children:s(O,{className:A("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",E&&"transform scale-x-[-1]"),style:{color:(ve||fe.length||re.length&&re.every((e=>"finished"===e.status)))&&!Z?P.accentText:P.accent+"80"}})}))]}))]}))]}))]}))}))};export{T as default};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{createContext as s,useState as i,useEffect as o}from"react";import t from"./Addons/Document/Provider.js";import r from"./ResponseProvider.js";import n from"./DimensionProvider.js";const d=s({}),a=({children:s,userId:a="",studioUserId:c="",deploymentId:l="",embedUserId:m="",styles:p,colors:h,limits:F={},misc:b={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:I,responsiveBy:y="viewport",isEmbed:u=!1,forceMobile:f=!1,loadFont:g=!0,onGenerateComplete:w})=>{const[P,j]=i(""),[v,x]=i(""),[S,k]=i(null),[C,O]=i(!1),[D,H]=i(!0),[U,B]=i(!0),[L,T]=i(!1);return o((()=>{O(!1)}),[null==p?void 0:p.font]),e(d.Provider,Object.assign({value:Object.assign({formId:P,chatId:v,userId:a,studioUserId:c,deploymentId:l,embedUserId:m,pickaxe:S,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},p),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},h),misc:b,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},I),responsiveBy:y,isFontLoaded:C,isNewChat:D,isShowIceBreaker:U,isShowHistory:L,loadFont:g,forceMobile:f,isEmbed:u,setIsFontLoaded:O,setFormId:j,setChatId:x,setPickaxe:k,setIsNewChat:H,setIsShowIceBreaker:B,setIsShowHistory:T},w&&{onGenerateComplete:w})},{children:e(r,Object.assign({limits:F},{children:e(n,{children:e(t,{children:s})})}))}))};export{d as PickaxeContext,a as PickaxeProvider};
1
+ import{jsx as e}from"react/jsx-runtime";import{createContext as s,useState as i,useEffect as o}from"react";import t from"./Addons/Document/Provider.js";import r from"./ResponseProvider.js";import n from"./DimensionProvider.js";const d=s({}),a=({children:s,isRtl:a=!1,userId:l="",studioUserId:c="",deploymentId:m="",embedUserId:p="",styles:h,colors:F,limits:b={},misc:I={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:y,responsiveBy:u="viewport",isEmbed:f=!1,forceMobile:g=!1,loadFont:w=!0,onGenerateComplete:P})=>{const[j,v]=i(""),[x,S]=i(""),[k,C]=i(null),[O,D]=i(!1),[H,R]=i(!0),[U,B]=i(!0),[L,T]=i(!1);return o((()=>{D(!1)}),[null==h?void 0:h.font]),e(d.Provider,Object.assign({value:Object.assign({formId:j,isRtl:a,chatId:x,userId:l,studioUserId:c,deploymentId:m,embedUserId:p,pickaxe:k,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},h),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},F),misc:I,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},y),responsiveBy:u,isFontLoaded:O,isNewChat:H,isShowIceBreaker:U,isShowHistory:L,loadFont:w,forceMobile:g,isEmbed:f,setIsFontLoaded:D,setFormId:v,setChatId:S,setPickaxe:C,setIsNewChat:R,setIsShowIceBreaker:B,setIsShowHistory:T},P&&{onGenerateComplete:P})},{children:e(r,Object.assign({limits:b},{children:e(n,{children:e(t,{children:s})})}))}))};export{d as PickaxeContext,a as PickaxeProvider};
@@ -35,6 +35,7 @@ export type PickaxeMisc = {
35
35
  };
36
36
  type PickaxeContextType = {
37
37
  formId: string;
38
+ isRtl?: boolean;
38
39
  chatId: string;
39
40
  userId: string;
40
41
  studioUserId: string;
@@ -64,6 +65,7 @@ type PickaxeContextType = {
64
65
  };
65
66
  export interface IPickaxeProviderProps {
66
67
  children: ReactNode;
68
+ isRtl?: boolean;
67
69
  userId?: string;
68
70
  studioUserId?: string;
69
71
  deploymentId?: string;
@@ -80,5 +82,5 @@ export interface IPickaxeProviderProps {
80
82
  onGenerateComplete?: (responseId: string) => void;
81
83
  }
82
84
  export declare const PickaxeContext: import("react").Context<PickaxeContextType>;
83
- export declare const PickaxeProvider: ({ children, userId, studioUserId, deploymentId, embedUserId, styles, colors, limits, misc, translations, responsiveBy, isEmbed, forceMobile, loadFont, onGenerateComplete, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
85
+ export declare const PickaxeProvider: ({ children, isRtl, userId, studioUserId, deploymentId, embedUserId, styles, colors, limits, misc, translations, responsiveBy, isEmbed, forceMobile, loadFont, onGenerateComplete, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
84
86
  export {};
@@ -1,5 +1,6 @@
1
1
  export interface PickaxeProps {
2
2
  formId: string;
3
+ isRtl?: boolean;
3
4
  className?: string;
4
5
  }
5
6
  export declare const Pickaxe: ({ formId: _formId, className }: PickaxeProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,5 +1,6 @@
1
1
  export declare const usePickaxeContext: () => {
2
2
  formId: string;
3
+ isRtl?: boolean | undefined;
3
4
  chatId: string;
4
5
  userId: string;
5
6
  studioUserId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "2.1.9",
3
+ "version": "2.1.11",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",