@pickaxeproject/react 2.7.1 → 2.7.3

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.
Files changed (57) hide show
  1. package/dist/cjs/components/Core/Menu/Button.js +1 -1
  2. package/dist/cjs/components/EmbedPreview/ChatInput.js +1 -1
  3. package/dist/cjs/components/EmbedPreview/FAB.js +1 -1
  4. package/dist/cjs/components/EmbedPreview/Inline.js +1 -1
  5. package/dist/cjs/components/EmbedPreview/Popup.js +1 -1
  6. package/dist/cjs/components/Pickaxe/Chat/History/index.js +1 -1
  7. package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
  8. package/dist/cjs/components/Pickaxe/Chat/index.js +1 -1
  9. package/dist/cjs/components/Pickaxe/Form/History/Response.js +1 -1
  10. package/dist/cjs/components/Pickaxe/Form/Questions/Document.js +1 -1
  11. package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
  12. package/dist/cjs/components/Pickaxe/Form/index.js +1 -1
  13. package/dist/cjs/components/Pickaxe/common/PickaxeCompactHead.js +1 -1
  14. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.js +1 -1
  15. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Code/index.js +1 -1
  16. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.js +1 -1
  17. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/common/IframeVideo.js +1 -0
  18. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  19. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.js +1 -1
  20. package/dist/cjs/components/Pickaxe/common/PickaxeSkeleton.js +1 -0
  21. package/dist/cjs/components/Pickaxe/index.js +1 -1
  22. package/dist/cjs/src/components/Pickaxe/common/PickaxeCompactHead.d.ts +1 -1
  23. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Components/common/IframeVideo.d.ts +7 -0
  24. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.d.ts +1 -0
  25. package/dist/cjs/src/components/Pickaxe/common/PickaxeSkeleton.d.ts +9 -0
  26. package/dist/esm/components/Core/Menu/Button.js +1 -1
  27. package/dist/esm/components/EmbedPreview/ChatInput.js +1 -1
  28. package/dist/esm/components/EmbedPreview/FAB.js +1 -1
  29. package/dist/esm/components/EmbedPreview/Inline.js +1 -1
  30. package/dist/esm/components/EmbedPreview/Popup.js +1 -1
  31. package/dist/esm/components/Pickaxe/Chat/History/index.js +1 -1
  32. package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
  33. package/dist/esm/components/Pickaxe/Chat/index.js +1 -1
  34. package/dist/esm/components/Pickaxe/Form/History/Response.js +1 -1
  35. package/dist/esm/components/Pickaxe/Form/Questions/Document.js +1 -1
  36. package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
  37. package/dist/esm/components/Pickaxe/Form/index.js +1 -1
  38. package/dist/esm/components/Pickaxe/common/PickaxeCompactHead.js +1 -1
  39. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.js +1 -1
  40. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Code/index.js +1 -1
  41. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.js +1 -1
  42. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/common/IframeVideo.js +1 -0
  43. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  44. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.js +1 -1
  45. package/dist/esm/components/Pickaxe/common/PickaxeSkeleton.js +1 -0
  46. package/dist/esm/components/Pickaxe/index.js +1 -1
  47. package/dist/esm/src/components/Pickaxe/common/PickaxeCompactHead.d.ts +1 -1
  48. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Components/common/IframeVideo.d.ts +7 -0
  49. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/utils/custom-plugins.d.ts +1 -0
  50. package/dist/esm/src/components/Pickaxe/common/PickaxeSkeleton.d.ts +9 -0
  51. package/package.json +1 -1
  52. package/dist/cjs/components/Core/Skeleton.js +0 -1
  53. package/dist/cjs/src/components/Core/ScrollArea.d.ts +0 -12
  54. package/dist/cjs/src/components/Core/Skeleton.d.ts +0 -9
  55. package/dist/esm/components/Core/Skeleton.js +0 -1
  56. package/dist/esm/src/components/Core/ScrollArea.d.ts +0 -12
  57. package/dist/esm/src/components/Core/Skeleton.d.ts +0 -9
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),s=require("./index.js"),r=require("../../Icons/chevron-down.svg.js"),n=require("../../../common/cn.js");const o=i.forwardRef(((o,a)=>{var{children:l,variant:c="default",isDisabled:d=!1,style:u,className:v,anchorClassName:f}=o,p=e.__rest(o,["children","variant","isDisabled","style","className","anchorClassName"]);const{id:m,isOpen:j,setIsOpen:x}=i.useContext(s.MenuContext);return"anchor"===c?t.jsxs("div",Object.assign({ref:a,id:m},p,{className:n.default("flex cursor-pointer items-center gap-2",v),style:Object.assign({cursor:d?"not-allowed":"pointer",pointerEvents:d?"none":"auto"},u),onClick:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t.stopPropagation(),t.preventDefault(),!d){if(p.onClick)return p.onClick(t),void x(!j);x(!j),yield new Promise((e=>setTimeout(e,100)))}}))},{children:[l,t.jsx(r.default,{className:n.default("duration:300 h-5 w-5 shrink-0 rotate-0 transition-rotate",j&&"rotate-180",f)})]})):t.jsx("div",Object.assign({ref:a,id:m},p,{className:n.default("flex items-center",v),style:Object.assign({cursor:d?"not-allowed":"pointer",pointerEvents:d?"none":"auto"},u),onClick:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t.stopPropagation(),t.preventDefault(),d||(p.onClick?p.onClick(t):(x(!j),yield new Promise((e=>setTimeout(e,100)))))}))},{children:l}))}));o.displayName="MenuButton",exports.default=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),s=require("./index.js"),r=require("../../Icons/chevron-down.svg.js"),n=require("../../../common/cn.js");const o=i.forwardRef(((o,a)=>{var{children:l,variant:c="default",isDisabled:d=!1,style:u,className:v,anchorClassName:f}=o,p=e.__rest(o,["children","variant","isDisabled","style","className","anchorClassName"]);const{id:m,isOpen:j,setIsOpen:x}=i.useContext(s.MenuContext);return"anchor"===c?t.jsxs("div",Object.assign({ref:a,id:m},p,{className:n.default("flex cursor-pointer items-center gap-2",v),style:Object.assign({cursor:d?"not-allowed":"pointer",pointerEvents:d?"none":"auto"},u),onClick:t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(t.stopPropagation(),t.preventDefault(),!d){if(p.onClick)return p.onClick(t),void x(!j);x(!j),yield new Promise((e=>setTimeout(e,100)))}}))},{children:[l,t.jsx(r.default,{className:n.default("duration-300 h-5 w-5 shrink-0 rotate-0 transition-rotate",j&&"rotate-180",f)})]})):t.jsx("div",Object.assign({ref:a,id:m},p,{className:n.default("flex items-center",v),style:Object.assign({cursor:d?"not-allowed":"pointer",pointerEvents:d?"none":"auto"},u),onClick:t=>e.__awaiter(void 0,void 0,void 0,(function*(){t.stopPropagation(),t.preventDefault(),d||(p.onClick?p.onClick(t):(x(!j),yield new Promise((e=>setTimeout(e,100)))))}))},{children:l}))}));o.displayName="MenuButton",exports.default=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../hooks/pickaxe/usePickaxeContext.js"),r=require("@tanstack/react-query"),s=require("../Pickaxe/index.js"),n=require("../Pickaxe/Provider.js"),a=require("../../common/cn.js");const l=new r.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),o=({children:e})=>{var r;const{styles:s,deploymentDimensions:n,isNewChat:l,isDropShadow:o}=t.usePickaxeContext();return i.jsx("div",Object.assign({className:a.default("relative top-0 flex w-full flex-col transition-all",o&&"shadow-embed",!l&&"overflow-y-auto overflow-x-hidden scrollbar scrollbar-thin"),style:Object.assign(Object.assign({borderRadius:null!==(r=null==s?void 0:s.cornerRadius)&&void 0!==r?r:0},"px"===(null==n?void 0:n.width.unit)?{width:n.width.value+n.width.unit}:"%"===(null==n?void 0:n.width.unit)?{width:"100%",maxWidth:n.maxWidth+"px"}:{}),l?{height:58}:"px"===(null==n?void 0:n.height.unit)?{height:n.height.value+"px"}:"auto"===(null==n?void 0:n.height.unit)?{minHeight:n.minHeight+"px",maxHeight:n.maxHeight+"px"}:{})},{children:e}))};exports.ChatInput=t=>{var{formId:a,className:u}=t,d=e.__rest(t,["formId","className"]);return i.jsx(r.QueryClientProvider,Object.assign({client:l},{children:i.jsx(n.PickaxeProvider,Object.assign({},d,{deploymentType:"chat-input",isEmbed:!0},{children:i.jsx(o,{children:i.jsx(s.Pickaxe,Object.assign({formId:a},u&&{className:u}))})}))}))},exports.ChatInputWrapper=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../hooks/pickaxe/usePickaxeContext.js"),r=require("@tanstack/react-query"),s=require("../Pickaxe/index.js"),n=require("../Pickaxe/Provider.js"),a=require("../../common/cn.js");const l=new r.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),o=({children:e})=>{var r;const{styles:s,deploymentDimensions:n,isNewChat:l,isDropShadow:o}=t.usePickaxeContext();return i.jsx("div",Object.assign({className:a.default("relative top-0 flex w-full flex-col transition-all",o&&"shadow-embed",!l&&"overflow-y-auto overflow-x-hidden"),style:Object.assign(Object.assign({borderRadius:null!==(r=null==s?void 0:s.cornerRadius)&&void 0!==r?r:0},"px"===(null==n?void 0:n.width.unit)?{width:n.width.value+n.width.unit}:"%"===(null==n?void 0:n.width.unit)?{width:"100%",maxWidth:n.maxWidth+"px"}:{}),l?{height:58}:"px"===(null==n?void 0:n.height.unit)?{height:n.height.value+"px"}:"auto"===(null==n?void 0:n.height.unit)?{minHeight:n.minHeight+"px",maxHeight:n.maxHeight+"px"}:{})},{children:e}))};exports.ChatInput=t=>{var{formId:a,className:u}=t,d=e.__rest(t,["formId","className"]);return i.jsx(r.QueryClientProvider,Object.assign({client:l},{children:i.jsx(n.PickaxeProvider,Object.assign({},d,{deploymentType:"chat-input",isEmbed:!0},{children:i.jsx(o,{children:i.jsx(s.Pickaxe,Object.assign({formId:a},u&&{className:u}))})}))}))},exports.ChatInputWrapper=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("react"),s=require("../../hooks/pickaxe/usePickaxeContext.js"),n=require("@tanstack/react-query"),a=require("../Pickaxe/index.js"),r=require("../Pickaxe/Provider.js"),o=require("framer-motion"),c=require("../Icons/pickaxe.svg.js"),l=require("../Icons/spark.svg.js"),d=require("../Icons/x.svg.js"),u=require("../../common/cn.js");const h=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),m=({isOpen:n,setIsOpen:a})=>{const{colors:r,deploymentMisc:o}=s.usePickaxeContext(),[u,h]=t.useState({src:"",isLarge:!1}),[m,g]=t.useState(!0);return t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){try{if(!(null==o?void 0:o.fabImage))return;g(!0);const e=new Image;e.src=o.fabImage,yield e.decode();const i=e.width>200;h({src:o.fabImage,isLarge:i})}catch(e){console.error("[pxe] error loading FAB image:",e),h({src:"",isLarge:!1})}finally{g(!1)}}))}),[null==o?void 0:o.fabImage]),m?null:i.jsx("button",Object.assign({className:"absolute z-50 flex h-[60px] w-[60px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-white dark:bg-black",style:{boxShadow:"0px 6px 6px rgba(0, 0, 0, 0.12)",background:r.primary,color:r.text,bottom:20,right:20},onClick:()=>a(!n)},{children:n?i.jsx(x,Object.assign({id:"close-btn"},{children:i.jsx(d.default,{className:"shrink-0 select-none",style:{width:28,height:28}})})):i.jsx(x,Object.assign({id:"open-btn"},{children:u.src===`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}/builder/assets/images/pickaxe-chaticons/chaticon2.png`?i.jsx(l.default,{className:"h-6 w-6 shrink-0 select-none"}):u.src?i.jsx("img",{src:u.src,alt:"FAB Icon",width:u.isLarge?60:24,height:u.isLarge?60:24,className:"select-none"}):i.jsx(c.default,{className:"h-6 w-6 shrink-0 select-none"})}))}))},x=({id:e,children:t})=>i.jsx(o.motion.div,Object.assign({initial:{opacity:0,rotate:-10},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:10},transition:{duration:.3}},{children:t}),e);exports.FAB=s=>{var c,l,d,x,{formId:g,className:b}=s,p=e.__rest(s,["formId","className"]);const[v,f]=t.useState(!1),[j,w]=t.useState({}),y=()=>{const e=p.deploymentDimensions;if(!e)return;const i={value:e.width.value,unit:e.width.unit},t=e.maxWidth,s={value:e.height.value,unit:e.height.unit},n=e.minHeight,a=e.maxHeight,r=window.innerHeight-150,o=window.innerWidth-40;let c=0;c="px"===s.unit?s.value:a;let l=Math.min(c,r);l=Math.max(l,n,100),l=Math.min(l,r);let d=0;d="px"===i.unit?i.value:t;let u=Math.min(d,o,t);u=Math.max(u,150),u=Math.min(u,o);w({width:"%"===i.unit?i.value+"%":u+"px",minWidth:150,maxWidth:u,height:"auto"===s.unit?s.value:l+"px",minHeight:100,maxHeight:l})};return t.useEffect((()=>(y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y))),[p.deploymentDimensions]),i.jsx(n.QueryClientProvider,Object.assign({client:h},{children:i.jsx(r.PickaxeProvider,Object.assign({},p,{deploymentType:"fab",isEmbed:!0},{children:i.jsxs(o.AnimatePresence,{children:[v&&i.jsx(o.motion.div,Object.assign({initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.1},className:u.default("transition-h absolute z-50 flex flex-col overflow-hidden bg-transparent",p.isDropShadow&&"shadow-embed"),style:Object.assign({transformOrigin:"bottom right",borderRadius:null!==(l=null===(c=p.styles)||void 0===c?void 0:c.cornerRadius)&&void 0!==l?l:0,bottom:100,right:20},j)},{children:i.jsx("div",Object.assign({className:"flex flex-col overflow-auto h-full scrollbar scrollbar-thin dark:bg-black",style:{borderRadius:null!==(x=null===(d=p.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==x?x:0}},{children:i.jsx(a.Pickaxe,Object.assign({formId:g},b&&{className:b}))}))}),"fab-content"),i.jsx(m,{isOpen:v,setIsOpen:f})]})}))}))},exports.FABButton=m;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("react"),s=require("../../hooks/pickaxe/usePickaxeContext.js"),n=require("@tanstack/react-query"),a=require("../Pickaxe/index.js"),r=require("../Pickaxe/Provider.js"),o=require("framer-motion"),c=require("../Icons/pickaxe.svg.js"),l=require("../Icons/spark.svg.js"),d=require("../Icons/x.svg.js"),u=require("../../common/cn.js");const h=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),m=({isOpen:n,setIsOpen:a})=>{const{colors:r,deploymentMisc:o}=s.usePickaxeContext(),[u,h]=t.useState({src:"",isLarge:!1}),[m,g]=t.useState(!0);return t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){try{if(!(null==o?void 0:o.fabImage))return;g(!0);const e=new Image;e.src=o.fabImage,yield e.decode();const i=e.width>200;h({src:o.fabImage,isLarge:i})}catch(e){console.error("[pxe] error loading FAB image:",e),h({src:"",isLarge:!1})}finally{g(!1)}}))}),[null==o?void 0:o.fabImage]),m?null:i.jsx("button",Object.assign({className:"absolute z-50 flex h-[60px] w-[60px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-white dark:bg-black",style:{boxShadow:"0px 6px 6px rgba(0, 0, 0, 0.12)",background:r.primary,color:r.text,bottom:20,right:20},onClick:()=>a(!n)},{children:n?i.jsx(x,Object.assign({id:"close-btn"},{children:i.jsx(d.default,{className:"w-[28px] h-[28px] shrink-0 select-none"})})):i.jsx(x,Object.assign({id:"open-btn"},{children:u.src===`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}/builder/assets/images/pickaxe-chaticons/chaticon2.png`?i.jsx(l.default,{className:"h-6 w-6 shrink-0 select-none"}):u.src?i.jsx("img",{src:u.src,alt:"FAB Icon",width:u.isLarge?60:24,height:u.isLarge?60:24,className:"select-none"}):i.jsx(c.default,{className:"h-6 w-6 shrink-0 select-none"})}))}))},x=({id:e,children:t})=>i.jsx(o.motion.div,Object.assign({initial:{opacity:0,rotate:-10},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:10},transition:{duration:.3}},{children:t}),e);exports.FAB=s=>{var c,l,d,x,{formId:g,className:p}=s,v=e.__rest(s,["formId","className"]);const[b,f]=t.useState(!1),[j,w]=t.useState({}),y=()=>{const e=v.deploymentDimensions;if(!e)return;const i={value:e.width.value,unit:e.width.unit},t=e.maxWidth,s={value:e.height.value,unit:e.height.unit},n=e.minHeight,a=e.maxHeight,r=window.innerHeight-150,o=window.innerWidth-40;let c=0;c="px"===s.unit?s.value:a;let l=Math.min(c,r);l=Math.max(l,n,100),l=Math.min(l,r);let d=0;d="px"===i.unit?i.value:t;let u=Math.min(d,o,t);u=Math.max(u,150),u=Math.min(u,o);w({width:"%"===i.unit?i.value+"%":u+"px",minWidth:150,maxWidth:u,height:"auto"===s.unit?s.value:l+"px",minHeight:100,maxHeight:l})};return t.useEffect((()=>(y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y))),[v.deploymentDimensions]),i.jsx(n.QueryClientProvider,Object.assign({client:h},{children:i.jsx(r.PickaxeProvider,Object.assign({},v,{deploymentType:"fab",isEmbed:!0},{children:i.jsxs(o.AnimatePresence,{children:[b&&i.jsx(o.motion.div,Object.assign({initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.1},className:u.default("transition-h absolute z-50 flex flex-col overflow-hidden bg-transparent",v.isDropShadow&&"shadow-embed"),style:Object.assign({transformOrigin:"bottom right",borderRadius:null!==(l=null===(c=v.styles)||void 0===c?void 0:c.cornerRadius)&&void 0!==l?l:0,bottom:100,right:20},j)},{children:i.jsx("div",Object.assign({className:"flex flex-col overflow-auto h-full",style:{borderRadius:null!==(x=null===(d=v.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==x?x:0}},{children:i.jsx(a.Pickaxe,Object.assign({formId:g},p&&{className:p}))}))}),"fab-content"),i.jsx(m,{isOpen:b,setIsOpen:f})]})}))}))},exports.FABButton=m;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),n=require("@tanstack/react-query"),s=require("../Pickaxe/index.js"),t=require("../Pickaxe/Provider.js"),o=require("../../common/cn.js");const l=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});exports.Inline=r=>{var d,a,m,u,c,h,{formId:x,className:p}=r,v=e.__rest(r,["formId","className"]);return i.jsx(n.QueryClientProvider,Object.assign({client:l},{children:i.jsx(t.PickaxeProvider,Object.assign({},v,{deploymentType:"inline",isEmbed:!0},{children:i.jsx("div",Object.assign({className:o.default("relative top-0 flex w-full flex-col overflow-y-auto overflow-x-hidden transition-all scrollbar scrollbar-thin",v.isDropShadow&&"shadow-embed"),style:Object.assign(Object.assign({borderRadius:null!==(a=null===(d=v.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==a?a:0},"px"===(null===(m=v.deploymentDimensions)||void 0===m?void 0:m.width.unit)?{width:v.deploymentDimensions.width.value+v.deploymentDimensions.width.unit}:"%"===(null===(u=v.deploymentDimensions)||void 0===u?void 0:u.width.unit)?{width:"100%",maxWidth:v.deploymentDimensions.maxWidth+"px"}:{}),"px"===(null===(c=v.deploymentDimensions)||void 0===c?void 0:c.height.unit)?{height:v.deploymentDimensions.height.value+"px"}:"auto"===(null===(h=v.deploymentDimensions)||void 0===h?void 0:h.height.unit)?{minHeight:v.deploymentDimensions.minHeight+"px",maxHeight:v.deploymentDimensions.maxHeight+"px"}:{})},{children:i.jsx(s.Pickaxe,Object.assign({formId:x},p&&{className:p}))}))}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),n=require("@tanstack/react-query"),s=require("../Pickaxe/index.js"),t=require("../Pickaxe/Provider.js"),o=require("../../common/cn.js");const d=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});exports.Inline=l=>{var r,a,m,u,c,h,{formId:x,className:p}=l,v=e.__rest(l,["formId","className"]);return i.jsx(n.QueryClientProvider,Object.assign({client:d},{children:i.jsx(t.PickaxeProvider,Object.assign({},v,{deploymentType:"inline",isEmbed:!0},{children:i.jsx("div",Object.assign({className:o.default("relative top-0 flex w-full flex-col overflow-y-auto overflow-x-hidden transition-all",v.isDropShadow&&"shadow-embed"),style:Object.assign(Object.assign({borderRadius:null!==(a=null===(r=v.styles)||void 0===r?void 0:r.cornerRadius)&&void 0!==a?a:0},"px"===(null===(m=v.deploymentDimensions)||void 0===m?void 0:m.width.unit)?{width:v.deploymentDimensions.width.value+v.deploymentDimensions.width.unit}:"%"===(null===(u=v.deploymentDimensions)||void 0===u?void 0:u.width.unit)?{width:"100%",maxWidth:v.deploymentDimensions.maxWidth+"px"}:{}),"px"===(null===(c=v.deploymentDimensions)||void 0===c?void 0:c.height.unit)?{height:v.deploymentDimensions.height.value+"px"}:"auto"===(null===(h=v.deploymentDimensions)||void 0===h?void 0:h.height.unit)?{minHeight:v.deploymentDimensions.minHeight+"px",maxHeight:v.deploymentDimensions.maxHeight+"px"}:{})},{children:i.jsx(s.Pickaxe,Object.assign({formId:x},p&&{className:p}))}))}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),o=require("react"),s=require("../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../hooks/pickaxe/usePickaxe.js"),n=require("../../hooks/studio/useStyleFontSize.js"),l=require("@tanstack/react-query"),a=require("../Pickaxe/index.js"),r=require("../Pickaxe/Provider.js"),d=require("../Icons/x.svg.js"),u=require("../Core/Modal/index.js"),c=require("../Core/Modal/Body.js"),m=require("../../common/cn.js");const p=new l.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),x=({formId:e,setIsOpen:o})=>{var l;const{colors:a,styles:r,deploymentDimensions:d,deploymentMisc:u}=s.usePickaxeContext(),c=n.useStyleFontSize(),p=t.useInstantPickaxe(e);return p.isLoading?null:i.jsx("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==r.font&&{fontFamily:r.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:r.cornerRadius+"px",borderWidth:r.outlineThickness+"px",maxWidth:"%"===(null==d?void 0:d.width.unit)?(null==d?void 0:d.maxWidth)+"px":(null==d?void 0:d.width.value)+"px",minHeight:48}),"Real Head Pro"!==r.font&&{fontFamily:r.font}),className:m.default(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>o(!0)},{children:i.jsx("p",Object.assign({className:m.default(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==r.font&&{fontFamily:r.font})},{children:(null==u?void 0:u.popupText)||(null===(l=p.data)||void 0===l?void 0:l.formtitle)||"Open Tool"}))}))};exports.Popup=s=>{var t,n,h,v,j,y,b,f,g,{formId:O,className:k}=s,w=e.__rest(s,["formId","className"]);const[P,q]=o.useState(!1);return i.jsx(l.QueryClientProvider,Object.assign({client:p},{children:i.jsxs(r.PickaxeProvider,Object.assign({},w,{deploymentType:"popup",isEmbed:!0},{children:[i.jsx(x,{formId:O,setIsOpen:q}),i.jsx(u.default,Object.assign({isOpen:P,onChange:()=>q(!1)},{children:i.jsxs(c.default,Object.assign({className:m.default("relative bg-transparent overflow-hidden",w.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(n=null===(t=w.styles)||void 0===t?void 0:t.cornerRadius)&&void 0!==n?n:0)+"px"}},{children:[i.jsx("div",Object.assign({className:"overflow-auto scrollbar scrollbar-thin",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(h=w.styles)||void 0===h?void 0:h.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(j=w.deploymentDimensions)||void 0===j?void 0:j.width.unit)?{width:w.deploymentDimensions.width.value+w.deploymentDimensions.width.unit}:"%"===(null===(y=w.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(w.deploymentDimensions.maxWidth*(w.deploymentDimensions.width.value/100))}:{}),"px"===(null===(b=w.deploymentDimensions)||void 0===b?void 0:b.height.unit)?{height:w.deploymentDimensions.height.value+"px"}:"auto"===(null===(f=w.deploymentDimensions)||void 0===f?void 0:f.height.unit)?{height:w.deploymentDimensions.minHeight+"px",maxHeight:w.deploymentDimensions.maxHeight+"px"}:{})},{children:i.jsx(a.Pickaxe,Object.assign({formId:O},k&&{className:k}))})),i.jsx("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>q(!1),style:{right:12,top:12,color:(null===(g=w.colors)||void 0===g?void 0:g.text)||"#000"}},{children:i.jsx(d.default,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},exports.PopupCTAButton=x;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),o=require("react"),s=require("../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../hooks/pickaxe/usePickaxe.js"),n=require("../../hooks/studio/useStyleFontSize.js"),l=require("@tanstack/react-query"),a=require("../Pickaxe/index.js"),r=require("../Pickaxe/Provider.js"),d=require("../Icons/x.svg.js"),u=require("../Core/Modal/index.js"),c=require("../Core/Modal/Body.js"),m=require("../../common/cn.js");const p=new l.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),x=({formId:e,setIsOpen:o})=>{var l;const{colors:a,styles:r,deploymentDimensions:d,deploymentMisc:u}=s.usePickaxeContext(),c=n.useStyleFontSize(),p=t.useInstantPickaxe(e);return p.isLoading?null:i.jsx("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==r.font&&{fontFamily:r.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:r.cornerRadius+"px",borderWidth:r.outlineThickness+"px",maxWidth:"%"===(null==d?void 0:d.width.unit)?(null==d?void 0:d.maxWidth)+"px":(null==d?void 0:d.width.value)+"px",minHeight:48}),"Real Head Pro"!==r.font&&{fontFamily:r.font}),className:m.default(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>o(!0)},{children:i.jsx("p",Object.assign({className:m.default(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==r.font&&{fontFamily:r.font})},{children:(null==u?void 0:u.popupText)||(null===(l=p.data)||void 0===l?void 0:l.formtitle)||"Open Tool"}))}))};exports.Popup=s=>{var t,n,h,v,j,y,b,f,g,{formId:O,className:k}=s,w=e.__rest(s,["formId","className"]);const[P,q]=o.useState(!1);return i.jsx(l.QueryClientProvider,Object.assign({client:p},{children:i.jsxs(r.PickaxeProvider,Object.assign({},w,{deploymentType:"popup",isEmbed:!0},{children:[i.jsx(x,{formId:O,setIsOpen:q}),i.jsx(u.default,Object.assign({isOpen:P,onChange:()=>q(!1)},{children:i.jsxs(c.default,Object.assign({className:m.default("relative bg-transparent overflow-hidden",w.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(n=null===(t=w.styles)||void 0===t?void 0:t.cornerRadius)&&void 0!==n?n:0)+"px"}},{children:[i.jsx("div",Object.assign({className:"overflow-auto",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(h=w.styles)||void 0===h?void 0:h.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(j=w.deploymentDimensions)||void 0===j?void 0:j.width.unit)?{width:w.deploymentDimensions.width.value+w.deploymentDimensions.width.unit}:"%"===(null===(y=w.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(w.deploymentDimensions.maxWidth*(w.deploymentDimensions.width.value/100))}:{}),"px"===(null===(b=w.deploymentDimensions)||void 0===b?void 0:b.height.unit)?{height:w.deploymentDimensions.height.value+"px"}:"auto"===(null===(f=w.deploymentDimensions)||void 0===f?void 0:f.height.unit)?{height:w.deploymentDimensions.minHeight+"px",maxHeight:w.deploymentDimensions.maxHeight+"px"}:{})},{children:i.jsx(a.Pickaxe,Object.assign({formId:O},k&&{className:k}))})),i.jsx("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>q(!1),style:{right:12,top:12,color:(null===(g=w.colors)||void 0===g?void 0:g.text)||"#000"}},{children:i.jsx(d.default,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},exports.PopupCTAButton=x;
@@ -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:v})=>{var w;const N=n.useConversation(),b=o.useStyleFontSize(),{pickaxe:k,colors:y,misc:C,isNewChat:O,isRtl:q,isEmbed:S,setChatId:P}=a.usePickaxeContext(),{scrollContainerRef:I}=i.useScrollContext(),{messages:E,status:L,limitData:M,error:A}=t.useResponseContext(),{height:D}=l.useDimensionContext(),H=s.useMemo((()=>!!N.data&&!(N.data.messages.length<=1)),[N.data]),R=s.useMemo((()=>!g&&N.isSuccess&&O&&!H),[g,N.isSuccess,O,H]),z=s.useMemo((()=>{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.jsx("div",Object.assign({ref:I,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${D}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:[(R||!S)&&!C.isWhiteLabel&&e.jsx(h.default,{className:p.default("absolute top-4 right-4",!R&&!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]",R&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500,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",!R&&"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&&!R&&"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:[O&&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:v}),a))),E.map(((s,a)=>e.jsx(j.default,{index:N.data.messages.length+a,message:s},a))),"fetching"===L||z?e.jsx("div",Object.assign({className:p.default("flex w-full",q?"justify-end":"justify-start")},{children:e.jsx("div",Object.assign({className:"flex flex-col"},{children:e.jsxs("div",Object.assign({className:p.default("flex gap-x-3",q&&"flex-row-reverse")},{children:["NONE"!==(null==k?void 0:k.chaticon)&&e.jsx(r.default,{src:null!==(w=null==k?void 0:k.chaticon)&&void 0!==w?w:`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:"my-3 h-6 w-6",textColor:y.text}),e.jsx("div",Object.assign({className:"flex items-center gap-x-2 rounded px-2"},{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",q?"justify-end":"justify-start")},{children:e.jsx(c.default,{error:A})})):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("../../../Core/ErrorAlert.js"),c=require("../../common/PickaxeHead.js"),d=require("../../common/PickaxeCompactHead.js"),u=require("../../common/PickaxeUpgradeCard.js"),x=require("../../common/PickaxeIcon.js"),m=require("../../common/PickaxeBranding.js"),f=require("../../common/PickaxeSkeleton.js"),j=require("../../Addons/Scroll/ScrollLockView.js"),h=require("./Message.js"),p=require("../../../../common/cn.js");exports.default=({hideInfo:g,isInputFocused:v})=>{var w;const N=n.useConversation(),b=o.useStyleFontSize(),{pickaxe:k,colors:y,misc:C,isNewChat:O,isRtl:q,isEmbed:S,setChatId:P}=a.usePickaxeContext(),{scrollContainerRef:I}=i.useScrollContext(),{messages:E,status:L,limitData:M,error:A}=t.useResponseContext(),{height:D}=l.useDimensionContext(),H=s.useMemo((()=>!!N.data&&!(N.data.messages.length<=1)),[N.data]),R=s.useMemo((()=>!g&&N.isSuccess&&O&&!H),[g,N.isSuccess,O,H]),z=s.useMemo((()=>{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.jsx("div",Object.assign({ref:I,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${D}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:[(R||!S)&&!C.isWhiteLabel&&e.jsx(m.default,{className:p.default("absolute top-4 right-4",!R&&!S&&"top-2"),animateHover:!0}),e.jsx(c.default,{className:p.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",R&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500,onIconClick:()=>P("")}),S&&!N.isLoading&&e.jsx(d.default,{className:p.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!R&&"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&&!R&&"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:[O&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(f.default,{className:"w-[72px] h-[72px]"}),e.jsx(f.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(f.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(f.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(f.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(f.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(f.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(h.default,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),E.map(((s,a)=>e.jsx(h.default,{index:N.data.messages.length+a,message:s},a))),"fetching"===L||z?e.jsx("div",Object.assign({className:p.default("flex w-full",q?"justify-end":"justify-start")},{children:e.jsx("div",Object.assign({className:"flex flex-col"},{children:e.jsxs("div",Object.assign({className:p.default("flex gap-x-3",q&&"flex-row-reverse")},{children:["NONE"!==(null==k?void 0:k.chaticon)&&e.jsx(x.default,{src:null!==(w=null==k?void 0:k.chaticon)&&void 0!==w?w:`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:"my-3 h-6 w-6",textColor:y.text}),e.jsx("div",Object.assign({className:"flex items-center gap-x-2 rounded px-2"},{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(u.default,{})})):A?e.jsx("div",Object.assign({className:p.default("flex items-center gap-x-3",q?"justify-end":"justify-start")},{children:e.jsx(r.default,{error:A})})):null]})),e.jsx(j.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"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=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"),p=require("../../Icons/attach-vertical.svg.js"),h=require("../../Icons/spinner-lines.svg.js"),g=require("../../Icons/file.svg.js"),j=require("../../Icons/x.svg.js"),b=require("../../Icons/arrow-right.svg.js"),v=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),w=require("../../Core/ErrorAlert.js"),k=require("../../../common/error.js"),N=require("../../../common/cn.js");exports.default=({isFocused:I,onFocus:O,onBlur:C})=>{var q;const{formId:S,chatId:R,userId:T,studioUserId:_,embedUserId:A,deploymentId:D,deploymentType:B,pickaxe:E,styles:F,colors:U,responsiveBy:H,isNewChat:z,isRtl:M,setIsNewChat:P,setIsShowIceBreaker:L,onGenerateComplete:$}=r.usePickaxeContext(),{messages:G,status:J,limits:K,isGenerating:W,setMessages:Q,setStatus:V,setLimitData:X,setError:Y}=o.useResponseContext(),{documents:Z,isUploading:ee,isImageUploadAllowed:se,documentError:te,onFileUpload:re,setDocuments:oe,setDocumentError:le,removeDocument:ae}=d.useDocument(),{scrollStartSession:ie,scrollEndSession:ne,scrollToBottom:de}=c.useScroll({auto:!0}),ce=i.useConversation(),ue=n.useSubmit(),[me,fe]=t.useState(""),xe=t.useRef(null),pe=u.useHover(),{isHover:he}=pe,ge=e.__rest(pe,["isHover"]),je=u.useHover(),{isHover:be}=je,ve=e.__rest(je,["isHover"]),ye=a.useStyleFontSize(),we=l.useStyleInput(),ke=t.useMemo((()=>{var e,s,t;return!!z&&(!!E&&(!ce.isLoading&&(!((null!==(s=null===(e=ce.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=E.icebreakers)||void 0===t?void 0:t.length))))}),[E,z,ce.data,ce.isLoading]),Ne=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==J||ee)return;const e=null!=s?s:me;if(!e)return;Y(""),le(""),X(null),fe(""),P(!1),V("fetching"),ie(),de();const t=Z.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),r="enduserupload"===(null==E?void 0:E.documentuploadtype)&&t.length>0,o=[...Array.from(G),Object.assign({id:G.length+1,role:"user",content:e},r&&{documentIds:t})];Q(o),de(),r&&oe([]);const l=(yield ue.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:S,responseId:R,value:e},r&&{documentIds:t}),T&&{userId:T}),_&&{studioUserId:_}),A&&{embedUserId:A}),D&&{deploymentId:D}))).body;if(!l)throw new Error("Streaming error");const a=o.length,i=new TextDecoder,n=l.getReader();let d="",c=!0,u=!1;const m=x.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");d+=s,Q([...o.slice(0,a),{id:G.length+1,role:"assistant",content:d}])}else if("error"===e.event){const s=JSON.parse(e.data);Y(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(c=!1)}});for(;c;){const{value:e,done:s}=yield n.read();if(s){c=!1;break}const t=i.decode(e);t&&(u||(V("streaming"),u=!0),m.feed(t))}null==$||$(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(K).find((([e])=>s.includes(e)));t?X(t[1]):Y(s)}finally{de(),V("idle"),ne()}}));return t.useEffect((()=>{L(ke)}),[ke]),s.jsx("div",Object.assign({className:N.default("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===B&&z)&&"px-4 pb-4"),dir:M?"rtl":"ltr"},{children:s.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===B&&z)&&s.jsx("div",Object.assign({className:N.default("absolute bottom-full",M?"left-0":"right-0")},{children:s.jsx("div",Object.assign({className:N.default("flex flex-col gap-2 pb-4 px-2",M?"justify-start":"justify-end","viewport"===H?M?"min-[767px]:items-start":"min-[767px]:items-end":M?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:ke&&!I&&s.jsx(v.default,{data:(null==E?void 0:E.icebreakers)||[],onSend:Ne})}))})),s.jsxs("div",Object.assign({className:N.default("flex flex-col gap-y-2 px-4 py-3","block"===F.formFieldStyle&&"shadow"),style:we},{children:["idle"===J&&Z.length>0&&s.jsx("div",Object.assign({className:"flex flex-row gap-2 flex-wrap"},{children:Z.filter((e=>"failed"!==e.status)).map((e=>{var r,o,l;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:N.default("relative gap-x-[10px] flex items-center px-2 h-[56px] border",M&&"flex-row-reverse"),style:{borderRadius:we.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:we.borderRadius}},{children:ee?s.jsx(h.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:N.default("flex flex-col justify-center truncate",M?"text-right items-end":"text-left items-start")},{children:[s.jsx("p",Object.assign({className:(N.default(ye.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:N.default(ye.b4,"opacity-80 truncate")},{children:m.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",className:N.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",M?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:we.backgroundColor},disabled:ee||"idle"!==J,onClick:()=>ae(e.id)},{children:s.jsx(j.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:we.borderRadius}},{children:["finished"===e.status?s.jsx("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===(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:we.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",className:N.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",M?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:we.backgroundColor},disabled:ee||"idle"!==J,onClick:()=>ae(e.id)},{children:s.jsx(j.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:N.default("flex items-end gap-x-2",M&&"flex-row-reverse")},{children:[s.jsx(y.default,Object.assign({className:N.default(ye.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!me.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",M?"text-right":"text-left"),value:me,placeholder:M?"بماذا تريد أن تتحدث؟":null!==(q=null==E?void 0:E.placeholdertext)&&void 0!==q?q:"What do you want to talk about?",onChange:e=>fe(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ee||"idle"!==J||Ne()))}},O&&{onFocus:O},C&&{onBlur:C},{dir:M?"rtl":"ltr"})),s.jsxs("div",Object.assign({className:N.default("flex items-center gap-x-2")},{children:["enduserupload"===(null==E?void 0:E.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:be?U.accent+"10":void 0},disabled:ee||"idle"!==J,onClick:()=>{var e;return null===(e=xe.current)||void 0===e?void 0:e.click()}},ve,{children:[s.jsx("input",{id:"file-upload",ref:xe,type:"file",accept:[...f.allowedFileMimeTypes,...se?f.allowedImageMimeTypes:[]].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){P(!1),yield re(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:be?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:(he||me.length||Z.length&&Z.every((e=>"finished"===e.status)))&&!W?U.accent:U.accent+"10"},disabled:ee||"idle"!==J,onClick:()=>Ne()},ge,{children:s.jsx(b.default,{className:N.default("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",M&&"transform scale-x-[-1]"),style:{color:(he||me.length||Z.length&&Z.every((e=>"finished"===e.status)))&&!W?U.accentText:U.accent+"80"}})}))]}))]}))]})),te&&s.jsx(w.default,{error:te,className:"mt-3"})]}))}))};
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"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=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"),p=require("../../Icons/attach-vertical.svg.js"),h=require("../../Icons/spinner-lines.svg.js"),g=require("../../Icons/file.svg.js"),j=require("../../Icons/x.svg.js"),b=require("../../Icons/arrow-right.svg.js"),v=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),w=require("../../Core/ErrorAlert.js"),k=require("../../../common/error.js"),N=require("../../../common/cn.js");exports.default=({isFocused:I,onFocus:O,onBlur:C})=>{var q;const{formId:S,chatId:R,userId:T,studioUserId:_,embedUserId:A,deploymentId:D,deploymentType:B,pickaxe:E,styles:F,colors:U,responsiveBy:H,isNewChat:z,isRtl:M,setIsNewChat:P,setIsShowIceBreaker:L,onGenerateComplete:$}=r.usePickaxeContext(),{messages:G,status:J,limits:K,isGenerating:W,setMessages:Q,setStatus:V,setLimitData:X,setError:Y}=o.useResponseContext(),{documents:Z,isUploading:ee,isImageUploadAllowed:se,documentError:te,onFileUpload:re,setDocuments:oe,setDocumentError:le,removeDocument:ae}=d.useDocument(),{scrollStartSession:ie,scrollEndSession:ne,scrollToBottom:de}=c.useScroll({auto:!0}),ce=i.useConversation(),ue=n.useSubmit(),[me,fe]=t.useState(""),xe=t.useRef(null),pe=u.useHover(),{isHover:he}=pe,ge=e.__rest(pe,["isHover"]),je=u.useHover(),{isHover:be}=je,ve=e.__rest(je,["isHover"]),ye=a.useStyleFontSize(),we=l.useStyleInput(),ke=t.useMemo((()=>{var e,s,t;return!!z&&(!!E&&(!ce.isLoading&&(!((null!==(s=null===(e=ce.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=E.icebreakers)||void 0===t?void 0:t.length))))}),[E,z,ce.data,ce.isLoading]),Ne=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==J||ee)return;const e=null!=s?s:me;if(!e)return;Y(""),le(""),X(null),fe(""),P(!1),V("fetching"),ie(),de();const t=Z.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),r="enduserupload"===(null==E?void 0:E.documentuploadtype)&&t.length>0,o=[...Array.from(G),Object.assign({id:G.length+1,role:"user",content:e},r&&{documentIds:t})];Q(o),de(),r&&oe([]);const l=(yield ue.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:S,responseId:R,value:e},r&&{documentIds:t}),T&&{userId:T}),_&&{studioUserId:_}),A&&{embedUserId:A}),D&&{deploymentId:D}))).body;if(!l)throw new Error("Streaming error");const a=o.length,i=new TextDecoder,n=l.getReader();let d="",c=!0,u=!1;const m=x.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");d+=s,Q([...o.slice(0,a),{id:G.length+1,role:"assistant",content:d}])}else if("error"===e.event){const s=JSON.parse(e.data);Y(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(c=!1)}});for(;c;){const{value:e,done:s}=yield n.read();if(s){c=!1;break}const t=i.decode(e);t&&(u||(V("streaming"),u=!0),m.feed(t))}null==$||$(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(K).find((([e])=>s.includes(e)));t?X(t[1]):Y(s)}finally{de(),V("idle"),ne()}}));return t.useEffect((()=>{L(ke)}),[ke]),s.jsx("div",Object.assign({className:N.default("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===B&&z)&&"px-4 pb-4"),dir:M?"rtl":"ltr"},{children:s.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===B&&z)&&s.jsx("div",Object.assign({className:N.default("absolute bottom-full",M?"left-0":"right-0")},{children:s.jsx("div",Object.assign({className:N.default("flex flex-col gap-2 pb-4 px-2",M?"justify-start":"justify-end","viewport"===H?M?"min-[767px]:items-start":"min-[767px]:items-end":M?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:ke&&!I&&s.jsx(v.default,{data:(null==E?void 0:E.icebreakers)||[],onSend:Ne})}))})),s.jsxs("div",Object.assign({className:N.default("flex flex-col gap-y-2 px-4 py-3","block"===F.formFieldStyle&&"shadow"),style:we},{children:["idle"===J&&Z.length>0&&s.jsx("div",Object.assign({className:"flex flex-row gap-2 flex-wrap"},{children:Z.filter((e=>"failed"!==e.status)).map((e=>{var r,o,l;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:N.default("relative gap-x-[10px] flex items-center px-2 h-[56px] border",M&&"flex-row-reverse"),style:{borderRadius:we.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:we.borderRadius}},{children:ee?s.jsx(h.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:N.default("flex flex-col justify-center truncate",M?"text-right items-end":"text-left items-start")},{children:[s.jsx("p",Object.assign({className:(N.default(ye.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:N.default(ye.b4,"opacity-80 truncate")},{children:m.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",className:N.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",M?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:we.backgroundColor},disabled:ee||"idle"!==J,onClick:()=>ae(e.id)},{children:s.jsx(j.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:we.borderRadius}},{children:["finished"===e.status?s.jsx("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===(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:we.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",className:N.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",M?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:we.backgroundColor},disabled:ee||"idle"!==J,onClick:()=>ae(e.id)},{children:s.jsx(j.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:N.default("flex items-end gap-x-2",M&&"flex-row-reverse")},{children:[s.jsx(y.default,Object.assign({className:N.default(ye.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!me.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",M?"text-right":"text-left"),value:me,placeholder:null!==(q=null==E?void 0:E.placeholdertext)&&void 0!==q?q:M?"بماذا تريد أن تتحدث؟":"What do you want to talk about?",onChange:e=>fe(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ee||"idle"!==J||Ne()))}},O&&{onFocus:O},C&&{onBlur:C},{dir:M?"rtl":"ltr"})),s.jsxs("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==E?void 0:E.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:be?U.accent+"10":void 0},disabled:ee||"idle"!==J,onClick:()=>{var e;return null===(e=xe.current)||void 0===e?void 0:e.click()}},ve,{children:[s.jsx("input",{id:"file-upload",ref:xe,type:"file",accept:[...f.allowedFileMimeTypes,...se?f.allowedImageMimeTypes:[]].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){P(!1),yield re(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:be?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:(he||me.length||Z.length&&Z.every((e=>"finished"===e.status)))&&!W?U.accent:U.accent+"10"},disabled:ee||"idle"!==J,onClick:()=>Ne()},ge,{children:s.jsx(b.default,{className:N.default("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",M&&"transform scale-x-[-1]"),style:{color:(he||me.length||Z.length&&Z.every((e=>"finished"===e.status)))&&!W?U.accentText:U.accent+"80"}})}))]}))]}))]})),te&&s.jsx(w.default,{error:te,className:"mt-3"})]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),i=require("./History/index.js"),o=require("./Input.js");exports.default=()=>{const{deploymentType:u,isNewChat:c}=s.usePickaxeContext(),{width:x,height:a,setDimension:l}=r.useDimensionContext(),{setDocuments:d}=n.useDocument(),[f,h]=t.useState(!1),j=t.useRef(null);return t.useEffect((()=>()=>{d([])}),[]),t.useEffect((()=>{if(!j.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:s}=t.contentRect;l(parseInt(e.toFixed(0)),parseInt(s.toFixed(0)))}}));return e.observe(j.current),()=>{e.disconnect()}}),[j.current]),"chat-input"===u&&c?e.jsx("div",Object.assign({className:"relative flex flex-grow flex-col items-center"},{children:e.jsx(o.default,{})})):e.jsxs("div",Object.assign({ref:j,className:"flex flex-grow flex-col items-center"},{children:[e.jsx(i.default,{hideInfo:a<=545||x<=500||f,isInputFocused:f}),e.jsx(o.default,{isFocused:f,onFocus:()=>h(!0),onBlur:()=>h(!1)})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),o=require("./History/index.js"),u=require("./Input.js");exports.default=()=>{const{deploymentType:i,isNewChat:c}=s.usePickaxeContext(),{width:a,height:x,setDimension:d}=r.useDimensionContext(),{setDocuments:f}=n.useDocument(),[l,h]=t.useState(!1),j=t.useRef(null);return t.useEffect((()=>()=>{f([])}),[]),t.useEffect((()=>{if(!j.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:s}=t.contentRect;d(parseInt(e.toFixed(0)),parseInt(s.toFixed(0)))}}));return e.observe(j.current),()=>{e.disconnect()}}),[j.current]),e.jsx("div",Object.assign({ref:j,className:"relative flex flex-grow flex-col items-center"},{children:"chat-input"===i&&c?e.jsx(u.default,{}):e.jsxs(e.Fragment,{children:[e.jsx(o.default,{hideInfo:x<=545||a<=350||l,isInputFocused:l}),e.jsx(u.default,{isFocused:l,onFocus:()=>h(!0),onBlur:()=>h(!1)})]})}))};
@@ -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"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../Addons/Scroll/hooks/useScrollContext.js"),n=require("../../../../hooks/studio/useStyleFontSize.js"),a=require("../../Addons/Document/hooks/useDocument.js"),r=require("../../common/PickaxeMarkdown/index.js"),i=require("../../common/PickaxeMarkdown/Renderer.js"),c=require("date-fns"),d=require("../../../Icons/message-square-notes.svg.js"),u=require("../../../Icons/visitor.svg.js"),x=require("../../common/PickaxeIcon.js"),m=require("../../common/PickaxeCopyButton.js"),p=require("../../common/PickaxeSimpleButton.js"),h=require("../../Addons/Scroll/ScrollLockView.js"),j=require("../../../../common/cn.js");exports.default=()=>{var f;const{pickaxe:b,styles:g,colors:k,misc:v,translations:y,disableHtml:w,disableJs:q,disableCss:N,isRtl:C,setChatId:O,setIsNewChat:M}=t.usePickaxeContext(),{response:I}=o.useResponseContext(),{scrollTargetRef:S}=l.useScrollContext(),{setDocuments:P}=a.useDocument(),D=n.useStyleFontSize(),R=s.useMemo((()=>I?c.format(I.sentAt,"hh:mm a MMM dd, yy"):c.format(new Date,"hh:mm a MMM dd, yy")),[I]),$=s.useMemo((()=>{var e;if(!I)return"";return(null!==(e=I.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("")}),[I]);return I?e.jsxs("div",Object.assign({ref:S,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:k.primary,color:k.text}},{children:[e.jsx("div",Object.assign({className:"shrink-0 pt-1"},{children:e.jsx(u.default,{className:"h-6 w-6"})})),e.jsxs("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[e.jsx("input",{id:`${I.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:$.length<280}),e.jsx("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:$}}),e.jsx("label",Object.assign({htmlFor:`${I.responseId}-input`,className:j.default(D.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["see-input"])||"See input"})),e.jsx("label",Object.assign({htmlFor:`${I.responseId}-input`,className:j.default(D.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["hide-input"])||"Hide input"}))]}))]})),e.jsxs("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[v.isChatImage&&e.jsx(x.default,{src:null==b?void 0:b.chaticon,alt:`${null==b?void 0:b.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.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:g.theme,accentColor:k.accent,actions:!0},C&&{rtl:!0},w&&{disableHtml:!0},q&&{disableJs:!0},N&&{disableCss:!0},{children:e.jsx(i.PickaxeMarkdownRenderer,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:I.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==b?void 0:b.enablechatresponses)&&e.jsxs(p.default,Object.assign({color:k.accent,onClick:()=>{return e=I.responseId,P([]),M(!1),void O(e);var e}},{children:[e.jsx(d.default,{className:"pxe-h-4 pxe-w-4 pxe-shrink-0"}),e.jsx("p",Object.assign({className:j.default(D.b3,"pxe-font-semibold")},{children:I.messageCount+1}))]})),e.jsx(m.default,{color:k.accent,text:null!==(f=I.questionResponse)&&void 0!==f?f:""})]})),e.jsx("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:e.jsx("p",Object.assign({className:j.default(D.b3,"font-semibold uppercase opacity-30")},{children:R}))}))]}))]}))]})),e.jsx(h.default,{className:"w-full"})]})):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../Addons/Scroll/hooks/useScrollContext.js"),n=require("../../../../hooks/studio/useStyleFontSize.js"),a=require("../../Addons/Document/hooks/useDocument.js"),r=require("../../common/PickaxeMarkdown/index.js"),i=require("../../common/PickaxeMarkdown/Renderer.js"),c=require("date-fns"),d=require("../../../Icons/message-square-notes.svg.js"),u=require("../../../Icons/visitor.svg.js"),x=require("../../common/PickaxeIcon.js"),m=require("../../common/PickaxeCopyButton.js"),h=require("../../common/PickaxeSimpleButton.js"),p=require("../../Addons/Scroll/ScrollLockView.js"),j=require("../../../../common/cn.js");exports.default=()=>{var f;const{pickaxe:b,styles:g,colors:k,misc:v,translations:y,disableHtml:w,disableJs:q,disableCss:N,isRtl:C,setChatId:O,setIsNewChat:M}=t.usePickaxeContext(),{response:I}=o.useResponseContext(),{scrollTargetRef:S}=l.useScrollContext(),{setDocuments:P}=a.useDocument(),D=n.useStyleFontSize(),R=s.useMemo((()=>I?c.format(I.sentAt,"hh:mm a MMM dd, yy"):c.format(new Date,"hh:mm a MMM dd, yy")),[I]),$=s.useMemo((()=>{var e;if(!I)return"";return(null!==(e=I.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("")}),[I]);return I?e.jsxs("div",Object.assign({ref:S,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:k.primary,color:k.text}},{children:[e.jsx("div",Object.assign({className:"shrink-0 pt-1"},{children:e.jsx(u.default,{className:"h-6 w-6"})})),e.jsxs("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[e.jsx("input",{id:`${I.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:$.length<280}),e.jsx("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:$}}),e.jsx("label",Object.assign({htmlFor:`${I.responseId}-input`,className:j.default(D.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["see-input"])||"See input"})),e.jsx("label",Object.assign({htmlFor:`${I.responseId}-input`,className:j.default(D.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["hide-input"])||"Hide input"}))]}))]})),e.jsxs("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[v.isChatImage&&e.jsx(x.default,{src:null==b?void 0:b.chaticon,alt:`${null==b?void 0:b.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.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:g.theme,accentColor:k.accent,actions:!0},C&&{rtl:!0},w&&{disableHtml:!0},q&&{disableJs:!0},N&&{disableCss:!0},{children:e.jsx(i.PickaxeMarkdownRenderer,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:I.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==b?void 0:b.enablechatresponses)&&e.jsxs(h.default,Object.assign({color:k.accent,onClick:()=>{return e=I.responseId,P([]),M(!1),void O(e);var e}},{children:[e.jsx(d.default,{className:"h-4 w-4 shrink-0"}),e.jsx("p",Object.assign({className:j.default(D.b3,"font-semibold")},{children:I.messageCount+1}))]})),e.jsx(m.default,{color:k.accent,text:null!==(f=I.questionResponse)&&void 0!==f?f:""})]})),e.jsx("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:e.jsx("p",Object.assign({className:j.default(D.b3,"font-semibold uppercase opacity-30")},{children:R}))}))]}))]}))]})),e.jsx(p.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"),l=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),i=require("../../Addons/Document/hooks/useDocument.js"),o=require("../../../../hooks/core/useHover.js"),n=require("../../../../common/documents.js"),c=require("../../../../common/utils.js"),d=require("../../../Icons/attach-vertical.svg.js"),u=require("../../../Icons/check.svg.js"),m=require("../../../Icons/spinner-lines.svg.js"),b=require("../../../Icons/file.svg.js"),x=require("../../../Icons/x.svg.js"),j=require("../../../Icons/link.svg.js"),f=require("../../../Core/ErrorAlert.js"),p=require("../../../../common/cn.js");exports.default=({field:h,update:g})=>{var y;const v=r.useStyleFontSize(),{colors:w,styles:N,translations:k,responsiveBy:O}=l.usePickaxeContext(),C=o.useHover(),{isHover:q}=C,I=e.__rest(C,["isHover"]),{documents:R,documentError:T,websiteLink:_,isUploading:D,isImageUploadAllowed:F,removeDocument:S,setDocumentError:A,setWebsiteLink:U,onFileUpload:z,onWebsiteUpload:E}=i.useDocument({onQuestionChange:e=>{g(Object.assign(Object.assign({},h),e))}}),[H,P]=t.useState(!1),B=t.useRef(null),L=a.useStyleInput();return s.jsxs("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsxs("div",Object.assign({className:"flex items-center gap-1"},{children:[s.jsx("p",Object.assign({className:p.default(v.b3,"font-semibold opacity-70")},{children:h.main})),h.isRequired&&s.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:w.error}},{children:"*"}))]})),s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsx("input",{ref:B,type:"file",accept:[...n.allowedFileMimeTypes,...F?n.allowedImageMimeTypes:[]].join(", "),id:h.id,hidden:!0,multiple:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield z(Array.from(s.target.files||[])),s.target.value=""})),disabled:D}),s.jsxs("div",Object.assign({className:p.default("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",H&&"block"===N.formFieldStyle&&"shadow","block"===N.formFieldStyle&&"shadow hover:shadow-none"),style:L},{children:[s.jsx("input",{type:"text",value:_,className:p.default(v.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(y=null==k?void 0:k["form-doc-placeholder"])&&void 0!==y?y:"Paste a website/video link or drag a file",onChange:e=>U(e.target.value),onDrop:s=>e.__awaiter(void 0,void 0,void 0,(function*(){s.preventDefault(),yield z(Array.from(s.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E(_))},onFocus:()=>P(!0),onBlur:()=>P(!1)}),s.jsx("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:_.length>0?s.jsxs(s.Fragment,{children:[s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:D,onClick:()=>E(_)},{children:s.jsx(u.default,{className:"h-5 w-5 shrink-0",style:{color:w.accent}})})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:D,onClick:()=>{U(""),A("")}},{children:s.jsx(x.default,{className:"h-6 w-6 shrink-0",style:{color:w.accent}})}))]}):s.jsx("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",disabled:D,onClick:()=>{var e;null===(e=B.current)||void 0===e||e.click()},style:{backgroundColor:q?w.accent+"10":void 0}},I,{children:s.jsx(d.default,{className:"h-6 w-6 shrink-0",style:{color:q?w.accent:w.accent+"80"}})}))}))]}))]}))]})),R.length>0&&s.jsx("div",Object.assign({className:p.default("flex gap-4","viewport"===O?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:s.jsx("div",Object.assign({className:"flex flex-row gap-x-2"},{children:R.filter((e=>"failed"!==e.status)).map((e=>{var l,a,r;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:L},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:w.accent,borderRadius:L.borderRadius}},{children:D?s.jsx(m.default,{className:"w-5 h-5 animate-spin",style:{color:w.accentText}}):s.jsx(b.default,{className:"w-5 h-5",style:{color:w.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(v.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:p.default(v.b4,"opacity-80 truncate")},{children:c.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S(e.id),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:w.accent,borderColor:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:w.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:L.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:L.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}/${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[1]}.${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:L.borderRadius,backgroundColor:w.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S(e.id),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:w.accent,borderColor:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:w.accentText}})}))]})):"website"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:L},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:w.accent,borderRadius:L.borderRadius}},{children:D?s.jsx(m.default,{className:"w-5 h-5 animate-spin",style:{color:w.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:w.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(v.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),s.jsx("p",Object.assign({className:p.default(v.b4,"opacity-80 truncate")},{children:(null==k?void 0:k.website)||"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S(e.id),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:w.accent,borderColor:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:w.accentText}})}))]})):null},e.id)}))}))})),T&&s.jsx(f.default,{error:T,className:"mt-3"})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),l=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),i=require("../../Addons/Document/hooks/useDocument.js"),n=require("../../../../hooks/core/useHover.js"),o=require("../../../../common/documents.js"),c=require("../../../../common/utils.js"),d=require("../../../Icons/attach-vertical.svg.js"),u=require("../../../Icons/check.svg.js"),m=require("../../../Icons/spinner-lines.svg.js"),b=require("../../../Icons/file.svg.js"),x=require("../../../Icons/x.svg.js"),j=require("../../../Icons/link.svg.js"),f=require("../../../Core/ErrorAlert.js"),h=require("../../../../common/cn.js");exports.default=({field:p,update:g})=>{var y;const v=r.useStyleFontSize(),{colors:k,styles:w,translations:N,responsiveBy:O}=l.usePickaxeContext(),C=n.useHover(),{isHover:q}=C,I=e.__rest(C,["isHover"]),{documents:R,documentError:T,websiteLink:_,isUploading:D,isImageUploadAllowed:F,removeDocument:S,setDocumentError:A,setWebsiteLink:U,onFileUpload:z,onWebsiteUpload:E}=i.useDocument({onQuestionChange:e=>{g(Object.assign(Object.assign({},p),e))}}),[H,P]=t.useState(!1),B=t.useRef(null),L=a.useStyleInput();return s.jsxs("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsxs("div",Object.assign({className:"flex items-center gap-1"},{children:[s.jsx("p",Object.assign({className:h.default(v.b3,"font-semibold opacity-70")},{children:p.main})),p.isRequired&&s.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:k.error}},{children:"*"}))]})),s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsx("input",{ref:B,type:"file",accept:[...o.allowedFileMimeTypes,...F?o.allowedImageMimeTypes:[]].join(", "),id:p.id,hidden:!0,multiple:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield z(Array.from(s.target.files||[])),s.target.value=""})),disabled:D}),s.jsxs("div",Object.assign({className:h.default("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",H&&"block"===w.formFieldStyle&&"shadow","block"===w.formFieldStyle&&"shadow hover:shadow-none"),style:L},{children:[s.jsx("input",{type:"text",value:_,className:h.default(v.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(y=null==N?void 0:N["form-doc-placeholder"])&&void 0!==y?y:"Paste a website/video link or drag a file",onChange:e=>U(e.target.value),onDrop:s=>e.__awaiter(void 0,void 0,void 0,(function*(){s.preventDefault(),yield z(Array.from(s.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),E(_))},onFocus:()=>P(!0),onBlur:()=>P(!1)}),s.jsx("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:_.length>0?s.jsxs(s.Fragment,{children:[s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:D,onClick:()=>E(_)},{children:s.jsx(u.default,{className:"h-5 w-5 shrink-0",style:{color:k.accent}})})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:D,onClick:()=>{U(""),A("")}},{children:s.jsx(x.default,{className:"h-6 w-6 shrink-0",style:{color:k.accent}})}))]}):s.jsx("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",disabled:D,onClick:()=>{var e;null===(e=B.current)||void 0===e||e.click()},style:{backgroundColor:q?k.accent+"10":void 0}},I,{children:s.jsx(d.default,{className:"h-6 w-6 shrink-0",style:{color:q?k.accent:k.accent+"80"}})}))}))]}))]}))]})),R.length>0&&s.jsx("div",Object.assign({className:h.default("flex gap-4","viewport"===O?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:s.jsx("div",Object.assign({className:"flex flex-row gap-x-2"},{children:R.filter((e=>"failed"!==e.status)).map((e=>{var l,a,r;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:L},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:k.accent,borderRadius:L.borderRadius}},{children:D?s.jsx(m.default,{className:"w-5 h-5 shrink-0 animate-spin",style:{color:k.accentText}}):s.jsx(b.default,{className:"w-5 h-5 shrink-0",style:{color:k.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(h.default(v.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:h.default(v.b4,"opacity-80 truncate")},{children:c.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S(e.id),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:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4 shrink-0",style:{color:k.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:L.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:L.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}/${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[1]}.${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:L.borderRadius,backgroundColor:k.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S(e.id),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:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4 shrink-0",style:{color:k.accentText}})}))]})):"website"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:L},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:k.accent,borderRadius:L.borderRadius}},{children:D?s.jsx(m.default,{className:"w-5 h-5 animate-spin shrink-0",style:{color:k.accentText}}):s.jsx(j.default,{className:"w-5 h-5 shrink-0",style:{color:k.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(h.default(v.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),s.jsx("p",Object.assign({className:h.default(v.b4,"opacity-80 truncate")},{children:(null==N?void 0:N.website)||"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S(e.id),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:L.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4 shrink-0",style:{color:k.accentText}})}))]})):null},e.id)}))}))})),T&&s.jsx(f.default,{error:T,className:"mt-3"})]}))};
@@ -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"),n=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../../hooks/pickaxe/useSubmit.js"),r=require("../../Addons/Document/hooks/useDocument.js"),a=require("../../Addons/Scroll/hooks/useScroll.js"),l=require("../../../../common/utils.js"),d=require("@nem035/gpt-3-encoder"),u=require("eventsource-parser"),c=require("../../common/PickaxeBranding.js"),m=require("../../common/PickaxeButton.js"),p=require("../../../../common/error.js"),f=require("../../../../common/cn.js");exports.default=({questions:g})=>{var x;const{formId:h,userId:b,studioUserId:j,embedUserId:v,deploymentId:w,pickaxe:k,misc:q,translations:y,responsiveBy:I,setChatId:O,setIsNewChat:S,onGenerateComplete:C}=n.usePickaxeContext(),{status:P,limits:D,isGenerating:U,setResponse:E,setMessages:R,setStatus:N,setLimitData:_,setError:A}=o.useResponseContext(),{documents:B,websiteLink:L,isUploading:T,onWebsiteUpload:M,setDocuments:W,setDocumentError:G}=r.useDocument(),{scrollStartSession:J,scrollEndSession:F,scrollToTarget:K}=a.useScroll({auto:!(null==k?void 0:k.enablechatresponses)}),X=i.useSubmit(),[Y,z]=t.useState(!1);return s.jsxs("div",Object.assign({className:f.default("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===I?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[s.jsx("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:s.jsx(m.default,Object.assign({className:"px-5 min-h-[42px]",isDisabled:T||"idle"!==P||U||Y,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==P||T||Y)return;A(""),G(""),_(null),E(null);const e=["Multiple Choice","Checkbox"];for(const s of g){if(d.encode(s.input).length>s.maxLength&&!e.includes(s.type))throw new Error("One or more of your responses is too long!");if(s.isRequired&&!s.input.trim()&&"userinput:documentupload"!==s.id)throw new Error("You must fill out all required fields.")}const s=B.filter((e=>"finished"===e.status)),t=B.map((e=>e.name)),n="enduserupload"===(null==k?void 0:k.documentuploadtype),o=g.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=l.extractUrlsFromText(L).filter((e=>!t.includes(e)));if(i.length){const e=i[i.length-1];z(!0);const t=yield M(e);t&&(s.push(t),yield new Promise((e=>setTimeout(e,5e3)))),z(!1)}else if(o&&n&&!s.length)return void G("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=s.map((e=>e.documentId)).filter(Boolean),a=n&&r.length>0;let c={};g.forEach((e=>c=Object.assign(Object.assign({},c),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?s.map((e=>e.name)).join(",")||"":e.input}))),N("fetching"),J(),K();const m=yield X.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:h,valueObj:c},a&&{documentIds:r}),b&&{userId:b}),j&&{studioUserId:j}),v&&{embedUserId:v}),w&&{deploymentId:w})),p=m.body;if(!p)throw new Error("Streaming error");const f=m.headers.get("X-Pickaxe-Response-Id");if(!f)throw new Error("Response ID not found");const x=new TextDecoder,q=p.getReader();let y="",I=!0,D=!1;const U=u.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");y+=s,E({formId:h,responseId:f,documentIds:r,questions:g.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:y,messageCount:0,sentAt:new Date}),(null==k?void 0:k.enablechatresponses)&&R([{id:0,role:"assistant",content:y}])}else if("error"===e.event){const s=JSON.parse(e.data);A(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(I=!1)}});for(;I;){const{value:e,done:s}=yield q.read();if(s){I=!1;break}const t=x.decode(e);t&&(D||(N("streaming"),D=!0,a&&W([]),(null==k?void 0:k.enablechatresponses)&&(O(f),S(!1))),U.feed(t))}null==C||C(f)}catch(e){let s=p.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(D).find((([e])=>s.includes(e)));t?_(t[1]):A(s),K()}finally{N("idle"),z(!1),F()}}))},{children:Y?(null==y?void 0:y.processing)||"Processing...":T?(null==y?void 0:y.uploading)||"Uploading...":"fetching"===P||"streaming"===P?(null==y?void 0:y.loading)||"Loading...":null!==(x=null==k?void 0:k.submittext)&&void 0!==x?x:"Submit"}))})),!q.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3"},{children:s.jsx(c.default,{})}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),n=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../../hooks/pickaxe/useSubmit.js"),r=require("../../Addons/Document/hooks/useDocument.js"),a=require("../../Addons/Scroll/hooks/useScroll.js"),l=require("../../../../common/utils.js"),d=require("@nem035/gpt-3-encoder"),u=require("eventsource-parser"),c=require("../../common/PickaxeBranding.js"),m=require("../../common/PickaxeButton.js"),p=require("../../../../common/error.js");exports.default=({questions:g})=>{var f;const{formId:h,userId:x,studioUserId:b,embedUserId:j,deploymentId:v,pickaxe:w,misc:k,translations:q,setChatId:y,setIsNewChat:I,onGenerateComplete:O}=n.usePickaxeContext(),{status:S,limits:C,isGenerating:P,setResponse:D,setMessages:U,setStatus:E,setLimitData:R,setError:N}=o.useResponseContext(),{documents:_,websiteLink:A,isUploading:L,onWebsiteUpload:T,setDocuments:B,setDocumentError:M}=r.useDocument(),{scrollStartSession:W,scrollEndSession:G,scrollToTarget:J}=a.useScroll({auto:!(null==w?void 0:w.enablechatresponses)}),F=i.useSubmit(),[K,X]=t.useState(!1);return s.jsxs("div",Object.assign({className:"mt-4 flex flex-wrap justify-between gap-4 items-center"},{children:[s.jsx("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:s.jsx(m.default,Object.assign({className:"px-5 min-h-[42px]",isDisabled:L||"idle"!==S||P||K,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==S||L||K)return;N(""),M(""),R(null),D(null);const e=["Multiple Choice","Checkbox"];for(const s of g){if(d.encode(s.input).length>s.maxLength&&!e.includes(s.type))throw new Error("One or more of your responses is too long!");if(s.isRequired&&!s.input.trim()&&"userinput:documentupload"!==s.id)throw new Error("You must fill out all required fields.")}const s=_.filter((e=>"finished"===e.status)),t=_.map((e=>e.name)),n="enduserupload"===(null==w?void 0:w.documentuploadtype),o=g.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=l.extractUrlsFromText(A).filter((e=>!t.includes(e)));if(i.length){const e=i[i.length-1];X(!0);const t=yield T(e);t&&(s.push(t),yield new Promise((e=>setTimeout(e,5e3)))),X(!1)}else if(o&&n&&!s.length)return void M("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=s.map((e=>e.documentId)).filter(Boolean),a=n&&r.length>0;let c={};g.forEach((e=>c=Object.assign(Object.assign({},c),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?s.map((e=>e.name)).join(",")||"":e.input}))),E("fetching"),W(),J();const m=yield F.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:h,valueObj:c},a&&{documentIds:r}),x&&{userId:x}),b&&{studioUserId:b}),j&&{embedUserId:j}),v&&{deploymentId:v})),p=m.body;if(!p)throw new Error("Streaming error");const f=m.headers.get("X-Pickaxe-Response-Id");if(!f)throw new Error("Response ID not found");const k=new TextDecoder,q=p.getReader();let C="",P=!0,G=!1;const Y=u.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");C+=s,D({formId:h,responseId:f,documentIds:r,questions:g.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:C,messageCount:0,sentAt:new Date}),(null==w?void 0:w.enablechatresponses)&&U([{id:0,role:"assistant",content:C}])}else if("error"===e.event){const s=JSON.parse(e.data);N(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(P=!1)}});for(;P;){const{value:e,done:s}=yield q.read();if(s){P=!1;break}const t=k.decode(e);t&&(G||(E("streaming"),G=!0,a&&B([]),(null==w?void 0:w.enablechatresponses)&&(y(f),I(!1))),Y.feed(t))}null==O||O(f)}catch(e){let s=p.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(C).find((([e])=>s.includes(e)));t?R(t[1]):N(s),J()}finally{E("idle"),X(!1),G()}}))},{children:K?(null==q?void 0:q.processing)||"Processing...":L?(null==q?void 0:q.uploading)||"Uploading...":"fetching"===S||"streaming"===S?(null==q?void 0:q.loading)||"Loading...":null!==(f=null==w?void 0:w.submittext)&&void 0!==f?f:"Submit"}))})),!k.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3"},{children:s.jsx(c.default,{})}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),l=require("../../Core/Skeleton.js"),x=require("../common/PickaxeHead.js"),a=require("./History/index.js"),t=require("./NewChat.js"),i=require("./Questions/index.js"),r=require("../../../common/cn.js");exports.default=()=>{const{pickaxe:c,responsiveBy:u}=s.usePickaxeContext();return e.jsx("div",Object.assign({className:r.default("flex w-full flex-col items-center pt-12 px-4 pb-10","viewport"===u?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:c?e.jsxs("div",Object.assign({className:"flex w-full max-w-[700px] flex-col"},{children:[e.jsx(x.default,{}),e.jsxs("div",Object.assign({className:r.default("flex flex-col gap-y-8","viewport"===u?"min-[767px]:mt-4":"@[767px]/pickaxe-root:mt-4")},{children:[(null==c?void 0:c.chatflag)?e.jsx(t.default,{}):e.jsx(i.default,{}),e.jsx(a.default,{})]}))]})):e.jsxs("div",Object.assign({className:"flex w-full max-w-[700px] flex-col items-center"},{children:[e.jsx(l.default,{className:"w-[72px] h-[72px]"}),e.jsx(l.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(l.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(l.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),l=require("../common/PickaxeSkeleton.js"),x=require("../common/PickaxeHead.js"),a=require("./History/index.js"),t=require("./NewChat.js"),i=require("./Questions/index.js"),c=require("../../../common/cn.js");exports.default=()=>{const{pickaxe:r,responsiveBy:u}=s.usePickaxeContext();return e.jsx("div",Object.assign({className:c.default("flex w-full flex-col items-center pt-12 px-6 pb-10","viewport"===u?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:r?e.jsxs("div",Object.assign({className:"flex w-full max-w-[700px] flex-col"},{children:[e.jsx(x.default,{}),e.jsxs("div",Object.assign({className:c.default("flex flex-col gap-y-8","viewport"===u?"min-[767px]:mt-4":"@[767px]/pickaxe-root:mt-4")},{children:[(null==r?void 0:r.chatflag)?e.jsx(t.default,{}):e.jsx(i.default,{}),e.jsx(a.default,{})]}))]})):e.jsxs("div",Object.assign({className:"flex w-full max-w-[700px] flex-col items-center"},{children:[e.jsx(l.default,{className:"w-[72px] h-[72px]"}),e.jsx(l.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(l.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(l.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../hooks/studio/useStyleFontSize.js"),r=require("./PickaxeIcon.js"),l=require("./PickaxeBranding.js"),a=require("../../../common/cn.js");exports.default=({className:o,iconClassName:c,onIconClick:n})=>{const{pickaxe:u,misc:d}=s.usePickaxeContext(),x=t.useStyleFontSize(),m=i.useMemo((()=>({title:(null==u?void 0:u.formtitle)||"",description:(null==u?void 0:u.formdescription)||""})),[u]);return e.jsxs("div",Object.assign({className:a.default("flex h-[56px] items-center justify-between gap-4",o)},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-4"},{children:[d.isProfileImage&&e.jsx(r.default,Object.assign({src:null==u?void 0:u.coverphoto,alt:`${null==u?void 0:u.formtitle}'s Profile Picture`,width:32,height:32,className:a.default("shrink-0 h-[32px] w-[32px] rounded-full",c,!!n&&"cursor-pointer")},n&&{onClick:n})),d.isTitle&&e.jsx("p",Object.assign({className:a.default(x.b1)},{children:m.title}))]})),!d.isWhiteLabel&&e.jsx(l.default,{animateHover:!0})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../hooks/studio/useStyleFontSize.js"),l=require("./PickaxeIcon.js"),r=require("./PickaxeBranding.js"),a=require("../../../common/cn.js");exports.default=({className:o,iconClassName:c,onIconClick:n})=>{const{pickaxe:u,misc:d,deploymentType:p}=s.usePickaxeContext(),x=t.useStyleFontSize(),m=i.useMemo((()=>({title:(null==u?void 0:u.formtitle)||"",description:(null==u?void 0:u.formdescription)||""})),[u]);return d.isTitle||d.isDescription||!d.isWhiteLabel?e.jsxs("div",Object.assign({className:a.default("flex h-[56px] items-center justify-between gap-4",o)},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-4"},{children:[d.isProfileImage&&e.jsx(l.default,Object.assign({src:null==u?void 0:u.coverphoto,alt:`${null==u?void 0:u.formtitle}'s Profile Picture`,width:32,height:32,className:a.default("shrink-0 h-[32px] w-[32px] rounded-full",c,!!n&&"cursor-pointer")},n&&{onClick:n})),d.isTitle&&e.jsx("p",Object.assign({className:a.default(x.b1)},{children:m.title}))]})),!d.isWhiteLabel&&e.jsx(r.default,{className:a.default("flex","popup"===p&&"p-0 pr-12"),animateHover:!0})]})):null};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../Img/index.js"),i=require("../common/Action.js"),o=require("./Audio.js"),a=require("./Html/index.js");exports.A=({href:c="",children:m})=>{const{accentColor:l,actions:n}=r.usePickaxeMarkdownContext(),u=t.useMemo((()=>{if(!c)return"";return c.startsWith("http://")?`https://${c.slice(7)}`:c.startsWith("www.")?`https://${c}`:c}),[c]),d=t.useMemo((()=>{const e=u.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=u.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const r=u.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(r)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${r[1]}`};const s=u.match(/streamable\.com\/([\w-]+)/i);return s?{title:"streamable-embed",src:`https://streamable.com/e/${s[1]}`}:null}),[u]),p=t.useMemo((()=>u.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[u]),f=t.useMemo((()=>u.includes("action_generated_files")&&u.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[u]),h=t.useMemo((()=>u.includes("action_generated_files")&&u.match(/\.html$/)),[u]),b=t.useMemo((()=>n&&u.includes("pickaxe")&&(u.includes("/api/fn/result")||u.includes("/api/function_call_results"))),[n,u]);return d?e.jsx("div",Object.assign({className:"pxe-markdown-video"},{children:e.jsx("iframe",Object.assign({title:d.title,src:d.src,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):p?e.jsx(s.Img,{src:u,alt:"string"==typeof m?m:"Markdown Image"}):f?e.jsx(o.default,{url:u}):h?e.jsx(a.default,{url:u}):b?e.jsx(i.default,{jobUrl:u}):e.jsx("a",Object.assign({href:u,target:"_blank",rel:"noopener noreferrer",style:{color:l}},{children:m}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../Img/index.js"),o=require("../common/IframeVideo.js"),i=require("../common/Action.js"),a=require("./Audio.js"),c=require("./Html/index.js");exports.A=({href:m="",children:u})=>{const{accentColor:l,actions:n}=r.usePickaxeMarkdownContext(),d=t.useMemo((()=>{if(!m)return"";return m.startsWith("http://")?`https://${m.slice(7)}`:m.startsWith("www.")?`https://${m}`:m}),[m]),p=t.useMemo((()=>{const e=d.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=d.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const r=d.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(r)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${r[1]}`};const s=d.match(/streamable\.com\/([\w-]+)/i);return s?{title:"streamable-embed",src:`https://streamable.com/e/${s[1]}`}:null}),[d]),f=t.useMemo((()=>d.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[d]),h=t.useMemo((()=>d.includes("action_generated_files")&&d.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[d]),j=t.useMemo((()=>d.includes("action_generated_files")&&d.match(/\.html$/)),[d]),b=t.useMemo((()=>n&&d.includes("pickaxe")&&(d.includes("/api/fn/result")||d.includes("/api/function_call_results"))),[n,d]);return p?e.jsx(o.default,{title:p.title,src:p.src}):f?e.jsx(s.Img,{src:d,alt:"string"==typeof u?u:"Markdown Image"}):h?e.jsx(a.default,{url:d}):j?e.jsx(c.default,{url:d}):b?e.jsx(i.default,{jobUrl:d}):e.jsx("a",Object.assign({href:d,target:"_blank",rel:"noopener noreferrer",style:{color:l}},{children:u}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),r=require("react-syntax-highlighter"),i=require("../../hooks/usePickaxeMarkdownContext.js"),n=require("../../../PickaxeCopyButton.js");exports.Code=t=>{var a,l,{children:c,className:d}=t,o=e.__rest(t,["children","className"]);const{syntaxTheme:u}=i.usePickaxeMarkdownContext(),x=/language-(\w+)/.exec(d||"");return x?s.jsx("div",Object.assign({className:"pxe-markdown-code"},{children:s.jsxs("div",{children:[s.jsx("div",{children:s.jsx(n.default,{color:"#FFFFFF",text:null!==(a=null==c?void 0:c.toString())&&void 0!==a?a:"",iconClassName:"w-4 h-4 text-white"})}),s.jsx("div",{children:s.jsx(r.Prism,Object.assign({},o,{PreTag:"div",language:null!==(l=null==x?void 0:x[1])&&void 0!==l?l:"js",style:u,showLineNumbers:!0},{children:String(c).replace(/\n$/,"")}))})]})})):s.jsx("code",Object.assign({},o,{className:"pxe-markdown-code-inline"},{children:c}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),r=require("react-syntax-highlighter"),i=require("../../hooks/usePickaxeMarkdownContext.js"),n=require("../../../PickaxeCopyButton.js");exports.Code=t=>{var a,l,{node:c,children:d,className:o}=t,u=e.__rest(t,["node","children","className"]);const{syntaxTheme:x}=i.usePickaxeMarkdownContext(),h=/language-(\w+)/.exec(o||"");return h?s.jsx("div",Object.assign({className:"pxe-markdown-code"},{children:s.jsxs("div",{children:[s.jsx("div",{children:s.jsx(n.default,{color:"#FFFFFF",text:null!==(a=null==d?void 0:d.toString())&&void 0!==a?a:"",iconClassName:"w-4 h-4 text-white"})}),s.jsx("div",{children:s.jsx(r.Prism,Object.assign({},u,{PreTag:"div",language:null!==(l=null==h?void 0:h[1])&&void 0!==l?l:"js",style:x,showLineNumbers:!0},{children:String(d).replace(/\n$/,"")}))})]})})):s.jsx("code",Object.assign({},u,{className:"pxe-markdown-code-inline"},{children:d}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");exports.P=({children:r})=>{const o=t.useMemo((()=>{if("string"!=typeof r)return null;const e=r.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=r.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const o=r.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(o)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${o[1]}`};const s=r.match(/streamable\.com\/([\w-]+)/i);return s?{title:"streamable-embed",src:`https://streamable.com/e/${s[1]}`}:null}),[r]);return o?e.jsx("div",Object.assign({className:"pxe-markdown-video"},{children:e.jsx("iframe",Object.assign({title:o.title,src:o.src,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):e.jsx("p",{children:r})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../common/IframeVideo.js");exports.P=({children:o})=>{const m=t.useMemo((()=>{if("string"!=typeof o)return null;const e=o.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=o.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const r=o.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(r)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${r[1]}`};const m=o.match(/streamable\.com\/([\w-]+)/i);return m?{title:"streamable-embed",src:`https://streamable.com/e/${m[1]}`}:null}),[o]);return m?e.jsx(r.default,{title:m.title,src:m.src}):e.jsx("p",{children:o})};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");exports.default=({title:t,src:r,fallback:s="Iframe not supported, use a different browser."})=>e.jsx("div",Object.assign({className:"pxe-markdown-video"},{children:e.jsx("iframe",Object.assign({title:t,src:r,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:s}))}));
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),s=require("./utils/custom-plugins.js"),i=require("react-markdown"),a=require("remark-gfm"),o=require("remark-math"),l=require("rehype-katex"),u=require("rehype-raw"),c=require("./Components/A/index.js"),d=require("./Components/P/index.js"),p=require("./Components/Img/index.js"),h=require("./Components/Iframe/index.js"),m=require("./Components/Code/index.js"),x=require("./Components/Headings/index.js"),g=require("./Components/List/index.js"),f=require("./Components/Table/index.js"),b=require("./Components/Others/index.js"),j=require("./Components/Action/index.js"),C=require("../../../../common/cn.js");function q(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k=q(i),w=q(a),v=q(o),y=q(l),A=q(u);exports.PickaxeMarkdownRenderer=({className:i,style:a,children:o,value:l,maxLines:u,maxChars:q,multiLineBreaks:O,recursion:H,onExpandClick:P})=>{const{accentColor:S,rtl:M,disableHtml:$,disableJs:T,disableCss:_}=t.usePickaxeMarkdownContext(),[E,I]=n.useState({width:0,height:0}),[L,B]=n.useState(null),N=n.useRef(null),R=n.useMemo((()=>{if(!l)return"";let e=l.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),O&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[l,O]);n.useEffect((()=>{if(q)return void B(R.length>q?R.slice(0,q)+'<span class="pxe-expand-btn">...</span>':null);if(!u)return void B(null);if(!N.current||!R||L)return;const e=N.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=u*r;if(!(E.height>n))return;const t=Math.floor(E.width/8),s=Math.floor(t*u);B(R.slice(0,s)+'<span class="pxe-expand-btn">...</span>')}),[R,u,q,E,L]);const z={h1:x.H1,h2:x.H2,h3:x.H3,h4:x.H4,h5:x.H5,p:d.P,a:c.A,img:p.Img,iframe:h.Iframe,code:m.Code,ol:g.Ol,ul:g.Ul,li:g.Li,table:f.Table,th:f.Th,tr:f.Tr,td:f.Td,hr:b.Hr,br:b.Br,blockquote:b.Blockquote,span:n=>{var{children:t}=n,s=e.__rest(n,["children"]);return"pxe-expand-btn"===s.className?r.jsx("span",Object.assign({},s,{style:Object.assign({display:"inline",fontWeight:500,color:S,marginLeft:".25rem",userSelect:"none"},P&&{cursor:"pointer"})},P&&{onClick:P},{children:t})):r.jsx("span",Object.assign({},s,{children:t}))},ActionCaption:j.ActionCaption,ActionFinished:j.ActionFinished,ActionError:j.ActionError};n.useEffect((()=>{if(!N.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;I({width:e,height:n})}}));return e.observe(N.current),()=>{e.disconnect()}}),[]);const F=L||R;return r.jsxs("div",Object.assign({className:"pxe-markdown",ref:N,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},a)},M&&{dir:"rtl"},{children:[r.jsx(k.default,Object.assign({className:C.default(!H&&"pxe-prose",i),components:z,remarkPlugins:[w.default,[v.default,{singleDollarTextMath:!1}]],rehypePlugins:[y.default,...$?[]:[A.default],[s.rehypeSanitize,{disableJs:T,disableCss:_}],s.rehypePickaxeAction]},{children:F})),o]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),s=require("./utils/custom-plugins.js"),i=require("react-markdown"),o=require("remark-gfm"),a=require("remark-math"),l=require("rehype-katex"),u=require("rehype-raw"),c=require("./Components/A/index.js"),d=require("./Components/P/index.js"),p=require("./Components/Img/index.js"),h=require("./Components/Iframe/index.js"),m=require("./Components/Code/index.js"),x=require("./Components/Headings/index.js"),g=require("./Components/List/index.js"),f=require("./Components/Table/index.js"),b=require("./Components/Others/index.js"),j=require("./Components/Action/index.js"),C=require("../../../../common/cn.js");function q(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k=q(i),w=q(o),y=q(a),v=q(l),A=q(u);exports.PickaxeMarkdownRenderer=({className:i,style:o,children:a,value:l,maxLines:u,maxChars:q,multiLineBreaks:O,recursion:H,onExpandClick:P})=>{const{accentColor:S,rtl:M,disableHtml:$,disableJs:T,disableCss:_}=t.usePickaxeMarkdownContext(),[E,I]=n.useState({width:0,height:0}),[L,B]=n.useState(null),N=n.useRef(null),R=n.useMemo((()=>{if(!l)return"";let e=l.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),O&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[l,O]);n.useEffect((()=>{if(q)return void B(R.length>q?R.slice(0,q)+'<span class="pxe-expand-btn">...</span>':null);if(!u)return void B(null);if(!N.current||!R||L)return;const e=N.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=u*r;if(!(E.height>n))return;const t=Math.floor(E.width/8),s=Math.floor(t*u);B(R.slice(0,s)+'<span class="pxe-expand-btn">...</span>')}),[R,u,q,E,L]);const z={h1:x.H1,h2:x.H2,h3:x.H3,h4:x.H4,h5:x.H5,p:d.P,a:c.A,img:p.Img,iframe:h.Iframe,code:m.Code,ol:g.Ol,ul:g.Ul,li:g.Li,table:f.Table,th:f.Th,tr:f.Tr,td:f.Td,hr:b.Hr,br:b.Br,blockquote:b.Blockquote,span:n=>{var{children:t}=n,s=e.__rest(n,["children"]);return"pxe-expand-btn"===s.className?r.jsx("span",Object.assign({},s,{style:Object.assign({display:"inline",fontWeight:500,color:S,marginLeft:".25rem",userSelect:"none"},P&&{cursor:"pointer"})},P&&{onClick:P},{children:t})):r.jsx("span",Object.assign({},s,{children:t}))},ActionCaption:j.ActionCaption,ActionFinished:j.ActionFinished,ActionError:j.ActionError};n.useEffect((()=>{if(!N.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;I({width:e,height:n})}}));return e.observe(N.current),()=>{e.disconnect()}}),[]);const F=L||R;return r.jsxs("div",Object.assign({className:"pxe-markdown",ref:N,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},o)},M&&{dir:"rtl"},{children:[r.jsx(k.default,Object.assign({className:C.default(!H&&"pxe-prose",i),components:z,remarkPlugins:[w.default,[y.default,{singleDollarTextMath:!1}]],rehypePlugins:[s.rehypeCode,v.default,...$?[]:[A.default],[s.rehypeSanitize,{disableJs:T,disableCss:_}],s.rehypePickaxeAction]},{children:F})),a]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("unist-util-visit");const t=["action-caption","action-finished","action-error"],i=["ActionCaption","ActionFinished","ActionError"];exports.rehypePickaxeAction=()=>r=>(e.visit(r,"element",(e=>{const i=e.tagName;if(t.includes(i)){const t=i.split("-");e.tagName=t.map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(""),e.properties=e.properties||{}}})),e.visit(r,"element",((t,r,o)=>{if("p"===t.tagName){const s=t.children.filter((e=>"text"===e.type?""!==e.value.trim():"element"===e.type));if(1===s.length){const t=s[0];if("element"===t.type&&i.includes(t.tagName)&&o&&"children"in o&&o.children&&void 0!==r)return o.children.splice(r,1,t),[e.SKIP,r]}}})),r),exports.rehypeSanitize=(t={})=>i=>{e.visit(i,"element",((i,r,o)=>{if(t.disableJs){if("script"===i.tagName&&o&&"number"==typeof r)return o.children.splice(r,1),[e.SKIP,r];if(i.properties){["onclick","onload","onerror","onmouseover","onmouseout","onfocus","onblur"].forEach((e=>{i.properties[e]&&delete i.properties[e]})),i.properties.href&&"string"==typeof i.properties.href&&i.properties.href.toLowerCase().startsWith("javascript:")&&delete i.properties.href}}if(t.disableCss&&"style"===i.tagName&&o&&"number"==typeof r)return o.children.splice(r,1),[e.SKIP,r]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("unist-util-visit");const t=["action-caption","action-finished","action-error"],i=["ActionCaption","ActionFinished","ActionError"];exports.rehypeCode=()=>t=>{e.visit(t,"code",(e=>{var t;e.lang=null!==(t=e.lang)&&void 0!==t?t:"plaintext"}))},exports.rehypePickaxeAction=()=>r=>(e.visit(r,"element",(e=>{const i=e.tagName;if(t.includes(i)){const t=i.split("-");e.tagName=t.map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(""),e.properties=e.properties||{}}})),e.visit(r,"element",((t,r,o)=>{if("p"===t.tagName){const n=t.children.filter((e=>"text"===e.type?""!==e.value.trim():"element"===e.type));if(1===n.length){const t=n[0];if("element"===t.type&&i.includes(t.tagName)&&o&&"children"in o&&o.children&&void 0!==r)return o.children.splice(r,1,t),[e.SKIP,r]}}})),r),exports.rehypeSanitize=(t={})=>i=>{e.visit(i,"element",((i,r,o)=>{if(t.disableJs){if("script"===i.tagName&&o&&"number"==typeof r)return o.children.splice(r,1),[e.SKIP,r];if(i.properties){["onclick","onload","onerror","onmouseover","onmouseout","onfocus","onblur"].forEach((e=>{i.properties[e]&&delete i.properties[e]})),i.properties.href&&"string"==typeof i.properties.href&&i.properties.href.toLowerCase().startsWith("javascript:")&&delete i.properties.href}}if(t.disableCss&&"style"===i.tagName&&o&&"number"==typeof r)return o.children.splice(r,1),[e.SKIP,r]}))};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../common/cn.js");exports.default=({children:t,className:r,innerClassName:i,isLoaded:n=!1})=>{const{styles:c}=s.usePickaxeContext();return e.jsx("div",Object.assign({className:a.default("rounded-sm",!n&&"pxe-animate-pulse",n&&"pxe-animate-none",r),style:{backgroundColor:"dark"===c.theme?"#1E1E1F":"#E5E7EB"}},{children:e.jsx("div",Object.assign({className:a.default("pxe-flex pxe-items-center",!n&&"pxe-opacity-0",i)},{children:t}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../hooks/pickaxe/usePickaxe.js"),t=require("react"),a=require("../../hooks/pickaxe/usePickaxeContext.js"),l=require("../../hooks/pickaxe/useResponseContext.js"),r=require("./Addons/Document/hooks/useDocumentContext.js"),o=require("../../common/utils.js"),i=require("./Addons/Scroll/Provider.js"),n=require("../Core/Skeleton.js"),u=require("./Chat/index.js"),x=require("./Form/index.js"),c=require("../../common/cn.js");exports.Pickaxe=({formId:d,className:f})=>{const{chatId:p,styles:m,colors:j,responsiveBy:h,deploymentType:k,isNewChat:w,setFormId:g,setChatId:q,setSessionId:v,setPickaxe:C}=a.usePickaxeContext(),{setMessages:N,setResponse:b,setError:y,setLimitData:P,setStatus:I}=l.useResponseContext(),{setDocumentError:O}=r.useDocumentContext(),[D,E]=t.useState(!1),S=s.usePickaxe();return t.useEffect((()=>{g(d)}),[d]),t.useEffect((()=>{if(!S.data)return;const e=S.data.chatflag;q(e?o.generateId(15):""),v(o.generateId(15)),e?N([]):b(null),y(""),O(""),P(null),C(S.data),E(!0)}),[S.data]),t.useEffect((()=>{y(""),O(""),P(null),N([]),b(null),I("idle")}),[p]),S.data?e.jsx("div",Object.assign({className:c.default("relative @container/pickaxe-root flex flex-col flex-grow w-full",!k&&"h-full","popup"===k&&p&&"h-full","dark"===m.theme&&"dark",f),style:Object.assign({backgroundColor:"chat-input"===k&&w?"transparent":j.primary,color:j.text},m.font&&"Real Head Pro"!==m.font&&{fontFamily:m.font})},{children:S.isLoading||!D?e.jsx("div",Object.assign({className:c.default("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===h?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:e.jsxs("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e.jsx(n.default,{className:"w-[72px] h-[72px]"}),e.jsx(n.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(n.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(n.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e.jsx("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e.jsx(n.default,{className:c.default("w-full min-h-[48px]","viewport"===h?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e.jsx(e.Fragment,{children:p?e.jsx(i.default,{children:e.jsx(u.default,{})}):e.jsx(i.default,{children:e.jsx(x.default,{})})})})):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../hooks/pickaxe/usePickaxe.js"),t=require("react"),a=require("../../hooks/pickaxe/usePickaxeContext.js"),l=require("../../hooks/pickaxe/useResponseContext.js"),r=require("./Addons/Document/hooks/useDocumentContext.js"),o=require("../../common/utils.js"),i=require("./Addons/Scroll/Provider.js"),n=require("./common/PickaxeSkeleton.js"),x=require("./Chat/index.js"),c=require("./Form/index.js"),u=require("../../common/cn.js");exports.Pickaxe=({formId:d,className:f})=>{const{chatId:m,styles:p,colors:j,responsiveBy:h,deploymentType:k,isNewChat:w,setFormId:g,setChatId:q,setSessionId:v,setPickaxe:N}=a.usePickaxeContext(),{setMessages:b,setResponse:C,setError:P,setLimitData:y,setStatus:I}=l.useResponseContext(),{setDocumentError:O}=r.useDocumentContext(),[D,E]=t.useState(!1),S=s.usePickaxe();return t.useEffect((()=>{g(d)}),[d]),t.useEffect((()=>{if(!S.data)return;const e=S.data.chatflag;q(e?o.generateId(15):""),v(o.generateId(15)),e?b([]):C(null),P(""),O(""),y(null),N(S.data),E(!0)}),[S.data]),t.useEffect((()=>{P(""),O(""),y(null),b([]),C(null),I("idle")}),[m]),S.data?e.jsx("div",Object.assign({className:u.default("relative @container/pickaxe-root flex flex-col flex-grow w-full",!k&&"h-full","popup"===k&&m&&"h-full","dark"===p.theme&&"dark",f),style:Object.assign({backgroundColor:"chat-input"===k&&w?"transparent":j.primary,color:j.text},p.font&&"Real Head Pro"!==p.font&&{fontFamily:p.font})},{children:S.isLoading||!D?e.jsx("div",Object.assign({className:u.default("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===h?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:e.jsxs("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e.jsx(n.default,{className:"w-[72px] h-[72px]"}),e.jsx(n.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(n.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(n.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e.jsx("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e.jsx(n.default,{className:u.default("w-full min-h-[48px]","viewport"===h?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e.jsx(e.Fragment,{children:m?e.jsx(i.default,{children:e.jsx(x.default,{})}):e.jsx(i.default,{children:e.jsx(c.default,{})})})})):null};
@@ -3,5 +3,5 @@ interface PickaxeCompactHeadProps {
3
3
  iconClassName?: string;
4
4
  onIconClick?: () => void;
5
5
  }
6
- declare const PickaxeCompactHead: ({ className, iconClassName, onIconClick, }: PickaxeCompactHeadProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const PickaxeCompactHead: ({ className, iconClassName, onIconClick, }: PickaxeCompactHeadProps) => import("react/jsx-runtime").JSX.Element | null;
7
7
  export default PickaxeCompactHead;
@@ -0,0 +1,7 @@
1
+ interface IframeVideoProps {
2
+ title: string;
3
+ src: string;
4
+ fallback?: string;
5
+ }
6
+ declare const IframeVideo: ({ title, src, fallback, }: IframeVideoProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default IframeVideo;
@@ -3,3 +3,4 @@ export declare const rehypeSanitize: (options?: {
3
3
  disableJs?: boolean;
4
4
  disableCss?: boolean;
5
5
  }) => (tree: any) => void;
6
+ export declare const rehypeCode: () => (tree: any) => void;
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from "react";
2
+ interface PickaxeSkeletonProps {
3
+ children?: ReactNode;
4
+ className?: string;
5
+ innerClassName?: string;
6
+ isLoaded?: boolean;
7
+ }
8
+ declare const PickaxeSkeleton: ({ children, className, innerClassName, isLoaded, }: PickaxeSkeletonProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default PickaxeSkeleton;
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as o}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{forwardRef as n,useContext as s}from"react";import{MenuContext as r}from"./index.js";import a from"../../Icons/chevron-down.svg.js";import l from"../../../common/cn.js";const c=n(((n,c)=>{var{children:m,variant:d="default",isDisabled:p=!1,style:u,className:v,anchorClassName:f}=n,h=e(n,["children","variant","isDisabled","style","className","anchorClassName"]);const{id:j,isOpen:g,setIsOpen:C}=s(r);return"anchor"===d?t("div",Object.assign({ref:c,id:j},h,{className:l("flex cursor-pointer items-center gap-2",v),style:Object.assign({cursor:p?"not-allowed":"pointer",pointerEvents:p?"none":"auto"},u),onClick:e=>o(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),e.preventDefault(),!p){if(h.onClick)return h.onClick(e),void C(!g);C(!g),yield new Promise((e=>setTimeout(e,100)))}}))},{children:[m,i(a,{className:l("duration:300 h-5 w-5 shrink-0 rotate-0 transition-rotate",g&&"rotate-180",f)})]})):i("div",Object.assign({ref:c,id:j},h,{className:l("flex items-center",v),style:Object.assign({cursor:p?"not-allowed":"pointer",pointerEvents:p?"none":"auto"},u),onClick:e=>o(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),p||(h.onClick?h.onClick(e):(C(!g),yield new Promise((e=>setTimeout(e,100)))))}))},{children:m}))}));c.displayName="MenuButton";export{c as default};
1
+ import{__rest as e,__awaiter as o}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as i}from"react/jsx-runtime";import{forwardRef as n,useContext as s}from"react";import{MenuContext as r}from"./index.js";import a from"../../Icons/chevron-down.svg.js";import l from"../../../common/cn.js";const c=n(((n,c)=>{var{children:m,variant:d="default",isDisabled:p=!1,style:u,className:v,anchorClassName:f}=n,h=e(n,["children","variant","isDisabled","style","className","anchorClassName"]);const{id:j,isOpen:g,setIsOpen:C}=s(r);return"anchor"===d?t("div",Object.assign({ref:c,id:j},h,{className:l("flex cursor-pointer items-center gap-2",v),style:Object.assign({cursor:p?"not-allowed":"pointer",pointerEvents:p?"none":"auto"},u),onClick:e=>o(void 0,void 0,void 0,(function*(){if(e.stopPropagation(),e.preventDefault(),!p){if(h.onClick)return h.onClick(e),void C(!g);C(!g),yield new Promise((e=>setTimeout(e,100)))}}))},{children:[m,i(a,{className:l("duration-300 h-5 w-5 shrink-0 rotate-0 transition-rotate",g&&"rotate-180",f)})]})):i("div",Object.assign({ref:c,id:j},h,{className:l("flex items-center",v),style:Object.assign({cursor:p?"not-allowed":"pointer",pointerEvents:p?"none":"auto"},u),onClick:e=>o(void 0,void 0,void 0,(function*(){e.stopPropagation(),e.preventDefault(),p||(h.onClick?h.onClick(e):(C(!g),yield new Promise((e=>setTimeout(e,100)))))}))},{children:m}))}));c.displayName="MenuButton";export{c as default};
@@ -1 +1 @@
1
- import{__rest as i}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../hooks/pickaxe/usePickaxeContext.js";import{QueryClient as o,QueryClientProvider as r}from"@tanstack/react-query";import{Pickaxe as n}from"../Pickaxe/index.js";import{PickaxeProvider as s}from"../Pickaxe/Provider.js";import a from"../../common/cn.js";const l=new o({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),d=t=>{var{formId:o,className:a}=t,d=i(t,["formId","className"]);return e(r,Object.assign({client:l},{children:e(s,Object.assign({},d,{deploymentType:"chat-input",isEmbed:!0},{children:e(h,{children:e(n,Object.assign({formId:o},a&&{className:a}))})}))}))},h=({children:i})=>{var o;const{styles:r,deploymentDimensions:n,isNewChat:s,isDropShadow:l}=t();return e("div",Object.assign({className:a("relative top-0 flex w-full flex-col transition-all",l&&"shadow-embed",!s&&"overflow-y-auto overflow-x-hidden scrollbar scrollbar-thin"),style:Object.assign(Object.assign({borderRadius:null!==(o=null==r?void 0:r.cornerRadius)&&void 0!==o?o:0},"px"===(null==n?void 0:n.width.unit)?{width:n.width.value+n.width.unit}:"%"===(null==n?void 0:n.width.unit)?{width:"100%",maxWidth:n.maxWidth+"px"}:{}),s?{height:58}:"px"===(null==n?void 0:n.height.unit)?{height:n.height.value+"px"}:"auto"===(null==n?void 0:n.height.unit)?{minHeight:n.minHeight+"px",maxHeight:n.maxHeight+"px"}:{})},{children:i}))};export{d as ChatInput,h as ChatInputWrapper};
1
+ import{__rest as i}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../hooks/pickaxe/usePickaxeContext.js";import{QueryClient as o,QueryClientProvider as n}from"@tanstack/react-query";import{Pickaxe as r}from"../Pickaxe/index.js";import{PickaxeProvider as s}from"../Pickaxe/Provider.js";import a from"../../common/cn.js";const l=new o({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),d=t=>{var{formId:o,className:a}=t,d=i(t,["formId","className"]);return e(n,Object.assign({client:l},{children:e(s,Object.assign({},d,{deploymentType:"chat-input",isEmbed:!0},{children:e(m,{children:e(r,Object.assign({formId:o},a&&{className:a}))})}))}))},m=({children:i})=>{var o;const{styles:n,deploymentDimensions:r,isNewChat:s,isDropShadow:l}=t();return e("div",Object.assign({className:a("relative top-0 flex w-full flex-col transition-all",l&&"shadow-embed",!s&&"overflow-y-auto overflow-x-hidden"),style:Object.assign(Object.assign({borderRadius:null!==(o=null==n?void 0:n.cornerRadius)&&void 0!==o?o:0},"px"===(null==r?void 0:r.width.unit)?{width:r.width.value+r.width.unit}:"%"===(null==r?void 0:r.width.unit)?{width:"100%",maxWidth:r.maxWidth+"px"}:{}),s?{height:58}:"px"===(null==r?void 0:r.height.unit)?{height:r.height.value+"px"}:"auto"===(null==r?void 0:r.height.unit)?{minHeight:r.minHeight+"px",maxHeight:r.maxHeight+"px"}:{})},{children:i}))};export{d as ChatInput,m as ChatInputWrapper};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as i}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as s,useEffect as o}from"react";import{usePickaxeContext as a}from"../../hooks/pickaxe/usePickaxeContext.js";import{QueryClient as r,QueryClientProvider as c}from"@tanstack/react-query";import{Pickaxe as l}from"../Pickaxe/index.js";import{PickaxeProvider as d}from"../Pickaxe/Provider.js";import{AnimatePresence as m,motion as h}from"framer-motion";import u from"../Icons/pickaxe.svg.js";import p from"../Icons/spark.svg.js";import g from"../Icons/x.svg.js";import b from"../../common/cn.js";const f=new r({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),x=i=>{var a,r,u,p,{formId:g,className:x}=i,w=e(i,["formId","className"]);const[y,j]=s(!1),[k,O]=s({}),I=()=>{const e=w.deploymentDimensions;if(!e)return;const i={value:e.width.value,unit:e.width.unit},t=e.maxWidth,n={value:e.height.value,unit:e.height.unit},s=e.minHeight,o=e.maxHeight,a=window.innerHeight-150,r=window.innerWidth-40;let c=0;c="px"===n.unit?n.value:o;let l=Math.min(c,a);l=Math.max(l,s,100),l=Math.min(l,a);let d=0;d="px"===i.unit?i.value:t;let m=Math.min(d,r,t);m=Math.max(m,150),m=Math.min(m,r);O({width:"%"===i.unit?i.value+"%":m+"px",minWidth:150,maxWidth:m,height:"auto"===n.unit?n.value:l+"px",minHeight:100,maxHeight:l})};return o((()=>(I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I))),[w.deploymentDimensions]),t(c,Object.assign({client:f},{children:t(d,Object.assign({},w,{deploymentType:"fab",isEmbed:!0},{children:n(m,{children:[y&&t(h.div,Object.assign({initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.1},className:b("transition-h absolute z-50 flex flex-col overflow-hidden bg-transparent",w.isDropShadow&&"shadow-embed"),style:Object.assign({transformOrigin:"bottom right",borderRadius:null!==(r=null===(a=w.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==r?r:0,bottom:100,right:20},k)},{children:t("div",Object.assign({className:"flex flex-col overflow-auto h-full scrollbar scrollbar-thin dark:bg-black",style:{borderRadius:null!==(p=null===(u=w.styles)||void 0===u?void 0:u.cornerRadius)&&void 0!==p?p:0}},{children:t(l,Object.assign({formId:g},x&&{className:x}))}))}),"fab-content"),t(v,{isOpen:y,setIsOpen:j})]})}))}))},v=({isOpen:e,setIsOpen:n})=>{const{colors:r,deploymentMisc:c}=a(),[l,d]=s({src:"",isLarge:!1}),[m,h]=s(!0);return o((()=>{i(void 0,void 0,void 0,(function*(){try{if(!(null==c?void 0:c.fabImage))return;h(!0);const e=new Image;e.src=c.fabImage,yield e.decode();const i=e.width>200;d({src:c.fabImage,isLarge:i})}catch(e){console.error("[pxe] error loading FAB image:",e),d({src:"",isLarge:!1})}finally{h(!1)}}))}),[null==c?void 0:c.fabImage]),m?null:t("button",Object.assign({className:"absolute z-50 flex h-[60px] w-[60px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-white dark:bg-black",style:{boxShadow:"0px 6px 6px rgba(0, 0, 0, 0.12)",background:r.primary,color:r.text,bottom:20,right:20},onClick:()=>n(!e)},{children:t(w,e?Object.assign({id:"close-btn"},{children:t(g,{className:"shrink-0 select-none",style:{width:28,height:28}})}):Object.assign({id:"open-btn"},{children:l.src===`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}/builder/assets/images/pickaxe-chaticons/chaticon2.png`?t(p,{className:"h-6 w-6 shrink-0 select-none"}):l.src?t("img",{src:l.src,alt:"FAB Icon",width:l.isLarge?60:24,height:l.isLarge?60:24,className:"select-none"}):t(u,{className:"h-6 w-6 shrink-0 select-none"})}))}))},w=({id:e,children:i})=>t(h.div,Object.assign({initial:{opacity:0,rotate:-10},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:10},transition:{duration:.3}},{children:i}),e);export{x as FAB,v as FABButton};
1
+ import{__rest as e,__awaiter as i}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as s,useEffect as o}from"react";import{usePickaxeContext as a}from"../../hooks/pickaxe/usePickaxeContext.js";import{QueryClient as r,QueryClientProvider as c}from"@tanstack/react-query";import{Pickaxe as l}from"../Pickaxe/index.js";import{PickaxeProvider as m}from"../Pickaxe/Provider.js";import{AnimatePresence as d,motion as h}from"framer-motion";import p from"../Icons/pickaxe.svg.js";import u from"../Icons/spark.svg.js";import g from"../Icons/x.svg.js";import f from"../../common/cn.js";const x=new r({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),b=i=>{var a,r,p,u,{formId:g,className:b}=i,w=e(i,["formId","className"]);const[y,j]=s(!1),[O,I]=s({}),k=()=>{const e=w.deploymentDimensions;if(!e)return;const i={value:e.width.value,unit:e.width.unit},t=e.maxWidth,n={value:e.height.value,unit:e.height.unit},s=e.minHeight,o=e.maxHeight,a=window.innerHeight-150,r=window.innerWidth-40;let c=0;c="px"===n.unit?n.value:o;let l=Math.min(c,a);l=Math.max(l,s,100),l=Math.min(l,a);let m=0;m="px"===i.unit?i.value:t;let d=Math.min(m,r,t);d=Math.max(d,150),d=Math.min(d,r);I({width:"%"===i.unit?i.value+"%":d+"px",minWidth:150,maxWidth:d,height:"auto"===n.unit?n.value:l+"px",minHeight:100,maxHeight:l})};return o((()=>(k(),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k))),[w.deploymentDimensions]),t(c,Object.assign({client:x},{children:t(m,Object.assign({},w,{deploymentType:"fab",isEmbed:!0},{children:n(d,{children:[y&&t(h.div,Object.assign({initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.1},className:f("transition-h absolute z-50 flex flex-col overflow-hidden bg-transparent",w.isDropShadow&&"shadow-embed"),style:Object.assign({transformOrigin:"bottom right",borderRadius:null!==(r=null===(a=w.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==r?r:0,bottom:100,right:20},O)},{children:t("div",Object.assign({className:"flex flex-col overflow-auto h-full",style:{borderRadius:null!==(u=null===(p=w.styles)||void 0===p?void 0:p.cornerRadius)&&void 0!==u?u:0}},{children:t(l,Object.assign({formId:g},b&&{className:b}))}))}),"fab-content"),t(v,{isOpen:y,setIsOpen:j})]})}))}))},v=({isOpen:e,setIsOpen:n})=>{const{colors:r,deploymentMisc:c}=a(),[l,m]=s({src:"",isLarge:!1}),[d,h]=s(!0);return o((()=>{i(void 0,void 0,void 0,(function*(){try{if(!(null==c?void 0:c.fabImage))return;h(!0);const e=new Image;e.src=c.fabImage,yield e.decode();const i=e.width>200;m({src:c.fabImage,isLarge:i})}catch(e){console.error("[pxe] error loading FAB image:",e),m({src:"",isLarge:!1})}finally{h(!1)}}))}),[null==c?void 0:c.fabImage]),d?null:t("button",Object.assign({className:"absolute z-50 flex h-[60px] w-[60px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-white dark:bg-black",style:{boxShadow:"0px 6px 6px rgba(0, 0, 0, 0.12)",background:r.primary,color:r.text,bottom:20,right:20},onClick:()=>n(!e)},{children:t(w,e?Object.assign({id:"close-btn"},{children:t(g,{className:"w-[28px] h-[28px] shrink-0 select-none"})}):Object.assign({id:"open-btn"},{children:l.src===`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}/builder/assets/images/pickaxe-chaticons/chaticon2.png`?t(u,{className:"h-6 w-6 shrink-0 select-none"}):l.src?t("img",{src:l.src,alt:"FAB Icon",width:l.isLarge?60:24,height:l.isLarge?60:24,className:"select-none"}):t(p,{className:"h-6 w-6 shrink-0 select-none"})}))}))},w=({id:e,children:i})=>t(h.div,Object.assign({initial:{opacity:0,rotate:-10},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:10},transition:{duration:.3}},{children:i}),e);export{b as FAB,v as FABButton};
@@ -1 +1 @@
1
- import{__rest as i}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{QueryClient as n,QueryClientProvider as o}from"@tanstack/react-query";import{Pickaxe as t}from"../Pickaxe/index.js";import{PickaxeProvider as s}from"../Pickaxe/Provider.js";import l from"../../common/cn.js";const m=new n({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),d=n=>{var d,r,a,c,h,p,{formId:u,className:v}=n,x=i(n,["formId","className"]);return e(o,Object.assign({client:m},{children:e(s,Object.assign({},x,{deploymentType:"inline",isEmbed:!0},{children:e("div",Object.assign({className:l("relative top-0 flex w-full flex-col overflow-y-auto overflow-x-hidden transition-all scrollbar scrollbar-thin",x.isDropShadow&&"shadow-embed"),style:Object.assign(Object.assign({borderRadius:null!==(r=null===(d=x.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==r?r:0},"px"===(null===(a=x.deploymentDimensions)||void 0===a?void 0:a.width.unit)?{width:x.deploymentDimensions.width.value+x.deploymentDimensions.width.unit}:"%"===(null===(c=x.deploymentDimensions)||void 0===c?void 0:c.width.unit)?{width:"100%",maxWidth:x.deploymentDimensions.maxWidth+"px"}:{}),"px"===(null===(h=x.deploymentDimensions)||void 0===h?void 0:h.height.unit)?{height:x.deploymentDimensions.height.value+"px"}:"auto"===(null===(p=x.deploymentDimensions)||void 0===p?void 0:p.height.unit)?{minHeight:x.deploymentDimensions.minHeight+"px",maxHeight:x.deploymentDimensions.maxHeight+"px"}:{})},{children:e(t,Object.assign({formId:u},v&&{className:v}))}))}))}))};export{d as Inline};
1
+ import{__rest as i}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{QueryClient as n,QueryClientProvider as o}from"@tanstack/react-query";import{Pickaxe as t}from"../Pickaxe/index.js";import{PickaxeProvider as s}from"../Pickaxe/Provider.js";import m from"../../common/cn.js";const d=new n({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),l=n=>{var l,r,a,p,h,c,{formId:u,className:v}=n,x=i(n,["formId","className"]);return e(o,Object.assign({client:d},{children:e(s,Object.assign({},x,{deploymentType:"inline",isEmbed:!0},{children:e("div",Object.assign({className:m("relative top-0 flex w-full flex-col overflow-y-auto overflow-x-hidden transition-all",x.isDropShadow&&"shadow-embed"),style:Object.assign(Object.assign({borderRadius:null!==(r=null===(l=x.styles)||void 0===l?void 0:l.cornerRadius)&&void 0!==r?r:0},"px"===(null===(a=x.deploymentDimensions)||void 0===a?void 0:a.width.unit)?{width:x.deploymentDimensions.width.value+x.deploymentDimensions.width.unit}:"%"===(null===(p=x.deploymentDimensions)||void 0===p?void 0:p.width.unit)?{width:"100%",maxWidth:x.deploymentDimensions.maxWidth+"px"}:{}),"px"===(null===(h=x.deploymentDimensions)||void 0===h?void 0:h.height.unit)?{height:x.deploymentDimensions.height.value+"px"}:"auto"===(null===(c=x.deploymentDimensions)||void 0===c?void 0:c.height.unit)?{minHeight:x.deploymentDimensions.minHeight+"px",maxHeight:x.deploymentDimensions.maxHeight+"px"}:{})},{children:e(t,Object.assign({formId:u},v&&{className:v}))}))}))}))};export{l as Inline};
@@ -1 +1 @@
1
- import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as n}from"../../hooks/pickaxe/usePickaxeContext.js";import{useInstantPickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useStyleFontSize as l}from"../../hooks/studio/useStyleFontSize.js";import{QueryClient as a,QueryClientProvider as r}from"@tanstack/react-query";import{Pickaxe as d}from"../Pickaxe/index.js";import{PickaxeProvider as m}from"../Pickaxe/Provider.js";import c from"../Icons/x.svg.js";import p from"../Core/Modal/index.js";import u from"../Core/Modal/Body.js";import h from"../../common/cn.js";const f=new a({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),v=n=>{var s,l,a,v,b,y,g,j,O,{formId:w,className:k}=n,D=e(n,["formId","className"]);const[N,R]=t(!1);return o(r,Object.assign({client:f},{children:i(m,Object.assign({},D,{deploymentType:"popup",isEmbed:!0},{children:[o(x,{formId:w,setIsOpen:R}),o(p,Object.assign({isOpen:N,onChange:()=>R(!1)},{children:i(u,Object.assign({className:h("relative bg-transparent overflow-hidden",D.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(l=null===(s=D.styles)||void 0===s?void 0:s.cornerRadius)&&void 0!==l?l:0)+"px"}},{children:[o("div",Object.assign({className:"overflow-auto scrollbar scrollbar-thin",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(a=D.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(b=D.deploymentDimensions)||void 0===b?void 0:b.width.unit)?{width:D.deploymentDimensions.width.value+D.deploymentDimensions.width.unit}:"%"===(null===(y=D.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(D.deploymentDimensions.maxWidth*(D.deploymentDimensions.width.value/100))}:{}),"px"===(null===(g=D.deploymentDimensions)||void 0===g?void 0:g.height.unit)?{height:D.deploymentDimensions.height.value+"px"}:"auto"===(null===(j=D.deploymentDimensions)||void 0===j?void 0:j.height.unit)?{height:D.deploymentDimensions.minHeight+"px",maxHeight:D.deploymentDimensions.maxHeight+"px"}:{})},{children:o(d,Object.assign({formId:w},k&&{className:k}))})),o("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>R(!1),style:{right:12,top:12,color:(null===(O=D.colors)||void 0===O?void 0:O.text)||"#000"}},{children:o(c,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},x=({formId:e,setIsOpen:i})=>{var t;const{colors:a,styles:r,deploymentDimensions:d,deploymentMisc:m}=n(),c=l(),p=s(e);return p.isLoading?null:o("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==r.font&&{fontFamily:r.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:r.cornerRadius+"px",borderWidth:r.outlineThickness+"px",maxWidth:"%"===(null==d?void 0:d.width.unit)?(null==d?void 0:d.maxWidth)+"px":(null==d?void 0:d.width.value)+"px",minHeight:48}),"Real Head Pro"!==r.font&&{fontFamily:r.font}),className:h(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>i(!0)},{children:o("p",Object.assign({className:h(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==r.font&&{fontFamily:r.font})},{children:(null==m?void 0:m.popupText)||(null===(t=p.data)||void 0===t?void 0:t.formtitle)||"Open Tool"}))}))};export{v as Popup,x as PopupCTAButton};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as n}from"../../hooks/pickaxe/usePickaxeContext.js";import{useInstantPickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useStyleFontSize as l}from"../../hooks/studio/useStyleFontSize.js";import{QueryClient as a,QueryClientProvider as d}from"@tanstack/react-query";import{Pickaxe as r}from"../Pickaxe/index.js";import{PickaxeProvider as m}from"../Pickaxe/Provider.js";import c from"../Icons/x.svg.js";import p from"../Core/Modal/index.js";import u from"../Core/Modal/Body.js";import h from"../../common/cn.js";const f=new a({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),v=n=>{var s,l,a,v,b,y,g,j,O,{formId:w,className:k}=n,D=e(n,["formId","className"]);const[N,R]=t(!1);return o(d,Object.assign({client:f},{children:i(m,Object.assign({},D,{deploymentType:"popup",isEmbed:!0},{children:[o(x,{formId:w,setIsOpen:R}),o(p,Object.assign({isOpen:N,onChange:()=>R(!1)},{children:i(u,Object.assign({className:h("relative bg-transparent overflow-hidden",D.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(l=null===(s=D.styles)||void 0===s?void 0:s.cornerRadius)&&void 0!==l?l:0)+"px"}},{children:[o("div",Object.assign({className:"overflow-auto",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(a=D.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(b=D.deploymentDimensions)||void 0===b?void 0:b.width.unit)?{width:D.deploymentDimensions.width.value+D.deploymentDimensions.width.unit}:"%"===(null===(y=D.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(D.deploymentDimensions.maxWidth*(D.deploymentDimensions.width.value/100))}:{}),"px"===(null===(g=D.deploymentDimensions)||void 0===g?void 0:g.height.unit)?{height:D.deploymentDimensions.height.value+"px"}:"auto"===(null===(j=D.deploymentDimensions)||void 0===j?void 0:j.height.unit)?{height:D.deploymentDimensions.minHeight+"px",maxHeight:D.deploymentDimensions.maxHeight+"px"}:{})},{children:o(r,Object.assign({formId:w},k&&{className:k}))})),o("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>R(!1),style:{right:12,top:12,color:(null===(O=D.colors)||void 0===O?void 0:O.text)||"#000"}},{children:o(c,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},x=({formId:e,setIsOpen:i})=>{var t;const{colors:a,styles:d,deploymentDimensions:r,deploymentMisc:m}=n(),c=l(),p=s(e);return p.isLoading?null:o("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==d.font&&{fontFamily:d.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:d.cornerRadius+"px",borderWidth:d.outlineThickness+"px",maxWidth:"%"===(null==r?void 0:r.width.unit)?(null==r?void 0:r.maxWidth)+"px":(null==r?void 0:r.width.value)+"px",minHeight:48}),"Real Head Pro"!==d.font&&{fontFamily:d.font}),className:h(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>i(!0)},{children:o("p",Object.assign({className:h(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==d.font&&{fontFamily:d.font})},{children:(null==m?void 0:m.popupText)||(null===(t=p.data)||void 0===t?void 0:t.formtitle)||"Open Tool"}))}))};export{v as Popup,x as PopupCTAButton};
@@ -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 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:E}=o(),{scrollContainerRef:L}=l(),{messages:A,status:H,limitData:D,error:R}=t(),{height:$}=i(),z=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!z),[w,b.isSuccess,S,z]),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:L,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${$}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",maxDescriptionChars:500,onIconClick:()=>E("")}),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:()=>E("")}),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?e("div",Object.assign({className:j("flex w-full",I?"justify-end":"justify-start")},{children:e("div",Object.assign({className:"flex flex-col"},{children:s("div",Object.assign({className:j("flex gap-x-3",I&&"flex-row-reverse")},{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:"my-3 h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-2"},{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)))}))]}))}))})):D?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(u,{})})):R?e("div",Object.assign({className:j("flex items-center gap-x-3",I?"justify-end":"justify-start")},{children:e(m,{error:R})})):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"../../../Core/ErrorAlert.js";import m from"../../common/PickaxeHead.js";import d from"../../common/PickaxeCompactHead.js";import p from"../../common/PickaxeUpgradeCard.js";import f from"../../common/PickaxeIcon.js";import x from"../../common/PickaxeBranding.js";import u from"../../common/PickaxeSkeleton.js";import h from"../../Addons/Scroll/ScrollLockView.js";import g from"./Message.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:E}=o(),{scrollContainerRef:L}=l(),{messages:A,status:H,limitData:D,error:R}=t(),{height:$}=i(),z=a((()=>!!b.data&&!(b.data.messages.length<=1)),[b.data]),F=a((()=>!w&&b.isSuccess&&S&&!z),[w,b.isSuccess,S,z]),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:L,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${$}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(x,{className:j("absolute top-4 right-4",!F&&!P&&"top-2"),animateHover:!0}),e(m,{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",maxDescriptionChars:500,onIconClick:()=>E("")}),P&&!b.isLoading&&e(d,{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:()=>E("")}),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(u,{className:"w-[72px] h-[72px]"}),e(u,{className:"h-[20px] mt-6 w-full"}),e(u,{className:"h-[20px] mt-2 w-full"}),e(u,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e(u,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e(u,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e(u,{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(g,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),A.map(((s,a)=>e(g,{index:b.data.messages.length+a,message:s},a))),"fetching"===H||B?e("div",Object.assign({className:j("flex w-full",I?"justify-end":"justify-start")},{children:e("div",Object.assign({className:"flex flex-col"},{children:s("div",Object.assign({className:j("flex gap-x-3",I&&"flex-row-reverse")},{children:["NONE"!==(null==y?void 0:y.chaticon)&&e(f,{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:"my-3 h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-2"},{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)))}))]}))}))})):D?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e(p,{})})):R?e("div",Object.assign({className:j("flex items-center gap-x-3",I?"justify-end":"justify-start")},{children:e(c,{error:R})})):null]})),e(h,{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 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"../../Core/ErrorAlert.js";import A from"../../../common/error.js";import T from"../../../common/cn.js";const D=({isFocused:D,onFocus:B,onBlur:E})=>{var U;const{formId:F,chatId:H,userId:z,studioUserId:L,embedUserId:$,deploymentId:G,deploymentType:J,pickaxe:K,styles:P,colors:W,responsiveBy:_,isNewChat:M,isRtl:q,setIsNewChat:Q,setIsShowIceBreaker:V,onGenerateComplete:X}=c(),{messages:Y,status:Z,limits:ee,isGenerating:te,setMessages:se,setStatus:oe,setLimitData:re,setError:ie}=d(),{documents:ne,isUploading:le,isImageUploadAllowed:ae,documentError:ce,onFileUpload:de,setDocuments:ue,setDocumentError:me,removeDocument:pe}=h(),{scrollStartSession:fe,scrollEndSession:he,scrollToBottom:ge}=g({auto:!0}),be=p(),ve=f(),[xe,ye]=r(""),je=i(null),ke=b(),{isHover:we}=ke,Ne=e(ke,["isHover"]),Ie=b(),{isHover:Oe}=Ie,Ce=e(Ie,["isHover"]),Se=m(),Re=u(),Ae=n((()=>{var e,t,s;return!!M&&(!!K&&(!be.isLoading&&(!((null!==(t=null===(e=be.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=K.icebreakers)||void 0===s?void 0:s.length))))}),[K,M,be.data,be.isLoading]),Te=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==Z||le)return;const t=null!=e?e:xe;if(!t)return;ie(""),me(""),re(null),ye(""),Q(!1),oe("fetching"),fe(),ge();const s=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),o="enduserupload"===(null==K?void 0:K.documentuploadtype)&&s.length>0,r=[...Array.from(Y),Object.assign({id:Y.length+1,role:"user",content:t},o&&{documentIds:s})];se(r),ge(),o&&ue([]);const i=(yield ve.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,value:t},o&&{documentIds:s}),z&&{userId:z}),L&&{studioUserId:L}),$&&{embedUserId:$}),G&&{deploymentId:G}))).body;if(!i)throw new Error("Streaming error");const n=r.length,l=new TextDecoder,a=i.getReader();let c="",d=!0,u=!1;const m=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=t,se([...r.slice(0,n),{id:Y.length+1,role:"assistant",content:c}])}else if("error"===e.event){const t=JSON.parse(e.data);ie(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(d=!1)}});for(;d;){const{value:e,done:t}=yield a.read();if(t){d=!1;break}const s=l.decode(e);s&&(u||(oe("streaming"),u=!0),m.feed(s))}null==X||X(H)}catch(e){let t=A(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(ee).find((([e])=>t.includes(e)));s?re(s[1]):ie(t)}finally{ge(),oe("idle"),he()}}));return l((()=>{V(Ae)}),[Ae]),s("div",Object.assign({className:T("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===J&&M)&&"px-4 pb-4"),dir:q?"rtl":"ltr"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===J&&M)&&s("div",Object.assign({className:T("absolute bottom-full",q?"left-0":"right-0")},{children:s("div",Object.assign({className:T("flex flex-col gap-2 pb-4 px-2",q?"justify-start":"justify-end","viewport"===_?q?"min-[767px]:items-start":"min-[767px]:items-end":q?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:Ae&&!D&&s(C,{data:(null==K?void 0:K.icebreakers)||[],onSend:Te})}))})),o("div",Object.assign({className:T("flex flex-col gap-y-2 px-4 py-3","block"===P.formFieldStyle&&"shadow"),style:Re},{children:["idle"===Z&&ne.length>0&&s("div",Object.assign({className:"flex flex-row gap-2 flex-wrap"},{children:ne.filter((e=>"failed"!==e.status)).map((e=>{var t,r,i;return s(a,{children:"document"===e.type?o("div",Object.assign({className:T("relative gap-x-[10px] flex items-center px-2 h-[56px] border",q&&"flex-row-reverse"),style:{borderRadius:Re.borderRadius,borderColor:W.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:W.accent,borderRadius:Re.borderRadius}},{children:le?s(w,{className:"w-5 h-5 animate-spin",style:{color:W.accentText}}):s(N,{className:"w-5 h-5",style:{color:W.accentText}})})),o("div",Object.assign({className:T("flex flex-col justify-center truncate",q?"text-right items-end":"text-left items-start")},{children:[s("p",Object.assign({className:(T(Se.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:T(Se.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",q?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:W.accent,borderColor:Re.backgroundColor},disabled:le||"idle"!==Z,onClick:()=>pe(e.id)},{children:s(I,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Re.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:Re.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:Re.borderRadius,backgroundColor:W.secondary}}),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",q?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:W.accent,borderColor:Re.backgroundColor},disabled:le||"idle"!==Z,onClick:()=>pe(e.id)},{children:s(I,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:T("flex items-end gap-x-2",q&&"flex-row-reverse")},{children:[s(S,Object.assign({className:T(Se.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",q?"text-right":"text-left"),value:xe,placeholder:q?"بماذا تريد أن تتحدث؟":null!==(U=null==K?void 0:K.placeholdertext)&&void 0!==U?U:"What do you want to talk about?",onChange:e=>ye(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),le||"idle"!==Z||Te()))}},B&&{onFocus:B},E&&{onBlur:E},{dir:q?"rtl":"ltr"})),o("div",Object.assign({className:T("flex items-center gap-x-2")},{children:["enduserupload"===(null==K?void 0:K.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:Oe?W.accent+"10":void 0},disabled:le||"idle"!==Z,onClick:()=>{var e;return null===(e=je.current)||void 0===e?void 0:e.click()}},Ce,{children:[s("input",{id:"file-upload",ref:je,type:"file",accept:[...x,...ae?y:[]].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){Q(!1),yield de(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:Oe?W.accent:W.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:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!te?W.accent:W.accent+"10"},disabled:le||"idle"!==Z,onClick:()=>Te()},Ne,{children:s(O,{className:T("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",q&&"transform scale-x-[-1]"),style:{color:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!te?W.accentText:W.accent+"80"}})}))]}))]}))]})),ce&&s(R,{error:ce,className:"mt-3"})]}))}))};export{D 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"../../Core/ErrorAlert.js";import A from"../../../common/error.js";import T from"../../../common/cn.js";const D=({isFocused:D,onFocus:B,onBlur:E})=>{var U;const{formId:F,chatId:H,userId:z,studioUserId:L,embedUserId:$,deploymentId:G,deploymentType:J,pickaxe:K,styles:P,colors:W,responsiveBy:_,isNewChat:M,isRtl:q,setIsNewChat:Q,setIsShowIceBreaker:V,onGenerateComplete:X}=c(),{messages:Y,status:Z,limits:ee,isGenerating:te,setMessages:se,setStatus:oe,setLimitData:re,setError:ie}=d(),{documents:ne,isUploading:le,isImageUploadAllowed:ae,documentError:ce,onFileUpload:de,setDocuments:ue,setDocumentError:me,removeDocument:pe}=h(),{scrollStartSession:fe,scrollEndSession:he,scrollToBottom:ge}=g({auto:!0}),be=p(),ve=f(),[xe,ye]=r(""),je=i(null),ke=b(),{isHover:we}=ke,Ne=e(ke,["isHover"]),Ie=b(),{isHover:Oe}=Ie,Ce=e(Ie,["isHover"]),Se=m(),Re=u(),Ae=n((()=>{var e,t,s;return!!M&&(!!K&&(!be.isLoading&&(!((null!==(t=null===(e=be.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=K.icebreakers)||void 0===s?void 0:s.length))))}),[K,M,be.data,be.isLoading]),Te=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==Z||le)return;const t=null!=e?e:xe;if(!t)return;ie(""),me(""),re(null),ye(""),Q(!1),oe("fetching"),fe(),ge();const s=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),o="enduserupload"===(null==K?void 0:K.documentuploadtype)&&s.length>0,r=[...Array.from(Y),Object.assign({id:Y.length+1,role:"user",content:t},o&&{documentIds:s})];se(r),ge(),o&&ue([]);const i=(yield ve.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,value:t},o&&{documentIds:s}),z&&{userId:z}),L&&{studioUserId:L}),$&&{embedUserId:$}),G&&{deploymentId:G}))).body;if(!i)throw new Error("Streaming error");const n=r.length,l=new TextDecoder,a=i.getReader();let c="",d=!0,u=!1;const m=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=t,se([...r.slice(0,n),{id:Y.length+1,role:"assistant",content:c}])}else if("error"===e.event){const t=JSON.parse(e.data);ie(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(d=!1)}});for(;d;){const{value:e,done:t}=yield a.read();if(t){d=!1;break}const s=l.decode(e);s&&(u||(oe("streaming"),u=!0),m.feed(s))}null==X||X(H)}catch(e){let t=A(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(ee).find((([e])=>t.includes(e)));s?re(s[1]):ie(t)}finally{ge(),oe("idle"),he()}}));return l((()=>{V(Ae)}),[Ae]),s("div",Object.assign({className:T("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===J&&M)&&"px-4 pb-4"),dir:q?"rtl":"ltr"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===J&&M)&&s("div",Object.assign({className:T("absolute bottom-full",q?"left-0":"right-0")},{children:s("div",Object.assign({className:T("flex flex-col gap-2 pb-4 px-2",q?"justify-start":"justify-end","viewport"===_?q?"min-[767px]:items-start":"min-[767px]:items-end":q?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:Ae&&!D&&s(C,{data:(null==K?void 0:K.icebreakers)||[],onSend:Te})}))})),o("div",Object.assign({className:T("flex flex-col gap-y-2 px-4 py-3","block"===P.formFieldStyle&&"shadow"),style:Re},{children:["idle"===Z&&ne.length>0&&s("div",Object.assign({className:"flex flex-row gap-2 flex-wrap"},{children:ne.filter((e=>"failed"!==e.status)).map((e=>{var t,r,i;return s(a,{children:"document"===e.type?o("div",Object.assign({className:T("relative gap-x-[10px] flex items-center px-2 h-[56px] border",q&&"flex-row-reverse"),style:{borderRadius:Re.borderRadius,borderColor:W.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:W.accent,borderRadius:Re.borderRadius}},{children:le?s(w,{className:"w-5 h-5 animate-spin",style:{color:W.accentText}}):s(N,{className:"w-5 h-5",style:{color:W.accentText}})})),o("div",Object.assign({className:T("flex flex-col justify-center truncate",q?"text-right items-end":"text-left items-start")},{children:[s("p",Object.assign({className:(T(Se.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:T(Se.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",q?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:W.accent,borderColor:Re.backgroundColor},disabled:le||"idle"!==Z,onClick:()=>pe(e.id)},{children:s(I,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Re.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:Re.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:Re.borderRadius,backgroundColor:W.secondary}}),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",q?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:W.accent,borderColor:Re.backgroundColor},disabled:le||"idle"!==Z,onClick:()=>pe(e.id)},{children:s(I,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:T("flex items-end gap-x-2",q&&"flex-row-reverse")},{children:[s(S,Object.assign({className:T(Se.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",q?"text-right":"text-left"),value:xe,placeholder:null!==(U=null==K?void 0:K.placeholdertext)&&void 0!==U?U:q?"بماذا تريد أن تتحدث؟":"What do you want to talk about?",onChange:e=>ye(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),le||"idle"!==Z||Te()))}},B&&{onFocus:B},E&&{onBlur:E},{dir:q?"rtl":"ltr"})),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==K?void 0:K.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:Oe?W.accent+"10":void 0},disabled:le||"idle"!==Z,onClick:()=>{var e;return null===(e=je.current)||void 0===e?void 0:e.click()}},Ce,{children:[s("input",{id:"file-upload",ref:je,type:"file",accept:[...x,...ae?y:[]].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){Q(!1),yield de(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:Oe?W.accent:W.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:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!te?W.accent:W.accent+"10"},disabled:le||"idle"!==Z,onClick:()=>Te()},Ne,{children:s(O,{className:T("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",q&&"transform scale-x-[-1]"),style:{color:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!te?W.accentText:W.accent+"80"}})}))]}))]}))]})),ce&&s(R,{error:ce,className:"mt-3"})]}))}))};export{D as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useState as o,useRef as s,useEffect as r}from"react";import{usePickaxeContext as n}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useDimensionContext as i}from"../../../hooks/pickaxe/useDimensionContext.js";import{useDocument as c}from"../Addons/Document/hooks/useDocument.js";import m from"./History/index.js";import u from"./Input.js";const f=()=>{const{deploymentType:f,isNewChat:a}=n(),{width:l,height:d,setDimension:p}=i(),{setDocuments:x}=c(),[h,j]=o(!1),g=s(null);return r((()=>()=>{x([])}),[]),r((()=>{if(!g.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:o}=t.contentRect;p(parseInt(e.toFixed(0)),parseInt(o.toFixed(0)))}}));return e.observe(g.current),()=>{e.disconnect()}}),[g.current]),"chat-input"===f&&a?e("div",Object.assign({className:"relative flex flex-grow flex-col items-center"},{children:e(u,{})})):t("div",Object.assign({ref:g,className:"flex flex-grow flex-col items-center"},{children:[e(m,{hideInfo:d<=545||l<=500||h,isInputFocused:h}),e(u,{isFocused:h,onFocus:()=>j(!0),onBlur:()=>j(!1)})]}))};export{f as default};
1
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{useState as r,useRef as n,useEffect as s}from"react";import{usePickaxeContext as i}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useDimensionContext as c}from"../../../hooks/pickaxe/useDimensionContext.js";import{useDocument as m}from"../Addons/Document/hooks/useDocument.js";import u from"./History/index.js";import p from"./Input.js";const d=()=>{const{deploymentType:d,isNewChat:f}=i(),{width:a,height:h,setDimension:l}=c(),{setDocuments:x}=m(),[j,k]=r(!1),w=n(null);return s((()=>()=>{x([])}),[]),s((()=>{if(!w.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:o}=t.contentRect;l(parseInt(e.toFixed(0)),parseInt(o.toFixed(0)))}}));return e.observe(w.current),()=>{e.disconnect()}}),[w.current]),e("div",Object.assign({ref:w,className:"relative flex flex-grow flex-col items-center"},{children:"chat-input"===d&&f?e(p,{}):t(o,{children:[e(u,{hideInfo:h<=545||a<=350||j,isInputFocused:j}),e(p,{isFocused:j,onFocus:()=>k(!0),onBlur:()=>k(!1)})]})}))};export{d 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 n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useScrollContext as i}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as l}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as r}from"../../Addons/Document/hooks/useDocument.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import{format as m}from"date-fns";import d from"../../../Icons/message-square-notes.svg.js";import p from"../../../Icons/visitor.svg.js";import h from"../../common/PickaxeIcon.js";import f from"../../common/PickaxeCopyButton.js";import u from"../../common/PickaxeSimpleButton.js";import x from"../../Addons/Scroll/ScrollLockView.js";import b from"../../../../common/cn.js";const g=()=>{var g;const{pickaxe:v,styles:j,colors:k,misc:y,translations:w,disableHtml:N,disableJs:C,disableCss:O,isRtl:I,setChatId:S,setIsNewChat:D}=t(),{response:M}=n(),{scrollTargetRef:P}=i(),{setDocuments:R}=r(),$=l(),q=o((()=>m(M?M.sentAt:new Date,"hh:mm a MMM dd, yy")),[M]),A=o((()=>{var e;if(!M)return"";return(null!==(e=M.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("")}),[M]);return M?e("div",Object.assign({ref:P,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:k.primary,color:k.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(p,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[s("input",{id:`${M.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:A.length<280}),s("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:A}}),s("label",Object.assign({htmlFor:`${M.responseId}-input`,className:b($.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["see-input"])||"See input"})),s("label",Object.assign({htmlFor:`${M.responseId}-input`,className:b($.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[y.isChatImage&&s(h,{src:null==v?void 0:v.chaticon,alt:`${null==v?void 0:v.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(a,Object.assign({theme:j.theme,accentColor:k.accent,actions:!0},I&&{rtl:!0},N&&{disableHtml:!0},C&&{disableJs:!0},O&&{disableCss:!0},{children:s(c,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:M.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==v?void 0:v.enablechatresponses)&&e(u,Object.assign({color:k.accent,onClick:()=>{return e=M.responseId,R([]),D(!1),void S(e);var e}},{children:[s(d,{className:"pxe-h-4 pxe-w-4 pxe-shrink-0"}),s("p",Object.assign({className:b($.b3,"pxe-font-semibold")},{children:M.messageCount+1}))]})),s(f,{color:k.accent,text:null!==(g=M.questionResponse)&&void 0!==g?g:""})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:b($.b3,"font-semibold uppercase opacity-30")},{children:q}))}))]}))]}))]})),s(x,{className:"w-full"})]})):null};export{g as default};
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{useScrollContext as i}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as l}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as r}from"../../Addons/Document/hooks/useDocument.js";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import{format as m}from"date-fns";import d from"../../../Icons/message-square-notes.svg.js";import p from"../../../Icons/visitor.svg.js";import h from"../../common/PickaxeIcon.js";import f from"../../common/PickaxeCopyButton.js";import u from"../../common/PickaxeSimpleButton.js";import x from"../../Addons/Scroll/ScrollLockView.js";import b from"../../../../common/cn.js";const g=()=>{var g;const{pickaxe:v,styles:j,colors:k,misc:y,translations:w,disableHtml:N,disableJs:C,disableCss:O,isRtl:I,setChatId:S,setIsNewChat:D}=t(),{response:M}=n(),{scrollTargetRef:P}=i(),{setDocuments:R}=r(),$=l(),q=o((()=>m(M?M.sentAt:new Date,"hh:mm a MMM dd, yy")),[M]),A=o((()=>{var e;if(!M)return"";return(null!==(e=M.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("")}),[M]);return M?e("div",Object.assign({ref:P,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:k.primary,color:k.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(p,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[s("input",{id:`${M.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:A.length<280}),s("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:A}}),s("label",Object.assign({htmlFor:`${M.responseId}-input`,className:b($.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["see-input"])||"See input"})),s("label",Object.assign({htmlFor:`${M.responseId}-input`,className:b($.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[y.isChatImage&&s(h,{src:null==v?void 0:v.chaticon,alt:`${null==v?void 0:v.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(a,Object.assign({theme:j.theme,accentColor:k.accent,actions:!0},I&&{rtl:!0},N&&{disableHtml:!0},C&&{disableJs:!0},O&&{disableCss:!0},{children:s(c,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:M.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==v?void 0:v.enablechatresponses)&&e(u,Object.assign({color:k.accent,onClick:()=>{return e=M.responseId,R([]),D(!1),void S(e);var e}},{children:[s(d,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:b($.b3,"font-semibold")},{children:M.messageCount+1}))]})),s(f,{color:k.accent,text:null!==(g=M.questionResponse)&&void 0!==g?g:""})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:b($.b3,"font-semibold uppercase opacity-30")},{children:q}))}))]}))]}))]})),s(x,{className:"w-full"})]})):null};export{g as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as i,Fragment as r}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as u}from"../../Addons/Document/hooks/useDocument.js";import{useHover as m}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import v from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import j from"../../../Icons/link.svg.js";import w from"../../../Core/ErrorAlert.js";import N from"../../../../common/cn.js";const k=({field:k,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=n(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,removeDocument:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[K,Q]=a(!1),G=i(null),J=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:N(R.b3,"font-semibold opacity-70")},{children:k.main})),k.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:I.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:G,type:"file",accept:[...b,...W?p:[]].join(", "),id:k.id,hidden:!0,multiple:!0,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield _(Array.from(e.target.files||[])),e.target.value=""})),disabled:L}),t("div",Object.assign({className:N("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",K&&"block"===D.formFieldStyle&&"shadow","block"===D.formFieldStyle&&"shadow hover:shadow-none"),style:J},{children:[o("input",{type:"text",value:H,className:N(R.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(C=null==T?void 0:T["form-doc-placeholder"])&&void 0!==C?C:"Paste a website/video link or drag a file",onChange:e=>P(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield _(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q(H))},onFocus:()=>Q(!0),onBlur:()=>Q(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:H.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>q(H)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:I.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>{P(""),B("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:I.accent}})}))]}):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",disabled:L,onClick:()=>{var e;null===(e=G.current)||void 0===e||e.click()},style:{backgroundColor:S?I.accent+"10":void 0}},U,{children:o(h,{className:"h-6 w-6 shrink-0",style:{color:S?I.accent:I.accent+"80"}})}))}))]}))]}))]})),E.length>0&&o("div",Object.assign({className:N("flex gap-4","viewport"===F?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:o("div",Object.assign({className:"flex flex-row gap-x-2"},{children:E.filter((e=>"failed"!==e.status)).map((e=>{var s,l,a;return o(r,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(v,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),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:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:J.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:J.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:J.borderRadius,backgroundColor:I.secondary}}),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),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:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(j,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:(null==T?void 0:T.website)||"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),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:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):null},e.id)}))}))})),z&&o(w,{error:z,className:"mt-3"})]}))};export{k as default};
1
+ import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as i,useRef as r,Fragment as a}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as u}from"../../Addons/Document/hooks/useDocument.js";import{useHover as m}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import v from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import j from"../../../Icons/link.svg.js";import k from"../../../Core/ErrorAlert.js";import w from"../../../../common/cn.js";const N=({field:N,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=n(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,removeDocument:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},N),e))}}),[K,Q]=i(!1),G=r(null),J=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:w(R.b3,"font-semibold opacity-70")},{children:N.main})),N.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:I.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:G,type:"file",accept:[...b,...W?p:[]].join(", "),id:N.id,hidden:!0,multiple:!0,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield _(Array.from(e.target.files||[])),e.target.value=""})),disabled:L}),t("div",Object.assign({className:w("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",K&&"block"===D.formFieldStyle&&"shadow","block"===D.formFieldStyle&&"shadow hover:shadow-none"),style:J},{children:[o("input",{type:"text",value:H,className:w(R.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(C=null==T?void 0:T["form-doc-placeholder"])&&void 0!==C?C:"Paste a website/video link or drag a file",onChange:e=>P(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield _(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q(H))},onFocus:()=>Q(!0),onBlur:()=>Q(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:H.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>q(H)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:I.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>{P(""),B("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:I.accent}})}))]}):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",disabled:L,onClick:()=>{var e;null===(e=G.current)||void 0===e||e.click()},style:{backgroundColor:S?I.accent+"10":void 0}},U,{children:o(h,{className:"h-6 w-6 shrink-0",style:{color:S?I.accent:I.accent+"80"}})}))}))]}))]}))]})),E.length>0&&o("div",Object.assign({className:w("flex gap-4","viewport"===F?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:o("div",Object.assign({className:"flex flex-row gap-x-2"},{children:E.filter((e=>"failed"!==e.status)).map((e=>{var s,l,i;return o(a,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 shrink-0 animate-spin",style:{color:I.accentText}}):o(v,{className:"w-5 h-5 shrink-0",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(w(R.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:w(R.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),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:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4 shrink-0",style:{color:I.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:J.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:J.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:J.borderRadius,backgroundColor:I.secondary}}),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),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:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4 shrink-0",style:{color:I.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin shrink-0",style:{color:I.accentText}}):o(j,{className:"w-5 h-5 shrink-0",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(w(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:w(R.b4,"opacity-80 truncate")},{children:(null==T?void 0:T.website)||"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),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:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4 shrink-0",style:{color:I.accentText}})}))]})):null},e.id)}))}))})),z&&o(k,{error:z,className:"mt-3"})]}))};export{N as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as a}from"../../Addons/Scroll/hooks/useScroll.js";import{extractUrlsFromText as d}from"../../../../common/utils.js";import{encode as c}from"@nem035/gpt-3-encoder";import{createParser as m}from"eventsource-parser";import u from"../../common/PickaxeBranding.js";import p from"../../common/PickaxeButton.js";import f from"../../../../common/error.js";import g from"../../../../common/cn.js";const h=({questions:h})=>{var b;const{formId:x,userId:v,studioUserId:j,embedUserId:w,deploymentId:k,pickaxe:y,misc:I,translations:O,responsiveBy:S,setChatId:C,setIsNewChat:D,onGenerateComplete:E}=n(),{status:U,limits:P,isGenerating:R,setResponse:q,setMessages:N,setStatus:A,setLimitData:B,setError:L}=i(),{documents:T,websiteLink:W,isUploading:G,onWebsiteUpload:J,setDocuments:M,setDocumentError:_}=l(),{scrollStartSession:K,scrollEndSession:X,scrollToTarget:Y}=a({auto:!(null==y?void 0:y.enablechatresponses)}),z=r(),[F,H]=s(!1);return o("div",Object.assign({className:g("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===S?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[t("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:t(p,Object.assign({className:"px-5 min-h-[42px]",isDisabled:G||"idle"!==U||R||F,onClick:()=>e(void 0,void 0,void 0,(function*(){try{if("idle"!==U||G||F)return;L(""),_(""),B(null),q(null);const e=["Multiple Choice","Checkbox"];for(const o of h){if(c(o.input).length>o.maxLength&&!e.includes(o.type))throw new Error("One or more of your responses is too long!");if(o.isRequired&&!o.input.trim()&&"userinput:documentupload"!==o.id)throw new Error("You must fill out all required fields.")}const o=T.filter((e=>"finished"===e.status)),t=T.map((e=>e.name)),s="enduserupload"===(null==y?void 0:y.documentuploadtype),n=h.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=d(W).filter((e=>!t.includes(e)));if(i.length){const e=i[i.length-1];H(!0);const t=yield J(e);t&&(o.push(t),yield new Promise((e=>setTimeout(e,5e3)))),H(!1)}else if(n&&s&&!o.length)return void _("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=o.map((e=>e.documentId)).filter(Boolean),l=s&&r.length>0;let a={};h.forEach((e=>a=Object.assign(Object.assign({},a),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?o.map((e=>e.name)).join(",")||"":e.input}))),A("fetching"),K(),Y();const u=yield z.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:x,valueObj:a},l&&{documentIds:r}),v&&{userId:v}),j&&{studioUserId:j}),w&&{embedUserId:w}),k&&{deploymentId:k})),p=u.body;if(!p)throw new Error("Streaming error");const f=u.headers.get("X-Pickaxe-Response-Id");if(!f)throw new Error("Response ID not found");const g=new TextDecoder,b=p.getReader();let I="",O=!0,S=!1;const P=m({onEvent:e=>{if("delta"===e.event){const o=JSON.parse(e.data).token.replace(/\u200B/g,"");I+=o,q({formId:x,responseId:f,documentIds:r,questions:h.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:I,messageCount:0,sentAt:new Date}),(null==y?void 0:y.enablechatresponses)&&N([{id:0,role:"assistant",content:I}])}else if("error"===e.event){const o=JSON.parse(e.data);L(o.error||"Something went wrong, please try again.")}else"stop"===e.event&&(O=!1)}});for(;O;){const{value:e,done:o}=yield b.read();if(o){O=!1;break}const t=g.decode(e);t&&(S||(A("streaming"),S=!0,l&&M([]),(null==y?void 0:y.enablechatresponses)&&(C(f),D(!1))),P.feed(t))}null==E||E(f)}catch(e){let o=f(e)||"";o&&!o.includes("Unexpected token 'A',")||(o="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(P).find((([e])=>o.includes(e)));t?B(t[1]):L(o),Y()}finally{A("idle"),H(!1),X()}}))},{children:F?(null==O?void 0:O.processing)||"Processing...":G?(null==O?void 0:O.uploading)||"Uploading...":"fetching"===U||"streaming"===U?(null==O?void 0:O.loading)||"Loading...":null!==(b=null==y?void 0:y.submittext)&&void 0!==b?b:"Submit"}))})),!I.isWhiteLabel&&t("div",Object.assign({className:"flex justify-end pr-3"},{children:t(u,{})}))]}))};export{h as default};
1
+ import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o}from"react/jsx-runtime";import{useState as s}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useDocument as a}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as l}from"../../Addons/Scroll/hooks/useScroll.js";import{extractUrlsFromText as d}from"../../../../common/utils.js";import{encode as c}from"@nem035/gpt-3-encoder";import{createParser as m}from"eventsource-parser";import u from"../../common/PickaxeBranding.js";import p from"../../common/PickaxeButton.js";import f from"../../../../common/error.js";const g=({questions:g})=>{var h;const{formId:b,userId:j,studioUserId:v,embedUserId:x,deploymentId:w,pickaxe:k,misc:I,translations:y,setChatId:O,setIsNewChat:S,onGenerateComplete:C}=n(),{status:D,limits:E,isGenerating:U,setResponse:P,setMessages:R,setStatus:q,setLimitData:N,setError:A}=i(),{documents:L,websiteLink:B,isUploading:T,onWebsiteUpload:W,setDocuments:G,setDocumentError:J}=a(),{scrollStartSession:M,scrollEndSession:_,scrollToTarget:K}=l({auto:!(null==k?void 0:k.enablechatresponses)}),X=r(),[Y,z]=s(!1);return t("div",Object.assign({className:"mt-4 flex flex-wrap justify-between gap-4 items-center"},{children:[o("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:o(p,Object.assign({className:"px-5 min-h-[42px]",isDisabled:T||"idle"!==D||U||Y,onClick:()=>e(void 0,void 0,void 0,(function*(){try{if("idle"!==D||T||Y)return;A(""),J(""),N(null),P(null);const e=["Multiple Choice","Checkbox"];for(const t of g){if(c(t.input).length>t.maxLength&&!e.includes(t.type))throw new Error("One or more of your responses is too long!");if(t.isRequired&&!t.input.trim()&&"userinput:documentupload"!==t.id)throw new Error("You must fill out all required fields.")}const t=L.filter((e=>"finished"===e.status)),o=L.map((e=>e.name)),s="enduserupload"===(null==k?void 0:k.documentuploadtype),n=g.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=d(B).filter((e=>!o.includes(e)));if(i.length){const e=i[i.length-1];z(!0);const o=yield W(e);o&&(t.push(o),yield new Promise((e=>setTimeout(e,5e3)))),z(!1)}else if(n&&s&&!t.length)return void J("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=t.map((e=>e.documentId)).filter(Boolean),a=s&&r.length>0;let l={};g.forEach((e=>l=Object.assign(Object.assign({},l),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?t.map((e=>e.name)).join(",")||"":e.input}))),q("fetching"),M(),K();const u=yield X.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:b,valueObj:l},a&&{documentIds:r}),j&&{userId:j}),v&&{studioUserId:v}),x&&{embedUserId:x}),w&&{deploymentId:w})),p=u.body;if(!p)throw new Error("Streaming error");const f=u.headers.get("X-Pickaxe-Response-Id");if(!f)throw new Error("Response ID not found");const h=new TextDecoder,I=p.getReader();let y="",E=!0,U=!1;const _=m({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");y+=t,P({formId:b,responseId:f,documentIds:r,questions:g.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:y,messageCount:0,sentAt:new Date}),(null==k?void 0:k.enablechatresponses)&&R([{id:0,role:"assistant",content:y}])}else if("error"===e.event){const t=JSON.parse(e.data);A(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(E=!1)}});for(;E;){const{value:e,done:t}=yield I.read();if(t){E=!1;break}const o=h.decode(e);o&&(U||(q("streaming"),U=!0,a&&G([]),(null==k?void 0:k.enablechatresponses)&&(O(f),S(!1))),_.feed(o))}null==C||C(f)}catch(e){let t=f(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const o=Object.entries(E).find((([e])=>t.includes(e)));o?N(o[1]):A(t),K()}finally{q("idle"),z(!1),_()}}))},{children:Y?(null==y?void 0:y.processing)||"Processing...":T?(null==y?void 0:y.uploading)||"Uploading...":"fetching"===D||"streaming"===D?(null==y?void 0:y.loading)||"Loading...":null!==(h=null==k?void 0:k.submittext)&&void 0!==h?h:"Submit"}))})),!I.isWhiteLabel&&o("div",Object.assign({className:"flex justify-end pr-3"},{children:o(u,{})}))]}))};export{g as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import l from"../../Core/Skeleton.js";import m from"../common/PickaxeHead.js";import t from"./History/index.js";import i from"./NewChat.js";import a from"./Questions/index.js";import c from"../../../common/cn.js";const x=()=>{const{pickaxe:x,responsiveBy:p}=o();return e("div",Object.assign({className:c("flex w-full flex-col items-center pt-12 px-4 pb-10","viewport"===p?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:s("div",x?Object.assign({className:"flex w-full max-w-[700px] flex-col"},{children:[e(m,{}),s("div",Object.assign({className:c("flex flex-col gap-y-8","viewport"===p?"min-[767px]:mt-4":"@[767px]/pickaxe-root:mt-4")},{children:[(null==x?void 0:x.chatflag)?e(i,{}):e(a,{}),e(t,{})]}))]}):Object.assign({className:"flex w-full max-w-[700px] flex-col items-center"},{children:[e(l,{className:"w-[72px] h-[72px]"}),e(l,{className:"h-[20px] mt-6 w-full"}),e(l,{className:"h-[20px] mt-2 w-full"}),e(l,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]}))}))};export{x as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{usePickaxeContext as m}from"../../../hooks/pickaxe/usePickaxeContext.js";import o from"../common/PickaxeSkeleton.js";import l from"../common/PickaxeHead.js";import t from"./History/index.js";import i from"./NewChat.js";import a from"./Questions/index.js";import c from"../../../common/cn.js";const x=()=>{const{pickaxe:x,responsiveBy:p}=m();return e("div",Object.assign({className:c("flex w-full flex-col items-center pt-12 px-6 pb-10","viewport"===p?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:s("div",x?Object.assign({className:"flex w-full max-w-[700px] flex-col"},{children:[e(l,{}),s("div",Object.assign({className:c("flex flex-col gap-y-8","viewport"===p?"min-[767px]:mt-4":"@[767px]/pickaxe-root:mt-4")},{children:[(null==x?void 0:x.chatflag)?e(i,{}):e(a,{}),e(t,{})]}))]}):Object.assign({className:"flex w-full max-w-[700px] flex-col items-center"},{children:[e(o,{className:"w-[72px] h-[72px]"}),e(o,{className:"h-[20px] mt-6 w-full"}),e(o,{className:"h-[20px] mt-2 w-full"}),e(o,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]}))}))};export{x as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as s}from"../../../hooks/studio/useStyleFontSize.js";import r from"./PickaxeIcon.js";import c from"./PickaxeBranding.js";import n from"../../../common/cn.js";const l=({className:l,iconClassName:a,onIconClick:m})=>{const{pickaxe:p,misc:d}=t(),f=s(),u=o((()=>({title:(null==p?void 0:p.formtitle)||"",description:(null==p?void 0:p.formdescription)||""})),[p]);return e("div",Object.assign({className:n("flex h-[56px] items-center justify-between gap-4",l)},{children:[e("div",Object.assign({className:"flex items-center gap-4"},{children:[d.isProfileImage&&i(r,Object.assign({src:null==p?void 0:p.coverphoto,alt:`${null==p?void 0:p.formtitle}'s Profile Picture`,width:32,height:32,className:n("shrink-0 h-[32px] w-[32px] rounded-full",a,!!m&&"cursor-pointer")},m&&{onClick:m})),d.isTitle&&i("p",Object.assign({className:n(f.b1)},{children:u.title}))]})),!d.isWhiteLabel&&i(c,{animateHover:!0})]}))};export{l as default};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useMemo as s}from"react";import{usePickaxeContext as t}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as o}from"../../../hooks/studio/useStyleFontSize.js";import r from"./PickaxeIcon.js";import l from"./PickaxeBranding.js";import c from"../../../common/cn.js";const n=({className:n,iconClassName:a,onIconClick:m})=>{const{pickaxe:p,misc:d,deploymentType:f}=t(),u=o(),h=s((()=>({title:(null==p?void 0:p.formtitle)||"",description:(null==p?void 0:p.formdescription)||""})),[p]);return d.isTitle||d.isDescription||!d.isWhiteLabel?e("div",Object.assign({className:c("flex h-[56px] items-center justify-between gap-4",n)},{children:[e("div",Object.assign({className:"flex items-center gap-4"},{children:[d.isProfileImage&&i(r,Object.assign({src:null==p?void 0:p.coverphoto,alt:`${null==p?void 0:p.formtitle}'s Profile Picture`,width:32,height:32,className:c("shrink-0 h-[32px] w-[32px] rounded-full",a,!!m&&"cursor-pointer")},m&&{onClick:m})),d.isTitle&&i("p",Object.assign({className:c(u.b1)},{children:h.title}))]})),!d.isWhiteLabel&&i(l,{className:c("flex","popup"===f&&"p-0 pr-12"),animateHover:!0})]})):null};export{n as default};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";import{Img as o}from"../Img/index.js";import i from"../common/Action.js";import s from"./Audio.js";import a from"./Html/index.js";const m=({href:m="",children:c})=>{const{accentColor:n,actions:l}=r(),p=t((()=>{if(!m)return"";return m.startsWith("http://")?`https://${m.slice(7)}`:m.startsWith("www.")?`https://${m}`:m}),[m]),d=t((()=>{const e=p.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=p.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const r=p.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(r)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${r[1]}`};const o=p.match(/streamable\.com\/([\w-]+)/i);return o?{title:"streamable-embed",src:`https://streamable.com/e/${o[1]}`}:null}),[p]),u=t((()=>p.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[p]),f=t((()=>p.includes("action_generated_files")&&p.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[p]),h=t((()=>p.includes("action_generated_files")&&p.match(/\.html$/)),[p]),b=t((()=>l&&p.includes("pickaxe")&&(p.includes("/api/fn/result")||p.includes("/api/function_call_results"))),[l,p]);return d?e("div",Object.assign({className:"pxe-markdown-video"},{children:e("iframe",Object.assign({title:d.title,src:d.src,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):u?e(o,{src:p,alt:"string"==typeof c?c:"Markdown Image"}):f?e(s,{url:p}):h?e(a,{url:p}):b?e(i,{jobUrl:p}):e("a",Object.assign({href:p,target:"_blank",rel:"noopener noreferrer",style:{color:n}},{children:c}))};export{m as A};
1
+ import{jsx as t}from"react/jsx-runtime";import{useMemo as e}from"react";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";import{Img as r}from"../Img/index.js";import i from"../common/IframeVideo.js";import m from"../common/Action.js";import c from"./Audio.js";import s from"./Html/index.js";const a=({href:a="",children:n})=>{const{accentColor:l,actions:p}=o(),u=e((()=>{if(!a)return"";return a.startsWith("http://")?`https://${a.slice(7)}`:a.startsWith("www.")?`https://${a}`:a}),[a]),f=e((()=>{const t=u.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(t)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${t[1]}`};const e=u.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(e)return{title:"loom-embed",src:`https://www.loom.com/embed/${e[1]}`};const o=u.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(o)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${o[1]}`};const r=u.match(/streamable\.com\/([\w-]+)/i);return r?{title:"streamable-embed",src:`https://streamable.com/e/${r[1]}`}:null}),[u]),d=e((()=>u.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[u]),h=e((()=>u.includes("action_generated_files")&&u.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[u]),b=e((()=>u.includes("action_generated_files")&&u.match(/\.html$/)),[u]),w=e((()=>p&&u.includes("pickaxe")&&(u.includes("/api/fn/result")||u.includes("/api/function_call_results"))),[p,u]);return f?t(i,{title:f.title,src:f.src}):d?t(r,{src:u,alt:"string"==typeof n?n:"Markdown Image"}):h?t(c,{url:u}):b?t(s,{url:u}):w?t(m,{jobUrl:u}):t("a",Object.assign({href:u,target:"_blank",rel:"noopener noreferrer",style:{color:l}},{children:n}))};export{a as A};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as i,jsxs as r}from"react/jsx-runtime";import{Prism as n}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";import t from"../../../PickaxeCopyButton.js";const s=s=>{var a,l,{children:c,className:d}=s,m=e(s,["children","className"]);const{syntaxTheme:h}=o(),g=/language-(\w+)/.exec(d||"");return g?i("div",Object.assign({className:"pxe-markdown-code"},{children:r("div",{children:[i("div",{children:i(t,{color:"#FFFFFF",text:null!==(a=null==c?void 0:c.toString())&&void 0!==a?a:"",iconClassName:"w-4 h-4 text-white"})}),i("div",{children:i(n,Object.assign({},m,{PreTag:"div",language:null!==(l=null==g?void 0:g[1])&&void 0!==l?l:"js",style:h,showLineNumbers:!0},{children:String(c).replace(/\n$/,"")}))})]})})):i("code",Object.assign({},m,{className:"pxe-markdown-code-inline"},{children:c}))};export{s as Code};
1
+ import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as i,jsxs as n}from"react/jsx-runtime";import{Prism as r}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";import t from"../../../PickaxeCopyButton.js";const s=s=>{var a,l,{node:c,children:d,className:m}=s,h=e(s,["node","children","className"]);const{syntaxTheme:g}=o(),u=/language-(\w+)/.exec(m||"");return u?i("div",Object.assign({className:"pxe-markdown-code"},{children:n("div",{children:[i("div",{children:i(t,{color:"#FFFFFF",text:null!==(a=null==d?void 0:d.toString())&&void 0!==a?a:"",iconClassName:"w-4 h-4 text-white"})}),i("div",{children:i(r,Object.assign({},h,{PreTag:"div",language:null!==(l=null==u?void 0:u[1])&&void 0!==l?l:"js",style:g,showLineNumbers:!0},{children:String(d).replace(/\n$/,"")}))})]})})):i("code",Object.assign({},h,{className:"pxe-markdown-code-inline"},{children:d}))};export{s as Code};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";const r=({children:r})=>{const o=t((()=>{if("string"!=typeof r)return null;const e=r.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=r.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const o=r.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(o)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${o[1]}`};const m=r.match(/streamable\.com\/([\w-]+)/i);return m?{title:"streamable-embed",src:`https://streamable.com/e/${m[1]}`}:null}),[r]);return o?e("div",Object.assign({className:"pxe-markdown-video"},{children:e("iframe",Object.assign({title:o.title,src:o.src,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):e("p",{children:r})};export{r as P};
1
+ import{jsx as e}from"react/jsx-runtime";import{useMemo as t}from"react";import o from"../common/IframeVideo.js";const m=({children:m})=>{const r=t((()=>{if("string"!=typeof m)return null;const e=m.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=m.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const o=m.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(o)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${o[1]}`};const r=m.match(/streamable\.com\/([\w-]+)/i);return r?{title:"streamable-embed",src:`https://streamable.com/e/${r[1]}`}:null}),[m]);return r?e(o,{title:r.title,src:r.src}):e("p",{children:m})};export{m as P};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";const t=({title:t,src:a,fallback:r="Iframe not supported, use a different browser."})=>e("div",Object.assign({className:"pxe-markdown-video"},{children:e("iframe",Object.assign({title:t,src:a,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:r}))}));export{t as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as t,useRef as o,useMemo as s,useEffect as i}from"react";import{usePickaxeMarkdownContext as m}from"./hooks/usePickaxeMarkdownContext.js";import{rehypeSanitize as a,rehypePickaxeAction as l}from"./utils/custom-plugins.js";import p from"react-markdown";import c from"remark-gfm";import d from"remark-math";import h from"rehype-katex";import f from"rehype-raw";import{A as u}from"./Components/A/index.js";import{P as g}from"./Components/P/index.js";import{Img as x}from"./Components/Img/index.js";import{Iframe as b}from"./Components/Iframe/index.js";import{Code as j}from"./Components/Code/index.js";import{H1 as C,H2 as k,H3 as w,H4 as v,H5 as y}from"./Components/Headings/index.js";import{Ol as O,Ul as $,Li as S}from"./Components/List/index.js";import{Table as A,Th as L,Tr as M,Td as N}from"./Components/Table/index.js";import{Hr as P,Br as H,Blockquote as I}from"./Components/Others/index.js";import{ActionCaption as T,ActionFinished as B,ActionError as E}from"./Components/Action/index.js";import J from"../../../../common/cn.js";const R=({className:R,style:W,children:_,value:q,maxLines:z,maxChars:D,multiLineBreaks:F,recursion:G,onExpandClick:K})=>{const{accentColor:Q,rtl:U,disableHtml:V,disableJs:X,disableCss:Y}=m(),[Z,ee]=t({width:0,height:0}),[re,ne]=t(null),te=o(null),oe=s((()=>{if(!q)return"";let e=q.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),F&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[q,F]);i((()=>{if(D)return void ne(oe.length>D?oe.slice(0,D)+'<span class="pxe-expand-btn">...</span>':null);if(!z)return void ne(null);if(!te.current||!oe||re)return;const e=te.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=z*r;if(!(Z.height>n))return;const t=Math.floor(Z.width/8),o=Math.floor(t*z);ne(oe.slice(0,o)+'<span class="pxe-expand-btn">...</span>')}),[oe,z,D,Z,re]);const se={h1:C,h2:k,h3:w,h4:v,h5:y,p:g,a:u,img:x,iframe:b,code:j,ol:O,ul:$,li:S,table:A,th:L,tr:M,td:N,hr:P,br:H,blockquote:I,span:r=>{var{children:t}=r,o=e(r,["children"]);return"pxe-expand-btn"===o.className?n("span",Object.assign({},o,{style:Object.assign({display:"inline",fontWeight:500,color:Q,marginLeft:".25rem",userSelect:"none"},K&&{cursor:"pointer"})},K&&{onClick:K},{children:t})):n("span",Object.assign({},o,{children:t}))},ActionCaption:T,ActionFinished:B,ActionError:E};i((()=>{if(!te.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;ee({width:e,height:n})}}));return e.observe(te.current),()=>{e.disconnect()}}),[]);const ie=re||oe;return r("div",Object.assign({className:"pxe-markdown",ref:te,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},W)},U&&{dir:"rtl"},{children:[n(p,Object.assign({className:J(!G&&"pxe-prose",R),components:se,remarkPlugins:[c,[d,{singleDollarTextMath:!1}]],rehypePlugins:[h,...V?[]:[f],[a,{disableJs:X,disableCss:Y}],l]},{children:ie})),_]}))};export{R as PickaxeMarkdownRenderer};
1
+ import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as t,useRef as o,useMemo as s,useEffect as i}from"react";import{usePickaxeMarkdownContext as m}from"./hooks/usePickaxeMarkdownContext.js";import{rehypeCode as a,rehypeSanitize as l,rehypePickaxeAction as p}from"./utils/custom-plugins.js";import c from"react-markdown";import d from"remark-gfm";import h from"remark-math";import f from"rehype-katex";import u from"rehype-raw";import{A as g}from"./Components/A/index.js";import{P as x}from"./Components/P/index.js";import{Img as b}from"./Components/Img/index.js";import{Iframe as j}from"./Components/Iframe/index.js";import{Code as C}from"./Components/Code/index.js";import{H1 as k,H2 as w,H3 as v,H4 as y,H5 as O}from"./Components/Headings/index.js";import{Ol as $,Ul as S,Li as A}from"./Components/List/index.js";import{Table as L,Th as M,Tr as N,Td as P}from"./Components/Table/index.js";import{Hr as H,Br as I,Blockquote as T}from"./Components/Others/index.js";import{ActionCaption as B,ActionFinished as E,ActionError as J}from"./Components/Action/index.js";import R from"../../../../common/cn.js";const W=({className:W,style:_,children:q,value:z,maxLines:D,maxChars:F,multiLineBreaks:G,recursion:K,onExpandClick:Q})=>{const{accentColor:U,rtl:V,disableHtml:X,disableJs:Y,disableCss:Z}=m(),[ee,re]=t({width:0,height:0}),[ne,te]=t(null),oe=o(null),se=s((()=>{if(!z)return"";let e=z.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),G&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[z,G]);i((()=>{if(F)return void te(se.length>F?se.slice(0,F)+'<span class="pxe-expand-btn">...</span>':null);if(!D)return void te(null);if(!oe.current||!se||ne)return;const e=oe.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=D*r;if(!(ee.height>n))return;const t=Math.floor(ee.width/8),o=Math.floor(t*D);te(se.slice(0,o)+'<span class="pxe-expand-btn">...</span>')}),[se,D,F,ee,ne]);const ie={h1:k,h2:w,h3:v,h4:y,h5:O,p:x,a:g,img:b,iframe:j,code:C,ol:$,ul:S,li:A,table:L,th:M,tr:N,td:P,hr:H,br:I,blockquote:T,span:r=>{var{children:t}=r,o=e(r,["children"]);return"pxe-expand-btn"===o.className?n("span",Object.assign({},o,{style:Object.assign({display:"inline",fontWeight:500,color:U,marginLeft:".25rem",userSelect:"none"},Q&&{cursor:"pointer"})},Q&&{onClick:Q},{children:t})):n("span",Object.assign({},o,{children:t}))},ActionCaption:B,ActionFinished:E,ActionError:J};i((()=>{if(!oe.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;re({width:e,height:n})}}));return e.observe(oe.current),()=>{e.disconnect()}}),[]);const me=ne||se;return r("div",Object.assign({className:"pxe-markdown",ref:oe,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},_)},V&&{dir:"rtl"},{children:[n(c,Object.assign({className:R(!K&&"pxe-prose",W),components:ie,remarkPlugins:[d,[h,{singleDollarTextMath:!1}]],rehypePlugins:[a,f,...X?[]:[u],[l,{disableJs:Y,disableCss:Z}],p]},{children:me})),q]}))};export{W as PickaxeMarkdownRenderer};
@@ -1 +1 @@
1
- import{visit as e,SKIP as t}from"unist-util-visit";const r=["action-caption","action-finished","action-error"],i=["ActionCaption","ActionFinished","ActionError"],o=()=>o=>(e(o,"element",(e=>{const t=e.tagName;if(r.includes(t)){const r=t.split("-");e.tagName=r.map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(""),e.properties=e.properties||{}}})),e(o,"element",((e,r,o)=>{if("p"===e.tagName){const n=e.children.filter((e=>"text"===e.type?""!==e.value.trim():"element"===e.type));if(1===n.length){const e=n[0];if("element"===e.type&&i.includes(e.tagName)&&o&&"children"in o&&o.children&&void 0!==r)return o.children.splice(r,1,e),[t,r]}}})),o),n=(r={})=>i=>{e(i,"element",((e,i,o)=>{if(r.disableJs){if("script"===e.tagName&&o&&"number"==typeof i)return o.children.splice(i,1),[t,i];if(e.properties){["onclick","onload","onerror","onmouseover","onmouseout","onfocus","onblur"].forEach((t=>{e.properties[t]&&delete e.properties[t]})),e.properties.href&&"string"==typeof e.properties.href&&e.properties.href.toLowerCase().startsWith("javascript:")&&delete e.properties.href}}if(r.disableCss&&"style"===e.tagName&&o&&"number"==typeof i)return o.children.splice(i,1),[t,i]}))};export{o as rehypePickaxeAction,n as rehypeSanitize};
1
+ import{visit as e,SKIP as t}from"unist-util-visit";const i=["action-caption","action-finished","action-error"],r=["ActionCaption","ActionFinished","ActionError"],o=()=>o=>(e(o,"element",(e=>{const t=e.tagName;if(i.includes(t)){const i=t.split("-");e.tagName=i.map((e=>e.charAt(0).toUpperCase()+e.slice(1))).join(""),e.properties=e.properties||{}}})),e(o,"element",((e,i,o)=>{if("p"===e.tagName){const n=e.children.filter((e=>"text"===e.type?""!==e.value.trim():"element"===e.type));if(1===n.length){const e=n[0];if("element"===e.type&&r.includes(e.tagName)&&o&&"children"in o&&o.children&&void 0!==i)return o.children.splice(i,1,e),[t,i]}}})),o),n=(i={})=>r=>{e(r,"element",((e,r,o)=>{if(i.disableJs){if("script"===e.tagName&&o&&"number"==typeof r)return o.children.splice(r,1),[t,r];if(e.properties){["onclick","onload","onerror","onmouseover","onmouseout","onfocus","onblur"].forEach((t=>{e.properties[t]&&delete e.properties[t]})),e.properties.href&&"string"==typeof e.properties.href&&e.properties.href.toLowerCase().startsWith("javascript:")&&delete e.properties.href}}if(i.disableCss&&"style"===e.tagName&&o&&"number"==typeof r)return o.children.splice(r,1),[t,r]}))},s=()=>t=>{e(t,"code",(e=>{var t;e.lang=null!==(t=e.lang)&&void 0!==t?t:"plaintext"}))};export{s as rehypeCode,o as rehypePickaxeAction,n as rehypeSanitize};
@@ -0,0 +1 @@
1
+ import{jsx as e}from"react/jsx-runtime";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import a from"../../../common/cn.js";const t=({children:t,className:n,innerClassName:o,isLoaded:r=!1})=>{const{styles:i}=s();return e("div",Object.assign({className:a("rounded-sm",!r&&"pxe-animate-pulse",r&&"pxe-animate-none",n),style:{backgroundColor:"dark"===i.theme?"#1E1E1F":"#E5E7EB"}},{children:e("div",Object.assign({className:a("pxe-flex pxe-items-center",!r&&"pxe-opacity-0",o)},{children:t}))}))};export{t as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{usePickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useState as l,useEffect as a}from"react";import{usePickaxeContext as r}from"../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as m}from"./Addons/Document/hooks/useDocumentContext.js";import{generateId as n}from"../../common/utils.js";import c from"./Addons/Scroll/Provider.js";import p from"../Core/Skeleton.js";import x from"./Chat/index.js";import f from"./Form/index.js";import d from"../../common/cn.js";const u=({formId:u,className:h})=>{const{chatId:k,styles:w,colors:j,responsiveBy:g,deploymentType:N,isNewChat:b,setFormId:v,setChatId:y,setSessionId:C,setPickaxe:I}=r(),{setMessages:O,setResponse:P,setError:D,setLimitData:S,setStatus:F}=i(),{setDocumentError:R}=m(),[A,E]=l(!1),L=s();return a((()=>{v(u)}),[u]),a((()=>{if(!L.data)return;const e=L.data.chatflag;y(e?n(15):""),C(n(15)),e?O([]):P(null),D(""),R(""),S(null),I(L.data),E(!0)}),[L.data]),a((()=>{D(""),R(""),S(null),O([]),P(null),F("idle")}),[k]),L.data?e("div",Object.assign({className:d("relative @container/pickaxe-root flex flex-col flex-grow w-full",!N&&"h-full","popup"===N&&k&&"h-full","dark"===w.theme&&"dark",h),style:Object.assign({backgroundColor:"chat-input"===N&&b?"transparent":j.primary,color:j.text},w.font&&"Real Head Pro"!==w.font&&{fontFamily:w.font})},{children:L.isLoading||!A?e("div",Object.assign({className:d("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===g?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e(p,{className:"w-[72px] h-[72px]"}),e(p,{className:"h-[20px] mt-6 w-full"}),e(p,{className:"h-[20px] mt-2 w-full"}),e(p,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e(p,{className:d("w-full min-h-[48px]","viewport"===g?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e(o,{children:e(c,k?{children:e(x,{})}:{children:e(f,{})})})})):null};export{u as Pickaxe};
1
+ import{jsx as e,jsxs as o,Fragment as t}from"react/jsx-runtime";import{usePickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useState as a,useEffect as l}from"react";import{usePickaxeContext as r}from"../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as m}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as i}from"./Addons/Document/hooks/useDocumentContext.js";import{generateId as n}from"../../common/utils.js";import c from"./Addons/Scroll/Provider.js";import p from"./common/PickaxeSkeleton.js";import x from"./Chat/index.js";import f from"./Form/index.js";import d from"../../common/cn.js";const u=({formId:u,className:h})=>{const{chatId:k,styles:w,colors:j,responsiveBy:g,deploymentType:N,isNewChat:b,setFormId:v,setChatId:y,setSessionId:C,setPickaxe:P}=r(),{setMessages:I,setResponse:O,setError:D,setLimitData:S,setStatus:F}=m(),{setDocumentError:R}=i(),[A,E]=a(!1),L=s();return l((()=>{v(u)}),[u]),l((()=>{if(!L.data)return;const e=L.data.chatflag;y(e?n(15):""),C(n(15)),e?I([]):O(null),D(""),R(""),S(null),P(L.data),E(!0)}),[L.data]),l((()=>{D(""),R(""),S(null),I([]),O(null),F("idle")}),[k]),L.data?e("div",Object.assign({className:d("relative @container/pickaxe-root flex flex-col flex-grow w-full",!N&&"h-full","popup"===N&&k&&"h-full","dark"===w.theme&&"dark",h),style:Object.assign({backgroundColor:"chat-input"===N&&b?"transparent":j.primary,color:j.text},w.font&&"Real Head Pro"!==w.font&&{fontFamily:w.font})},{children:L.isLoading||!A?e("div",Object.assign({className:d("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===g?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:o("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e(p,{className:"w-[72px] h-[72px]"}),e(p,{className:"h-[20px] mt-6 w-full"}),e(p,{className:"h-[20px] mt-2 w-full"}),e(p,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e(p,{className:d("w-full min-h-[48px]","viewport"===g?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e(t,{children:e(c,k?{children:e(x,{})}:{children:e(f,{})})})})):null};export{u as Pickaxe};
@@ -3,5 +3,5 @@ interface PickaxeCompactHeadProps {
3
3
  iconClassName?: string;
4
4
  onIconClick?: () => void;
5
5
  }
6
- declare const PickaxeCompactHead: ({ className, iconClassName, onIconClick, }: PickaxeCompactHeadProps) => import("react/jsx-runtime").JSX.Element;
6
+ declare const PickaxeCompactHead: ({ className, iconClassName, onIconClick, }: PickaxeCompactHeadProps) => import("react/jsx-runtime").JSX.Element | null;
7
7
  export default PickaxeCompactHead;
@@ -0,0 +1,7 @@
1
+ interface IframeVideoProps {
2
+ title: string;
3
+ src: string;
4
+ fallback?: string;
5
+ }
6
+ declare const IframeVideo: ({ title, src, fallback, }: IframeVideoProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default IframeVideo;
@@ -3,3 +3,4 @@ export declare const rehypeSanitize: (options?: {
3
3
  disableJs?: boolean;
4
4
  disableCss?: boolean;
5
5
  }) => (tree: any) => void;
6
+ export declare const rehypeCode: () => (tree: any) => void;
@@ -0,0 +1,9 @@
1
+ import type { ReactNode } from "react";
2
+ interface PickaxeSkeletonProps {
3
+ children?: ReactNode;
4
+ className?: string;
5
+ innerClassName?: string;
6
+ isLoaded?: boolean;
7
+ }
8
+ declare const PickaxeSkeleton: ({ children, className, innerClassName, isLoaded, }: PickaxeSkeletonProps) => import("react/jsx-runtime").JSX.Element;
9
+ export default PickaxeSkeleton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "2.7.1",
3
+ "version": "2.7.3",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../common/cn.js");exports.default=({children:a,className:r,innerClassName:i,isLoaded:t=!1})=>e.jsx("div",Object.assign({className:s.default("rounded-sm",!t&&"animate-pulse bg-[#E5E7EB] dark:bg-[#1E1E1F]",t&&"animate-none",r)},{children:e.jsx("div",Object.assign({className:s.default("flex items-center",!t&&"opacity-0",i)},{children:a}))}));
@@ -1,12 +0,0 @@
1
- import { type ReactNode, type DetailedHTMLProps, type HTMLAttributes } from "react";
2
- interface ScrollAreaProps {
3
- id?: string;
4
- className?: string;
5
- innerClassName?: string;
6
- children?: ReactNode;
7
- variant?: "height" | "maxHeight";
8
- hideScrollbar?: boolean;
9
- inner?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
10
- }
11
- declare const ScrollArea: import("react").ForwardRefExoticComponent<ScrollAreaProps & import("react").RefAttributes<HTMLDivElement>>;
12
- export default ScrollArea;
@@ -1,9 +0,0 @@
1
- import type { ReactNode } from "react";
2
- interface SkeletonProps {
3
- children?: ReactNode;
4
- className?: string;
5
- innerClassName?: string;
6
- isLoaded?: boolean;
7
- }
8
- declare const Skeleton: ({ children, className, innerClassName, isLoaded, }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
9
- export default Skeleton;
@@ -1 +0,0 @@
1
- import{jsx as e}from"react/jsx-runtime";import a from"../../common/cn.js";const s=({children:s,className:n,innerClassName:i,isLoaded:m=!1})=>e("div",Object.assign({className:a("rounded-sm",!m&&"animate-pulse bg-[#E5E7EB] dark:bg-[#1E1E1F]",m&&"animate-none",n)},{children:e("div",Object.assign({className:a("flex items-center",!m&&"opacity-0",i)},{children:s}))}));export{s as default};
@@ -1,12 +0,0 @@
1
- import { type ReactNode, type DetailedHTMLProps, type HTMLAttributes } from "react";
2
- interface ScrollAreaProps {
3
- id?: string;
4
- className?: string;
5
- innerClassName?: string;
6
- children?: ReactNode;
7
- variant?: "height" | "maxHeight";
8
- hideScrollbar?: boolean;
9
- inner?: DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
10
- }
11
- declare const ScrollArea: import("react").ForwardRefExoticComponent<ScrollAreaProps & import("react").RefAttributes<HTMLDivElement>>;
12
- export default ScrollArea;
@@ -1,9 +0,0 @@
1
- import type { ReactNode } from "react";
2
- interface SkeletonProps {
3
- children?: ReactNode;
4
- className?: string;
5
- innerClassName?: string;
6
- isLoaded?: boolean;
7
- }
8
- declare const Skeleton: ({ children, className, innerClassName, isLoaded, }: SkeletonProps) => import("react/jsx-runtime").JSX.Element;
9
- export default Skeleton;