@pickaxeproject/react 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),o=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("../../../hooks/pickaxe/useConversation.js"),d=require("../../../hooks/pickaxe/useSubmit.js"),c=require("../../../hooks/pickaxe/useSubmitResult.js"),u=require("../../../common/documents.js"),m=require("../../../common/api/streamer.js"),p=require("../Addons/Document/hooks/useDocument.js"),x=require("../Addons/Scroll/hooks/useScroll.js"),g=require("../../../hooks/core/useHover.js"),h=require("../../../common/utils.js"),f=require("../../Icons/attach-vertical.svg.js"),b=require("../../Icons/spinner-lines.svg.js"),j=require("../../Icons/file.svg.js"),v=require("../../Icons/x.svg.js"),y=require("../../Icons/arrow-right.svg.js"),k=require("../common/PickaxeBranding.js"),w=require("../Addons/IceBreaker/index.js"),I=require("../../Core/Textarea.js"),O=require("../../../common/error.js"),C=require("../../../common/cn.js");exports.default=()=>{var N;const{formId:q,chatId:R,userId:S,studioUserId:D,deploymentId:A,pickaxe:E,styles:_,colors:T,misc:U,chatInput:H,responsiveBy:B,forceMobile:M,isNewChat:P,setIsNewChat:F,setIsShowIceBreaker:L,onGenerateComplete:z}=o.usePickaxeContext(),{messages:W,status:G,limits:$,isGenerating:K,setMessages:X,setStatus:J,setLimitData:Q,setError:V,setIsGenerating:Y}=r.useResponseContext(),{isMobile:Z}=i.useDimensionContext(),{documents:ee,isUploading:se,isImageUploadAllowed:te,upsertDocuments:oe,onFileUpload:re}=p.useDocument(),{scrollStartSession:ie,scrollEndSession:ne,scrollToBottom:ae}=x.useScroll({auto:!0}),le=l.useConversation(),de=d.useSubmit(),ce=c.useSubmitResult(),ue=a.useStyleFontSize(),me=n.useStyleInput(),[pe,xe]=t.useState(H),ge=t.useRef(null),he=g.useHover(),{isHover:fe}=he,be=e.__rest(he,["isHover"]),je=g.useHover(),{isHover:ve}=je,ye=e.__rest(je,["isHover"]),ke=t.useMemo((()=>{var e,s,t;return!!P&&(!!E&&(!le.isLoading&&(!((null!==(s=null===(e=le.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,P,le.data,le.isLoading]),we=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if(se||"idle"!==G||K)return;const e=null!=s?s:pe;if(!e)return;xe(""),V(""),Q(null),Y(!0),F(!1);const t=new Date,o="enduserupload"===(null==E?void 0:E.documentuploadtype),r=ee.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";J("fetching"),ie(),ae();const n=Array.from(W);let a=[...n,{id:W.length+1,role:"user",content:e}];X(a),ae();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:p,endUserImageId:x,rawUserInput:g,error:h}=yield de.mutateAsync(Object.assign(Object.assign(Object.assign({formId:q,responseId:R,value:e},o&&i&&{documentId:i}),D&&{studioUserId:D}),A&&{deploymentId:A}));if(!l)throw new Error(null!=h?h:"An error occurred, please try again.");const f=[];p&&f.push(p),x&&f.push(x),f.length>0&&(a=[...n,Object.assign({id:W.length+1,role:"user",content:e},f&&{documentIds:f})],X(a),ae()),oe([]),ae();const b=(yield m.streamer({formId:q,responseId:R,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const j=b.getReader(),v=new TextDecoder,y=a.length;let k="",w=!0,I=!1;for(;w;){const{value:e,done:s}=yield j.read();w=!s;const t=v.decode(e);if(t.startsWith("[PXE-ERROR]"))throw new Error(t.replace("[PXE-ERROR]","").trim());if(k+=t.replace(/\u200B/g,""),k)I||(J("streaming"),I=!0),X([...a.slice(0,y),{id:W.length+1,role:"assistant",content:k}]);else if(!w&&!k)throw new Error("Server error")}const O=new Date;k&&(ae(),yield ce.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:q,responseId:R,documentIds:u},S&&{userId:S}),D&&{studioUserId:D}),D&&(null==E?void 0:E.studioid)&&{studioId:E.studioid}),A&&{deploymentId:A}),{messages:[Object.assign(Object.assign({role:"user",message:g},f&&{documentIds:f}),{sentAt:t}),{role:"assistant",message:k,sentAt:O}]})),J("idle"),null==z||z(R))}catch(e){let s=O.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries($).find((([e])=>s.includes(e)));t?Q(t[1]):V(s),ae()}finally{J("idle"),Y(!1),ne()}}));return t.useEffect((()=>{L(ke)}),[ke]),t.useEffect((()=>{xe(H)}),[H]),s.jsxs("div",Object.assign({className:C.default("fixed flex w-full flex-col bottom-0 left-0","viewport"===B?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!U.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s.jsx(k.default,{animateHover:!0})})),ke&&s.jsx(w.default,{data:(null==E?void 0:E.icebreakers)||[],onSend:we}),s.jsxs("div",Object.assign({id:(null==E?void 0:E.formid)+"--chat-parent",style:Object.assign(Object.assign({},me),(Z||M)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:C.default("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===_.formFieldStyle&&"shadow")},{children:["idle"===G&&ee.length>0&&s.jsx("div",Object.assign({className:C.default("grid grid-cols-1","viewport"===B?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ee.map((e=>{var o,r,i;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:me.borderRadius,borderColor:T.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:T.accent,borderRadius:me.borderRadius}},{children:se?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:T.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:T.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(C.default(ue.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:C.default(ue.b4,"opacity-80 truncate")},{children:h.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:se||"idle"!==G,onClick:()=>oe([]),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:T.accent,borderColor:me.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:T.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:me.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:me.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:me.borderRadius,backgroundColor:T.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:se||"idle"!==G,onClick:()=>oe([]),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:T.accent,borderColor:me.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:T.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s.jsx(I.default,{id:(null==E?void 0:E.formid)+"--chat-textarea",className:C.default(ue.b2,"max-h-60 mb-[0.2em] w-full border-transparent bg-transparent",!pe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:pe,placeholder:null!==(N=null==E?void 0:E.placeholdertext)&&void 0!==N?N:"What do you want to talk about?",onChange:e=>xe(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),se||"idle"!==G||we()))}}),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:ve?T.accent+"10":void 0},disabled:se||"idle"!==G,onClick:()=>{var e;return null===(e=ge.current)||void 0===e?void 0:e.click()}},ye,{children:[s.jsx("input",{id:"file-upload",ref:ge,type:"file",accept:[...u.allowedFileMimeTypes,...te?u.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield re(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(f.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:ve?T.accent:T.accent+"80"}})]})),s.jsx("button",Object.assign({id:(null==E?void 0:E.formid)+"--chat-button",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:(fe||pe.length||ee.length&&ee.every((e=>"finished"===e.status)))&&!K?T.accent:T.accent+"10"},disabled:se||"idle"!==G,onClick:()=>we()},be,{children:s.jsx(y.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(fe||pe.length||ee.length&&ee.every((e=>"finished"===e.status)))&&!K?T.accentText:T.accent+"80"}})}))]}))]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),o=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("../../../hooks/pickaxe/useConversation.js"),d=require("../../../hooks/pickaxe/useSubmit.js"),c=require("../../../hooks/pickaxe/useSubmitResult.js"),u=require("../../../common/documents.js"),m=require("../../../common/api/streamer.js"),p=require("../Addons/Document/hooks/useDocument.js"),g=require("../Addons/Scroll/hooks/useScroll.js"),x=require("../../../hooks/core/useHover.js"),h=require("../../../common/utils.js"),f=require("../../Icons/attach-vertical.svg.js"),b=require("../../Icons/spinner-lines.svg.js"),j=require("../../Icons/file.svg.js"),v=require("../../Icons/x.svg.js"),y=require("../../Icons/arrow-right.svg.js"),k=require("../common/PickaxeBranding.js"),w=require("../Addons/IceBreaker/index.js"),I=require("../../Core/Textarea.js"),O=require("../../../common/error.js"),C=require("../../../common/cn.js");exports.default=()=>{var N;const{formId:q,chatId:R,userId:S,studioUserId:D,deploymentId:A,pickaxe:E,styles:_,colors:T,misc:U,responsiveBy:H,forceMobile:B,isNewChat:M,setIsNewChat:P,setIsShowIceBreaker:F,onGenerateComplete:L}=o.usePickaxeContext(),{messages:z,status:W,limits:G,isGenerating:$,setMessages:K,setStatus:X,setLimitData:J,setError:Q,setIsGenerating:V}=r.useResponseContext(),{isMobile:Y}=i.useDimensionContext(),{documents:Z,isUploading:ee,isImageUploadAllowed:se,upsertDocuments:te,onFileUpload:oe}=p.useDocument(),{scrollStartSession:re,scrollEndSession:ie,scrollToBottom:ne}=g.useScroll({auto:!0}),ae=l.useConversation(),le=d.useSubmit(),de=c.useSubmitResult(),ce=a.useStyleFontSize(),ue=n.useStyleInput(),[me,pe]=t.useState(""),ge=t.useRef(null),xe=x.useHover(),{isHover:he}=xe,fe=e.__rest(xe,["isHover"]),be=x.useHover(),{isHover:je}=be,ve=e.__rest(be,["isHover"]),ye=t.useMemo((()=>{var e,s,t;return!!M&&(!!E&&(!ae.isLoading&&(!((null!==(s=null===(e=ae.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,M,ae.data,ae.isLoading]),ke=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if(ee||"idle"!==W||$)return;const e=null!=s?s:me;if(!e)return;pe(""),Q(""),J(null),V(!0),P(!1);const t=new Date,o="enduserupload"===(null==E?void 0:E.documentuploadtype),r=Z.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";X("fetching"),re(),ne();const n=Array.from(z);let a=[...n,{id:z.length+1,role:"user",content:e}];K(a),ne();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:p,endUserImageId:g,rawUserInput:x,error:h}=yield le.mutateAsync(Object.assign(Object.assign(Object.assign({formId:q,responseId:R,value:e},o&&i&&{documentId:i}),D&&{studioUserId:D}),A&&{deploymentId:A}));if(!l)throw new Error(null!=h?h:"An error occurred, please try again.");const f=[];p&&f.push(p),g&&f.push(g),f.length>0&&(a=[...n,Object.assign({id:z.length+1,role:"user",content:e},f&&{documentIds:f})],K(a),ne()),te([]),ne();const b=(yield m.streamer({formId:q,responseId:R,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const j=b.getReader(),v=new TextDecoder,y=a.length;let k="",w=!0,I=!1;for(;w;){const{value:e,done:s}=yield j.read();w=!s;const t=v.decode(e);if(t.startsWith("[PXE-ERROR]"))throw new Error(t.replace("[PXE-ERROR]","").trim());if(k+=t.replace(/\u200B/g,""),k)I||(X("streaming"),I=!0),K([...a.slice(0,y),{id:z.length+1,role:"assistant",content:k}]);else if(!w&&!k)throw new Error("Server error")}const O=new Date;k&&(ne(),yield de.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:q,responseId:R,documentIds:u},S&&{userId:S}),D&&{studioUserId:D}),D&&(null==E?void 0:E.studioid)&&{studioId:E.studioid}),A&&{deploymentId:A}),{messages:[Object.assign(Object.assign({role:"user",message:x},f&&{documentIds:f}),{sentAt:t}),{role:"assistant",message:k,sentAt:O}]})),X("idle"),null==L||L(R))}catch(e){let s=O.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(G).find((([e])=>s.includes(e)));t?J(t[1]):Q(s),ne()}finally{X("idle"),V(!1),ie()}}));return t.useEffect((()=>{F(ye)}),[ye]),s.jsxs("div",Object.assign({className:C.default("fixed flex w-full flex-col bottom-0 left-0","viewport"===H?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!U.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s.jsx(k.default,{animateHover:!0})})),ye&&s.jsx(w.default,{data:(null==E?void 0:E.icebreakers)||[],onSend:ke}),s.jsxs("div",Object.assign({style:Object.assign(Object.assign({},ue),(Y||B)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:C.default("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===_.formFieldStyle&&"shadow")},{children:["idle"===W&&Z.length>0&&s.jsx("div",Object.assign({className:C.default("grid grid-cols-1","viewport"===H?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:Z.map((e=>{var o,r,i;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:ue.borderRadius,borderColor:T.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:T.accent,borderRadius:ue.borderRadius}},{children:ee?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:T.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:T.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(C.default(ce.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:C.default(ce.b4,"opacity-80 truncate")},{children:h.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:ee||"idle"!==W,onClick:()=>te([]),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:T.accent,borderColor:ue.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:T.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ue.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:ue.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ue.borderRadius,backgroundColor:T.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:ee||"idle"!==W,onClick:()=>te([]),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:T.accent,borderColor:ue.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:T.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s.jsx(I.default,{className:C.default(ce.i1,"max-h-60 mb-[0.2em] w-full border-transparent bg-transparent",!me.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:me,placeholder:null!==(N=null==E?void 0:E.placeholdertext)&&void 0!==N?N:"What do you want to talk about?",onChange:e=>pe(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ee||"idle"!==W||ke()))}}),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:je?T.accent+"10":void 0},disabled:ee||"idle"!==W,onClick:()=>{var e;return null===(e=ge.current)||void 0===e?void 0:e.click()}},ve,{children:[s.jsx("input",{id:"file-upload",ref:ge,type:"file",accept:[...u.allowedFileMimeTypes,...se?u.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield oe(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(f.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:je?T.accent:T.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)))&&!$?T.accent:T.accent+"10"},disabled:ee||"idle"!==W,onClick:()=>ke()},fe,{children:s.jsx(y.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(he||me.length||Z.length&&Z.every((e=>"finished"===e.status)))&&!$?T.accentText:T.accent+"80"}})}))]}))]}))]}))]}))};
@@ -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"),o=require("../../Addons/Document/hooks/useDocument.js"),i=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"),b=require("../../../Icons/spinner-lines.svg.js"),m=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=i.useHover(),{isHover:q}=C,I=e.__rest(C,["isHover"]),{documents:R,documentError:T,websiteLink:_,isUploading:D,isImageUploadAllowed:F,upsertDocuments:S,setDocumentError:A,setWebsiteLink:U,onFileUpload:z,onWebsiteUpload:E}=o.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:!1,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.b2,"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:R.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(b.default,{className:"w-5 h-5 animate-spin",style:{color:w.accentText}}):s.jsx(m.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([]),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([]),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(b.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:"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S([]),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"),o=require("../../Addons/Document/hooks/useDocument.js"),i=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=i.useHover(),{isHover:q}=C,I=e.__rest(C,["isHover"]),{documents:R,documentError:T,websiteLink:_,isUploading:D,isImageUploadAllowed:F,upsertDocuments:S,setDocumentError:A,setWebsiteLink:U,onFileUpload:z,onWebsiteUpload:E}=o.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:!1,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:R.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([]),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([]),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:"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:D,onClick:()=>S([]),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 +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"),a=require("../../../../hooks/studio/useStyleInput.js"),n=require("../../../../hooks/studio/useStyleFontSize.js"),r=require("@nem035/gpt-3-encoder"),i=require("../../../Core/Textarea.js"),l=require("../../../../common/cn.js");exports.default=({field:c,update:u})=>{const d=n.useStyleFontSize(),{styles:p,colors:x}=t.usePickaxeContext(),{setError:h}=o.useResponseContext(),[g,m]=s.useState(!1),j=a.useStyleInput();return e.jsxs("div",Object.assign({className:"group relative flex flex-col gap-y-1"},{children:[e.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-1"},{children:[e.jsx("p",Object.assign({className:l.default(d.b3,"font-semibold opacity-70")},{children:c.main})),c.isRequired&&e.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:x.accent}},{children:"*"}))]})),e.jsx(i.default,{className:l.default(d.b2,"rounded-sm border border-transparent px-4 py-3 duration-300 ease-in-out transition-all placeholder:font-semilight",c.maxLength<10&&"max-w-[400px]","block"===p.formFieldStyle&&"shadow hover:shadow-none"),style:j,placeholder:c.example,rows:1,value:c.input,tabIndex:c.order,onChange:e=>{h("");const s=r.encode(e).length;u(Object.assign(Object.assign({},c),{input:e,length:s}))},onFocus:()=>m(!0),onBlur:()=>m(!1)})]})),e.jsx("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e.jsxs("p",Object.assign({className:l.default(d.b4,"font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",c.length>c.maxLength&&"text-c-red opacity-100",g&&"opacity-100")},{children:[c.length,"/",c.maxLength]}))}))]}))};
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"),a=require("../../../../hooks/studio/useStyleInput.js"),n=require("../../../../hooks/studio/useStyleFontSize.js"),r=require("@nem035/gpt-3-encoder"),i=require("../../../Core/Textarea.js"),l=require("../../../../common/cn.js");exports.default=({field:c,update:u})=>{const d=n.useStyleFontSize(),{styles:p,colors:x}=t.usePickaxeContext(),{setError:h}=o.useResponseContext(),[g,m]=s.useState(!1),j=a.useStyleInput();return e.jsxs("div",Object.assign({className:"group relative flex flex-col gap-y-1"},{children:[e.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-1"},{children:[e.jsx("p",Object.assign({className:l.default(d.b3,"font-semibold opacity-70")},{children:c.main})),c.isRequired&&e.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:x.accent}},{children:"*"}))]})),e.jsx(i.default,{className:l.default(d.i1,"rounded-sm border border-transparent px-4 py-3 duration-300 ease-in-out transition-all placeholder:font-semilight",c.maxLength<10&&"max-w-[400px]","block"===p.formFieldStyle&&"shadow hover:shadow-none"),style:j,placeholder:c.example,rows:1,value:c.input,tabIndex:c.order,onChange:e=>{h("");const s=r.encode(e).length;u(Object.assign(Object.assign({},c),{input:e,length:s}))},onFocus:()=>m(!0),onBlur:()=>m(!1)})]})),e.jsx("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e.jsxs("p",Object.assign({className:l.default(d.b4,"font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",c.length>c.maxLength&&"text-c-red opacity-100",g&&"opacity-100")},{children:[c.length,"/",c.maxLength]}))}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),a=require("../../hooks/usePickaxeMarkdownContext.js"),o=require("../common/Action.js"),i=require("../Img/index.js"),n=require("../common/Audio.js"),u=require("../common/Html/index.js"),l=require("../../../../../../common/api/utils.js"),c=require("../../../../../../common/error.js");exports.default=({node:d,href:m="",children:f})=>{const{accentColor:p,websiteMetadatas:h,actions:w,setWebsiteMetadatas:j}=a.usePickaxeMarkdownContext(),b=r.useMemo((()=>{if(!m)return"";return m.startsWith("http://")?`https://${m.slice(7)}`:m.startsWith("www.")?`https://${m}`:m}),[m]),g=r.useMemo((()=>{var e;const t=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[b]),x=r.useMemo((()=>b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[b]),v=r.useMemo((()=>b.includes("action_generated_files")&&b.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[b]),y=r.useMemo((()=>b.includes("action_generated_files")&&b.match(/\.html$/)),[b]),_=r.useMemo((()=>w&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))),[w,b]);return s.useQuery({queryKey:["website-metadata",b],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return t=b,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield l.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=c.default(e);console.error("[getJobResult]",t)}return null}}));var t})),enabled:!1,retry:2,onSuccess:e=>{e&&e.title&&(h.some((t=>t.href===e.href))||j((t=>[...t,e])))}}),g?t.jsx("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${g}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px",backgroundColor:"#000000"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))})):x?t.jsx(i.default,{src:b,alt:"string"==typeof f?f:"Markdown Image"}):v?t.jsx(n.default,{url:b}):y?t.jsx(u.default,{url:b}):_?t.jsx(o.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:p}},{children:f}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),a=require("../../hooks/usePickaxeMarkdownContext.js"),o=require("../common/Action.js"),i=require("../Img/index.js"),n=require("../common/Audio.js"),l=require("../common/Html/index.js"),u=require("../../../../../../common/api/utils.js"),c=require("../../../../../../common/error.js");exports.default=({node:d,href:m="",children:p})=>{const{accentColor:f,websiteMetadatas:h,actions:w,setWebsiteMetadatas:j}=a.usePickaxeMarkdownContext(),b=r.useMemo((()=>{if(!m)return"";return m.startsWith("http://")?`https://${m.slice(7)}`:m.startsWith("www.")?`https://${m}`:m}),[m]),x=r.useMemo((()=>{var e;const t=b.match(/(?:https?:\/\/)?(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[b]),v=r.useMemo((()=>{var e;const t=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[b]),g=r.useMemo((()=>b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[b]),_=r.useMemo((()=>b.includes("action_generated_files")&&b.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[b]),y=r.useMemo((()=>b.includes("action_generated_files")&&b.match(/\.html$/)),[b]),q=r.useMemo((()=>w&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))),[w,b]);return s.useQuery({queryKey:["website-metadata",b],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return t=b,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield u.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=c.default(e);console.error("[getJobResult]",t)}return null}}));var t})),enabled:!1,retry:2,onSuccess:e=>{e&&e.title&&(h.some((t=>t.href===e.href))||j((t=>[...t,e])))}}),x?t.jsx("div",Object.assign({className:"pxe-markdown-loom"},{children:t.jsx("iframe",Object.assign({title:"loom-embed",src:`https://www.loom.com/embed/${x}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",minHeight:"315px"}},{children:"Iframe not supported, use a different browser."}))})):v?t.jsx("div",Object.assign({className:"pxe-markdown-youtube"},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${v}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))})):g?t.jsx(i.default,{src:b,alt:"string"==typeof p?p:"Markdown Image"}):_?t.jsx(n.default,{url:b}):y?t.jsx(l.default,{url:b}):q?t.jsx(o.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:f}},{children:p}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../common/Action.js");exports.default=({node:i,children:n})=>{const{actions:r}=t.usePickaxeMarkdownContext(),l="string"==typeof n&&n.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(l&&(null==l?void 0:l[1]))return e.jsx("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${l[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(r&&"string"==typeof n&&n.includes("pickaxe")&&(n.includes("/api/fn/result")||n.includes("/api/function_call_results"))){const t=n.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=n.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e.jsx("p",{children:t}),e.jsx(s.default,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e.jsx("p",{children:n})};
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("../common/Action.js");exports.default=({node:i,children:n})=>{const{actions:l}=r.usePickaxeMarkdownContext(),o=t.useMemo((()=>{var e;if("string"!=typeof n)return null;const t=n.match(/(?:https?:\/\/)?(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[n]),u=t.useMemo((()=>{var e;if("string"!=typeof n)return null;const t=n.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[n]);if(o)return e.jsx("div",Object.assign({className:"pxe-markdown-loom"},{children:e.jsx("iframe",Object.assign({title:"loom-embed",src:`https://www.loom.com/embed/${o}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",minHeight:"315px"}},{children:"Iframe not supported, use a different browser."}))}));if(u)return e.jsx("div",Object.assign({className:"pxe-markdown-youtube"},{children:e.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${u}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(l&&"string"==typeof n&&n.includes("pickaxe")&&(n.includes("/api/fn/result")||n.includes("/api/function_call_results"))){const t=n.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),r=n.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e.jsx("p",{children:t}),e.jsx(s.default,{jobUrl:(null==r?void 0:r[0])||""})]}))}return e.jsx("p",{children:n})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var x=require("react"),t=require("../pickaxe/usePickaxeContext.js");const p={viewport:{lg:{h1:"text-[72px] max-[1024px]:text-[56px] max-[899px]:text-[32px]",h2:"text-[56px] max-[1024px]:text-[40px] max-[899px]:text-[26px] leading-[1.2]",h3:"text-[40px] max-[1024px]:text-[32px] max-[899px]:text-[20px]",h4:"text-[32px] max-[1024px]:text-[24px] max-[899px]:text-[18px]",b1:"text-[24px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b3:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b4:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",l1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",l2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]"},md:{h1:"text-[56px] max-[1024px]:text-[48px] max-[899px]:text-[28px]",h2:"text-[40px] max-[1024px]:text-[34px] max-[899px]:text-[22px] leading-[1.2]",h3:"text-[32px] max-[1024px]:text-[30px] max-[899px]:text-[20px]",h4:"text-[24px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",b1:"text-[20px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[12px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]"},sm:{h1:"text-[48px] max-[1024px]:text-[34px] max-[899px]:text-[24px]",h2:"text-[34px] max-[1024px]:text-[28px] max-[899px]:text-[20px] leading-[1.2]",h3:"text-[28px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",h4:"text-[20px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[10px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]"}},container:{lg:{h1:"text-[32px] @[899px]/pickaxe-root:text-[56px] @[1024px]/pickaxe-root:text-[72px]",h2:"text-[26px] @[899px]/pickaxe-root:text-[40px] @[1024px]/pickaxe-root:text-[56px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[32px] @[1024px]/pickaxe-root:text-[40px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[24px] @[1024px]/pickaxe-root:text-[32px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[24px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]"},md:{h1:"text-[28px] @[899px]/pickaxe-root:text-[48px] @[1024px]/pickaxe-root:text-[56px]",h2:"text-[22px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[40px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[30px] @[1024px]/pickaxe-root:text-[32px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[24px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[20px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]"},sm:{h1:"text-[24px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[48px]",h2:"text-[20px] @[899px]/pickaxe-root:text-[28px] @[1024px]/pickaxe-root:text-[34px]",h3:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[28px]",h4:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[20px]",b1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[10px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]"}}};exports.fontSizeMap=p,exports.useStyleFontSize=({size:e}={})=>{const{styles:o,responsiveBy:a}=t.usePickaxeContext();return x.useMemo((()=>p[a][e||o.fontSize||"md"]),[e,o,a])};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var x=require("react"),t=require("../pickaxe/usePickaxeContext.js");const p={viewport:{lg:{h1:"text-[72px] max-[1024px]:text-[56px] max-[899px]:text-[32px]",h2:"text-[56px] max-[1024px]:text-[40px] max-[899px]:text-[26px] leading-[1.2]",h3:"text-[40px] max-[1024px]:text-[32px] max-[899px]:text-[20px]",h4:"text-[32px] max-[1024px]:text-[24px] max-[899px]:text-[18px]",b1:"text-[24px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b3:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b4:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",l1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",l2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",i1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]"},md:{h1:"text-[56px] max-[1024px]:text-[48px] max-[899px]:text-[28px]",h2:"text-[40px] max-[1024px]:text-[34px] max-[899px]:text-[22px] leading-[1.2]",h3:"text-[32px] max-[1024px]:text-[30px] max-[899px]:text-[20px]",h4:"text-[24px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",b1:"text-[20px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[12px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]",i1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]"},sm:{h1:"text-[48px] max-[1024px]:text-[34px] max-[899px]:text-[24px]",h2:"text-[34px] max-[1024px]:text-[28px] max-[899px]:text-[20px] leading-[1.2]",h3:"text-[28px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",h4:"text-[20px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[10px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",i1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]"}},container:{lg:{h1:"text-[32px] @[899px]/pickaxe-root:text-[56px] @[1024px]/pickaxe-root:text-[72px]",h2:"text-[26px] @[899px]/pickaxe-root:text-[40px] @[1024px]/pickaxe-root:text-[56px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[32px] @[1024px]/pickaxe-root:text-[40px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[24px] @[1024px]/pickaxe-root:text-[32px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[24px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",i1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]"},md:{h1:"text-[28px] @[899px]/pickaxe-root:text-[48px] @[1024px]/pickaxe-root:text-[56px]",h2:"text-[22px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[40px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[30px] @[1024px]/pickaxe-root:text-[32px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[24px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[20px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",i1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]"},sm:{h1:"text-[24px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[48px]",h2:"text-[20px] @[899px]/pickaxe-root:text-[28px] @[1024px]/pickaxe-root:text-[34px]",h3:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[28px]",h4:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[20px]",b1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[10px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",i1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]"}}};exports.fontSizeMap=p,exports.useStyleFontSize=({size:e}={})=>{const{styles:o,responsiveBy:a}=t.usePickaxeContext();return x.useMemo((()=>p[a][e||o.fontSize||"md"]),[e,o,a])};
@@ -1 +1 @@
1
- .pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-code{margin-bottom:1.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px 10px 14px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child){margin-top:2.5rem}.pxe-prose>pre:not(:first-child){margin-top:1rem}.pxe-prose .pxe-markdown-code{display:flex;flex-direction:column}.pxe-prose .pxe-markdown-code>div:first-child{background-color:#1d1f21;border-radius:.3em;display:flex;flex-direction:column;max-width:min-content;padding-top:1em;position:relative}.pxe-prose .pxe-markdown-code>div:first-child>div:first-child{display:flex;justify-content:flex-end;padding:0 1em}.pxe-prose .pxe-markdown-code>div:first-child>div:last-child{overflow:auto}.pxe-prose .pxe-action[data-action-id]:not(:nth-child(2)){margin-top:1rem}.pxe-prose .pxe-markdown-code-inline{background-color:#1d1f21;border-radius:.3em;color:#fff;font-size:10pt;padding:.15em .4em}.pxe-prose .pxe-animated-token{animation:fadeIn .3s ease-out forwards;display:inline-block;opacity:0}.pxe-link-previews{display:flex;flex-direction:column;gap:2rem}.pxe-prose>p:first-child>.pxe-markdown-image,.pxe-prose>p:first-child>.pxe-markdown-youtube{margin-top:0}@keyframes fadeIn{0%{opacity:0;transform:translateX(5px)}to{opacity:1;transform:translateX(0)}}
1
+ .pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-loom{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-loom,.pxe-prose .pxe-markdown-youtube{display:flex;justify-content:center;width:100%}.pxe-prose .pxe-markdown-youtube{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-code{margin-bottom:1.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px 10px 14px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child){margin-top:2.5rem}.pxe-prose>pre:not(:first-child){margin-top:1rem}.pxe-prose .pxe-markdown-code{display:flex;flex-direction:column}.pxe-prose .pxe-markdown-code>div:first-child{background-color:#1d1f21;border-radius:.3em;display:flex;flex-direction:column;max-width:min-content;padding-top:1em;position:relative}.pxe-prose .pxe-markdown-code>div:first-child>div:first-child{display:flex;justify-content:flex-end;padding:0 1em}.pxe-prose .pxe-markdown-code>div:first-child>div:last-child{overflow:auto}.pxe-prose .pxe-action[data-action-id]:not(:nth-child(2)){margin-top:1rem}.pxe-prose .pxe-markdown-code-inline{background-color:#1d1f21;border-radius:.3em;color:#fff;font-size:10pt;padding:.15em .4em}.pxe-prose .pxe-animated-token{animation:fadeIn .3s ease-out forwards;display:inline-block;opacity:0}.pxe-link-previews{display:flex;flex-direction:column;gap:2rem}.pxe-prose>p:first-child>.pxe-markdown-image,.pxe-prose>p:first-child>.pxe-markdown-youtube{margin-top:0}@keyframes fadeIn{0%{opacity:0;transform:translateX(5px)}to{opacity:1;transform:translateX(0)}}
@@ -1,4 +1,4 @@
1
- import type { FC, ComponentPropsWithoutRef } from "react";
1
+ import { type FC, type ComponentPropsWithoutRef } from "react";
2
2
  import type { Node } from "../../Renderer";
3
3
  declare const P: FC<ComponentPropsWithoutRef<"p"> & Node>;
4
4
  export default P;
@@ -1,6 +1,6 @@
1
1
  import type { StudioFontSize } from "../../types/studio";
2
2
  import type { PickaxeResponsiveBy } from "../../components/Pickaxe/Provider";
3
- export type FontSizeType = "h1" | "h2" | "h3" | "h4" | "b1" | "b2" | "b3" | "b4" | "l1" | "l2";
3
+ export type FontSizeType = "h1" | "h2" | "h3" | "h4" | "b1" | "b2" | "b3" | "b4" | "l1" | "l2" | "i1";
4
4
  export type FontListType = Record<FontSizeType, string>;
5
5
  export declare const fontSizeMap: Record<PickaxeResponsiveBy, Record<StudioFontSize, Record<FontSizeType, string>>>;
6
6
  interface UseStyleFontSizeOptions {
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as a,Fragment as l}from"react";import{usePickaxeContext as d}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as u}from"../../../hooks/pickaxe/useDimensionContext.js";import{useStyleInput as m}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as p}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as f}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as h}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as g}from"../../../hooks/pickaxe/useSubmitResult.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as v}from"../../../common/documents.js";import{streamer as x}from"../../../common/api/streamer.js";import{useDocument as j}from"../Addons/Document/hooks/useDocument.js";import{useScroll as y}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as k}from"../../../hooks/core/useHover.js";import{formatBytes as w}from"../../../common/utils.js";import I from"../../Icons/attach-vertical.svg.js";import O from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import C from"../../Icons/x.svg.js";import R from"../../Icons/arrow-right.svg.js";import S from"../common/PickaxeBranding.js";import D from"../Addons/IceBreaker/index.js";import A from"../../Core/Textarea.js";import E from"../../../common/error.js";import U from"../../../common/cn.js";const T=()=>{var T;const{formId:B,chatId:H,userId:L,studioUserId:P,deploymentId:W,pickaxe:z,styles:F,colors:G,misc:M,chatInput:$,responsiveBy:K,forceMobile:X,isNewChat:_,setIsNewChat:q,setIsShowIceBreaker:J,onGenerateComplete:Q}=d(),{messages:V,status:Y,limits:Z,isGenerating:ee,setMessages:te,setStatus:oe,setLimitData:se,setError:re,setIsGenerating:ie}=c(),{isMobile:ne}=u(),{documents:ae,isUploading:le,isImageUploadAllowed:de,upsertDocuments:ce,onFileUpload:ue}=j(),{scrollStartSession:me,scrollEndSession:pe,scrollToBottom:fe}=y({auto:!0}),he=f(),ge=h(),be=g(),ve=p(),xe=m(),[je,ye]=r($),ke=i(null),we=k(),{isHover:Ie}=we,Oe=e(we,["isHover"]),Ne=k(),{isHover:Ce}=Ne,Re=e(Ne,["isHover"]),Se=n((()=>{var e,t,o;return!!_&&(!!z&&(!he.isLoading&&(!((null!==(t=null===(e=he.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(o=z.icebreakers)||void 0===o?void 0:o.length))))}),[z,_,he.data,he.isLoading]),De=e=>t(void 0,void 0,void 0,(function*(){try{if(le||"idle"!==Y||ee)return;const t=null!=e?e:je;if(!t)return;ye(""),re(""),se(null),ie(!0),q(!1);const o=new Date,s="enduserupload"===(null==z?void 0:z.documentuploadtype),r=ae.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";oe("fetching"),me(),fe();const n=Array.from(V);let a=[...n,{id:V.length+1,role:"user",content:t}];te(a),fe();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:m,endUserImageId:p,rawUserInput:f,error:h}=yield ge.mutateAsync(Object.assign(Object.assign(Object.assign({formId:B,responseId:H,value:t},s&&i&&{documentId:i}),P&&{studioUserId:P}),W&&{deploymentId:W}));if(!l)throw new Error(null!=h?h:"An error occurred, please try again.");const g=[];m&&g.push(m),p&&g.push(p),g.length>0&&(a=[...n,Object.assign({id:V.length+1,role:"user",content:t},g&&{documentIds:g})],te(a),fe()),ce([]),fe();const b=(yield x({formId:B,responseId:H,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const v=b.getReader(),j=new TextDecoder,y=a.length;let k="",w=!0,I=!1;for(;w;){const{value:e,done:t}=yield v.read();w=!t;const o=j.decode(e);if(o.startsWith("[PXE-ERROR]"))throw new Error(o.replace("[PXE-ERROR]","").trim());if(k+=o.replace(/\u200B/g,""),k)I||(oe("streaming"),I=!0),te([...a.slice(0,y),{id:V.length+1,role:"assistant",content:k}]);else if(!w&&!k)throw new Error("Server error")}const O=new Date;k&&(fe(),yield be.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:B,responseId:H,documentIds:u},L&&{userId:L}),P&&{studioUserId:P}),P&&(null==z?void 0:z.studioid)&&{studioId:z.studioid}),W&&{deploymentId:W}),{messages:[Object.assign(Object.assign({role:"user",message:f},g&&{documentIds:g}),{sentAt:o}),{role:"assistant",message:k,sentAt:O}]})),oe("idle"),null==Q||Q(H))}catch(e){let t=E(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(Z).find((([e])=>t.includes(e)));o?se(o[1]):re(t),fe()}finally{oe("idle"),ie(!1),pe()}}));return a((()=>{J(Se)}),[Se]),a((()=>{ye($)}),[$]),o("div",Object.assign({className:U("fixed flex w-full flex-col bottom-0 left-0","viewport"===K?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!M.isWhiteLabel&&s("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s(S,{animateHover:!0})})),Se&&s(D,{data:(null==z?void 0:z.icebreakers)||[],onSend:De}),o("div",Object.assign({id:(null==z?void 0:z.formid)+"--chat-parent",style:Object.assign(Object.assign({},xe),(ne||X)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:U("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===F.formFieldStyle&&"shadow")},{children:["idle"===Y&&ae.length>0&&s("div",Object.assign({className:U("grid grid-cols-1","viewport"===K?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ae.map((e=>{var t,r,i;return s(l,{children:"document"===e.type?o("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:xe.borderRadius,borderColor:G.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:G.accent,borderRadius:xe.borderRadius}},{children:le?s(O,{className:"w-5 h-5 animate-spin",style:{color:G.accentText}}):s(N,{className:"w-5 h-5",style:{color:G.accentText}})})),o("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s("p",Object.assign({className:(U(ve.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:U(ve.b4,"opacity-80 truncate")},{children:w(e.size)}))]})),s("button",Object.assign({type:"button",disabled:le||"idle"!==Y,onClick:()=>ce([]),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:G.accent,borderColor:xe.backgroundColor}},{children:s(C,{className:"w-4 h-4",style:{color:G.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:xe.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:xe.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:xe.borderRadius,backgroundColor:G.secondary}}),s("button",Object.assign({type:"button",disabled:le||"idle"!==Y,onClick:()=>ce([]),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:G.accent,borderColor:xe.backgroundColor}},{children:s(C,{className:"w-4 h-4",style:{color:G.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s(A,{id:(null==z?void 0:z.formid)+"--chat-textarea",className:U(ve.b2,"max-h-60 mb-[0.2em] w-full border-transparent bg-transparent",!je.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:je,placeholder:null!==(T=null==z?void 0:z.placeholdertext)&&void 0!==T?T:"What do you want to talk about?",onChange:e=>ye(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),le||"idle"!==Y||De()))}}),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==z?void 0:z.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:Ce?G.accent+"10":void 0},disabled:le||"idle"!==Y,onClick:()=>{var e;return null===(e=ke.current)||void 0===e?void 0:e.click()}},Re,{children:[s("input",{id:"file-upload",ref:ke,type:"file",accept:[...b,...de?v:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield ue(Array.from(e.target.files||[])),e.target.value=""}))}),s(I,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ce?G.accent:G.accent+"80"}})]})),s("button",Object.assign({id:(null==z?void 0:z.formid)+"--chat-button",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:(Ie||je.length||ae.length&&ae.every((e=>"finished"===e.status)))&&!ee?G.accent:G.accent+"10"},disabled:le||"idle"!==Y,onClick:()=>De()},Oe,{children:s(R,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(Ie||je.length||ae.length&&ae.every((e=>"finished"===e.status)))&&!ee?G.accentText:G.accent+"80"}})}))]}))]}))]}))]}))};export{T as default};
1
+ import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsxs as s,jsx as o}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as a,Fragment as l}from"react";import{usePickaxeContext as d}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as u}from"../../../hooks/pickaxe/useDimensionContext.js";import{useStyleInput as m}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as p}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as f}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as g}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as h}from"../../../hooks/pickaxe/useSubmitResult.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as v}from"../../../common/documents.js";import{streamer as x}from"../../../common/api/streamer.js";import{useDocument as j}from"../Addons/Document/hooks/useDocument.js";import{useScroll as y}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as k}from"../../../hooks/core/useHover.js";import{formatBytes as w}from"../../../common/utils.js";import I from"../../Icons/attach-vertical.svg.js";import O from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import C from"../../Icons/x.svg.js";import R from"../../Icons/arrow-right.svg.js";import S from"../common/PickaxeBranding.js";import D from"../Addons/IceBreaker/index.js";import A from"../../Core/Textarea.js";import E from"../../../common/error.js";import U from"../../../common/cn.js";const T=()=>{var T;const{formId:B,chatId:H,userId:L,studioUserId:P,deploymentId:W,pickaxe:z,styles:F,colors:G,misc:M,responsiveBy:$,forceMobile:K,isNewChat:X,setIsNewChat:_,setIsShowIceBreaker:q,onGenerateComplete:J}=d(),{messages:Q,status:V,limits:Y,isGenerating:Z,setMessages:ee,setStatus:te,setLimitData:se,setError:oe,setIsGenerating:re}=c(),{isMobile:ie}=u(),{documents:ne,isUploading:ae,isImageUploadAllowed:le,upsertDocuments:de,onFileUpload:ce}=j(),{scrollStartSession:ue,scrollEndSession:me,scrollToBottom:pe}=y({auto:!0}),fe=f(),ge=g(),he=h(),be=p(),ve=m(),[xe,je]=r(""),ye=i(null),ke=k(),{isHover:we}=ke,Ie=e(ke,["isHover"]),Oe=k(),{isHover:Ne}=Oe,Ce=e(Oe,["isHover"]),Re=n((()=>{var e,t,s;return!!X&&(!!z&&(!fe.isLoading&&(!((null!==(t=null===(e=fe.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=z.icebreakers)||void 0===s?void 0:s.length))))}),[z,X,fe.data,fe.isLoading]),Se=e=>t(void 0,void 0,void 0,(function*(){try{if(ae||"idle"!==V||Z)return;const t=null!=e?e:xe;if(!t)return;je(""),oe(""),se(null),re(!0),_(!1);const s=new Date,o="enduserupload"===(null==z?void 0:z.documentuploadtype),r=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";te("fetching"),ue(),pe();const n=Array.from(Q);let a=[...n,{id:Q.length+1,role:"user",content:t}];ee(a),pe();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:m,endUserImageId:p,rawUserInput:f,error:g}=yield ge.mutateAsync(Object.assign(Object.assign(Object.assign({formId:B,responseId:H,value:t},o&&i&&{documentId:i}),P&&{studioUserId:P}),W&&{deploymentId:W}));if(!l)throw new Error(null!=g?g:"An error occurred, please try again.");const h=[];m&&h.push(m),p&&h.push(p),h.length>0&&(a=[...n,Object.assign({id:Q.length+1,role:"user",content:t},h&&{documentIds:h})],ee(a),pe()),de([]),pe();const b=(yield x({formId:B,responseId:H,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const v=b.getReader(),j=new TextDecoder,y=a.length;let k="",w=!0,I=!1;for(;w;){const{value:e,done:t}=yield v.read();w=!t;const s=j.decode(e);if(s.startsWith("[PXE-ERROR]"))throw new Error(s.replace("[PXE-ERROR]","").trim());if(k+=s.replace(/\u200B/g,""),k)I||(te("streaming"),I=!0),ee([...a.slice(0,y),{id:Q.length+1,role:"assistant",content:k}]);else if(!w&&!k)throw new Error("Server error")}const O=new Date;k&&(pe(),yield he.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:B,responseId:H,documentIds:u},L&&{userId:L}),P&&{studioUserId:P}),P&&(null==z?void 0:z.studioid)&&{studioId:z.studioid}),W&&{deploymentId:W}),{messages:[Object.assign(Object.assign({role:"user",message:f},h&&{documentIds:h}),{sentAt:s}),{role:"assistant",message:k,sentAt:O}]})),te("idle"),null==J||J(H))}catch(e){let t=E(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(Y).find((([e])=>t.includes(e)));s?se(s[1]):oe(t),pe()}finally{te("idle"),re(!1),me()}}));return a((()=>{q(Re)}),[Re]),s("div",Object.assign({className:U("fixed flex w-full flex-col bottom-0 left-0","viewport"===$?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!M.isWhiteLabel&&o("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:o(S,{animateHover:!0})})),Re&&o(D,{data:(null==z?void 0:z.icebreakers)||[],onSend:Se}),s("div",Object.assign({style:Object.assign(Object.assign({},ve),(ie||K)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:U("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===F.formFieldStyle&&"shadow")},{children:["idle"===V&&ne.length>0&&o("div",Object.assign({className:U("grid grid-cols-1","viewport"===$?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ne.map((e=>{var t,r,i;return o(l,{children:"document"===e.type?s("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:ve.borderRadius,borderColor:G.secondaryText+"50"}},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:G.accent,borderRadius:ve.borderRadius}},{children:ae?o(O,{className:"w-5 h-5 animate-spin",style:{color:G.accentText}}):o(N,{className:"w-5 h-5",style:{color:G.accentText}})})),s("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(U(be.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:U(be.b4,"opacity-80 truncate")},{children:w(e.size)}))]})),o("button",Object.assign({type:"button",disabled:ae||"idle"!==V,onClick:()=>de([]),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:G.accent,borderColor:ve.backgroundColor}},{children:o(C,{className:"w-4 h-4",style:{color:G.accentText}})}))]})):"image"===e.type?s("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ve.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:ve.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:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ve.borderRadius,backgroundColor:G.secondary}}),o("button",Object.assign({type:"button",disabled:ae||"idle"!==V,onClick:()=>de([]),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:G.accent,borderColor:ve.backgroundColor}},{children:o(C,{className:"w-4 h-4",style:{color:G.accentText}})}))]})):null},e.id)}))})),s("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[o(A,{className:U(be.i1,"max-h-60 mb-[0.2em] w-full border-transparent bg-transparent",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:xe,placeholder:null!==(T=null==z?void 0:z.placeholdertext)&&void 0!==T?T:"What do you want to talk about?",onChange:e=>je(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ae||"idle"!==V||Se()))}}),s("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==z?void 0:z.documentuploadtype)&&s("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:Ne?G.accent+"10":void 0},disabled:ae||"idle"!==V,onClick:()=>{var e;return null===(e=ye.current)||void 0===e?void 0:e.click()}},Ce,{children:[o("input",{id:"file-upload",ref:ye,type:"file",accept:[...b,...le?v:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield ce(Array.from(e.target.files||[])),e.target.value=""}))}),o(I,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ne?G.accent:G.accent+"80"}})]})),o("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)))&&!Z?G.accent:G.accent+"10"},disabled:ae||"idle"!==V,onClick:()=>Se()},Ie,{children:o(R,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!Z?G.accentText:G.accent+"80"}})}))]}))]}))]}))]}))};export{T 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 r,Fragment as n}from"react";import{usePickaxeContext as i}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 N from"../../../Core/ErrorAlert.js";import w from"../../../../common/cn.js";const k=({field:k,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=i(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,upsertDocuments:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[K,Q]=a(!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: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:!1,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.b2,"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:E.map((e=>{var s,l,a;return o(n,{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:(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:()=>$([]),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:()=>$([]),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:(w(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:w(R.b4,"opacity-80 truncate")},{children:"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),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(N,{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 a,useRef as r,Fragment as n}from"react";import{usePickaxeContext as i}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 N from"../../../Core/ErrorAlert.js";import w from"../../../../common/cn.js";const k=({field:k,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=i(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,upsertDocuments:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[K,Q]=a(!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: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:!1,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:E.map((e=>{var s,l,a;return o(n,{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:(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:()=>$([]),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:()=>$([]),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:(w(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:w(R.b4,"opacity-80 truncate")},{children:"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),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(N,{error:z,className:"mt-3"})]}))};export{k as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as a}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as n}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as r}from"../../../../hooks/studio/useStyleFontSize.js";import{encode as i}from"@nem035/gpt-3-encoder";import c from"../../../Core/Textarea.js";import l from"../../../../common/cn.js";const m=({field:m,update:p})=>{const d=r(),{styles:h,colors:g}=s(),{setError:u}=a(),[x,b]=t(!1),f=n();return e("div",Object.assign({className:"group relative flex flex-col gap-y-1"},{children:[e("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:l(d.b3,"font-semibold opacity-70")},{children:m.main})),m.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:g.accent}},{children:"*"}))]})),o(c,{className:l(d.b2,"rounded-sm border border-transparent px-4 py-3 duration-300 ease-in-out transition-all placeholder:font-semilight",m.maxLength<10&&"max-w-[400px]","block"===h.formFieldStyle&&"shadow hover:shadow-none"),style:f,placeholder:m.example,rows:1,value:m.input,tabIndex:m.order,onChange:e=>{u("");const o=i(e).length;p(Object.assign(Object.assign({},m),{input:e,length:o}))},onFocus:()=>b(!0),onBlur:()=>b(!1)})]})),o("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e("p",Object.assign({className:l(d.b4,"font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",m.length>m.maxLength&&"text-c-red opacity-100",x&&"opacity-100")},{children:[m.length,"/",m.maxLength]}))}))]}))};export{m as default};
1
+ import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as a}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as n}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as r}from"../../../../hooks/studio/useStyleFontSize.js";import{encode as i}from"@nem035/gpt-3-encoder";import c from"../../../Core/Textarea.js";import l from"../../../../common/cn.js";const m=({field:m,update:p})=>{const d=r(),{styles:h,colors:g}=s(),{setError:u}=a(),[x,f]=t(!1),b=n();return e("div",Object.assign({className:"group relative flex flex-col gap-y-1"},{children:[e("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:l(d.b3,"font-semibold opacity-70")},{children:m.main})),m.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:g.accent}},{children:"*"}))]})),o(c,{className:l(d.i1,"rounded-sm border border-transparent px-4 py-3 duration-300 ease-in-out transition-all placeholder:font-semilight",m.maxLength<10&&"max-w-[400px]","block"===h.formFieldStyle&&"shadow hover:shadow-none"),style:b,placeholder:m.example,rows:1,value:m.input,tabIndex:m.order,onChange:e=>{u("");const o=i(e).length;p(Object.assign(Object.assign({},m),{input:e,length:o}))},onFocus:()=>f(!0),onBlur:()=>f(!1)})]})),o("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e("p",Object.assign({className:l(d.b4,"font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",m.length>m.maxLength&&"text-c-red opacity-100",x&&"opacity-100")},{children:[m.length,"/",m.maxLength]}))}))]}))};export{m as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{useQuery as o}from"@tanstack/react-query";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import a from"../common/Action.js";import n from"../Img/index.js";import s from"../common/Audio.js";import l from"../common/Html/index.js";import c from"../../../../../../common/api/utils.js";import m from"../../../../../../common/error.js";const u=({node:u,href:d="",children:p})=>{const{accentColor:f,websiteMetadatas:h,actions:w,setWebsiteMetadatas:b}=i(),g=r((()=>{if(!d)return"";return d.startsWith("http://")?`https://${d.slice(7)}`:d.startsWith("www.")?`https://${d}`:d}),[d]),v=r((()=>{var e;const t=g.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[g]),j=r((()=>g.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[g]),y=r((()=>g.includes("action_generated_files")&&g.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[g]),x=r((()=>g.includes("action_generated_files")&&g.match(/\.html$/)),[g]),_=r((()=>w&&g.includes("pickaxe")&&(g.includes("/api/fn/result")||g.includes("/api/function_call_results"))),[w,g]);return o({queryKey:["website-metadata",g],queryFn:()=>e(void 0,void 0,void 0,(function*(){return t=g,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield c.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=m(e);console.error("[getJobResult]",t)}return null}}));var t})),enabled:!1,retry:2,onSuccess:e=>{e&&e.title&&(h.some((t=>t.href===e.href))||b((t=>[...t,e])))}}),v?t("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${v}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px",backgroundColor:"#000000"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))})):j?t(n,{src:g,alt:"string"==typeof p?p:"Markdown Image"}):y?t(s,{url:g}):x?t(l,{url:g}):_?t(a,{jobUrl:g}):t("a",Object.assign({href:g,target:"_blank",rel:"noopener noreferrer",style:{color:f}},{children:p}))};export{u as default};
1
+ import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{useQuery as o}from"@tanstack/react-query";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import s from"../common/Action.js";import a from"../Img/index.js";import n from"../common/Audio.js";import l from"../common/Html/index.js";import m from"../../../../../../common/api/utils.js";import c from"../../../../../../common/error.js";const u=({node:u,href:d="",children:p})=>{const{accentColor:f,websiteMetadatas:h,actions:w,setWebsiteMetadatas:b}=i(),g=r((()=>{if(!d)return"";return d.startsWith("http://")?`https://${d.slice(7)}`:d.startsWith("www.")?`https://${d}`:d}),[d]),v=r((()=>{var e;const t=g.match(/(?:https?:\/\/)?(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[g]),j=r((()=>{var e;const t=g.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[g]),x=r((()=>g.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[g]),y=r((()=>g.includes("action_generated_files")&&g.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[g]),_=r((()=>g.includes("action_generated_files")&&g.match(/\.html$/)),[g]),k=r((()=>w&&g.includes("pickaxe")&&(g.includes("/api/fn/result")||g.includes("/api/function_call_results"))),[w,g]);return o({queryKey:["website-metadata",g],queryFn:()=>e(void 0,void 0,void 0,(function*(){return t=g,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield m.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=c(e);console.error("[getJobResult]",t)}return null}}));var t})),enabled:!1,retry:2,onSuccess:e=>{e&&e.title&&(h.some((t=>t.href===e.href))||b((t=>[...t,e])))}}),v?t("div",Object.assign({className:"pxe-markdown-loom"},{children:t("iframe",Object.assign({title:"loom-embed",src:`https://www.loom.com/embed/${v}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",minHeight:"315px"}},{children:"Iframe not supported, use a different browser."}))})):j?t("div",Object.assign({className:"pxe-markdown-youtube"},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${j}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))})):x?t(a,{src:g,alt:"string"==typeof p?p:"Markdown Image"}):y?t(n,{url:g}):_?t(l,{url:g}):k?t(s,{jobUrl:g}):t("a",Object.assign({href:g,target:"_blank",rel:"noopener noreferrer",style:{color:f}},{children:p}))};export{u as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";const s=({node:s,children:l})=>{const{actions:r}=i(),o="string"==typeof l&&l.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(o&&(null==o?void 0:o[1]))return e("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${o[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(r&&"string"==typeof l&&l.includes("pickaxe")&&(l.includes("/api/fn/result")||l.includes("/api/function_call_results"))){const i=l.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),s=l.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e("p",{children:i}),e(n,{jobUrl:(null==s?void 0:s[0])||""})]}))}return e("p",{children:l})};export{s as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as r}from"react";import{usePickaxeMarkdownContext as i}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";const l=({node:l,children:o})=>{const{actions:s}=i(),c=r((()=>{var e;if("string"!=typeof o)return null;const t=o.match(/(?:https?:\/\/)?(?:www\.)?loom\.com\/(?:share|embed)\/([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[o]),u=r((()=>{var e;if("string"!=typeof o)return null;const t=o.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);return t&&null!==(e=null==t?void 0:t[1])&&void 0!==e?e:null}),[o]);if(c)return e("div",Object.assign({className:"pxe-markdown-loom"},{children:e("iframe",Object.assign({title:"loom-embed",src:`https://www.loom.com/embed/${c}`,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",minHeight:"315px"}},{children:"Iframe not supported, use a different browser."}))}));if(u)return e("div",Object.assign({className:"pxe-markdown-youtube"},{children:e("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${u}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(s&&"string"==typeof o&&o.includes("pickaxe")&&(o.includes("/api/fn/result")||o.includes("/api/function_call_results"))){const r=o.replace(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g,""),i=o.match(/https:\/\/\S*(\/api\/fn\/result|\/api\/function_call_results)\S*/g);return t("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e("p",{children:r}),e(n,{jobUrl:(null==i?void 0:i[0])||""})]}))}return e("p",{children:o})};export{l as default};
@@ -1 +1 @@
1
- import{useMemo as x}from"react";import{usePickaxeContext as t}from"../pickaxe/usePickaxeContext.js";const p={viewport:{lg:{h1:"text-[72px] max-[1024px]:text-[56px] max-[899px]:text-[32px]",h2:"text-[56px] max-[1024px]:text-[40px] max-[899px]:text-[26px] leading-[1.2]",h3:"text-[40px] max-[1024px]:text-[32px] max-[899px]:text-[20px]",h4:"text-[32px] max-[1024px]:text-[24px] max-[899px]:text-[18px]",b1:"text-[24px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b3:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b4:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",l1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",l2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]"},md:{h1:"text-[56px] max-[1024px]:text-[48px] max-[899px]:text-[28px]",h2:"text-[40px] max-[1024px]:text-[34px] max-[899px]:text-[22px] leading-[1.2]",h3:"text-[32px] max-[1024px]:text-[30px] max-[899px]:text-[20px]",h4:"text-[24px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",b1:"text-[20px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[12px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]"},sm:{h1:"text-[48px] max-[1024px]:text-[34px] max-[899px]:text-[24px]",h2:"text-[34px] max-[1024px]:text-[28px] max-[899px]:text-[20px] leading-[1.2]",h3:"text-[28px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",h4:"text-[20px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[10px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]"}},container:{lg:{h1:"text-[32px] @[899px]/pickaxe-root:text-[56px] @[1024px]/pickaxe-root:text-[72px]",h2:"text-[26px] @[899px]/pickaxe-root:text-[40px] @[1024px]/pickaxe-root:text-[56px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[32px] @[1024px]/pickaxe-root:text-[40px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[24px] @[1024px]/pickaxe-root:text-[32px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[24px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]"},md:{h1:"text-[28px] @[899px]/pickaxe-root:text-[48px] @[1024px]/pickaxe-root:text-[56px]",h2:"text-[22px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[40px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[30px] @[1024px]/pickaxe-root:text-[32px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[24px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[20px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]"},sm:{h1:"text-[24px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[48px]",h2:"text-[20px] @[899px]/pickaxe-root:text-[28px] @[1024px]/pickaxe-root:text-[34px]",h3:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[28px]",h4:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[20px]",b1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[10px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]"}}},e=({size:e}={})=>{const{styles:o,responsiveBy:a}=t();return x((()=>p[a][e||o.fontSize||"md"]),[e,o,a])};export{p as fontSizeMap,e as useStyleFontSize};
1
+ import{useMemo as x}from"react";import{usePickaxeContext as t}from"../pickaxe/usePickaxeContext.js";const p={viewport:{lg:{h1:"text-[72px] max-[1024px]:text-[56px] max-[899px]:text-[32px]",h2:"text-[56px] max-[1024px]:text-[40px] max-[899px]:text-[26px] leading-[1.2]",h3:"text-[40px] max-[1024px]:text-[32px] max-[899px]:text-[20px]",h4:"text-[32px] max-[1024px]:text-[24px] max-[899px]:text-[18px]",b1:"text-[24px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b3:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b4:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",l1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",l2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",i1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]"},md:{h1:"text-[56px] max-[1024px]:text-[48px] max-[899px]:text-[28px]",h2:"text-[40px] max-[1024px]:text-[34px] max-[899px]:text-[22px] leading-[1.2]",h3:"text-[32px] max-[1024px]:text-[30px] max-[899px]:text-[20px]",h4:"text-[24px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",b1:"text-[20px] max-[1024px]:text-[20px] max-[899px]:text-[18px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[12px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[14px]",i1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]"},sm:{h1:"text-[48px] max-[1024px]:text-[34px] max-[899px]:text-[24px]",h2:"text-[34px] max-[1024px]:text-[28px] max-[899px]:text-[20px] leading-[1.2]",h3:"text-[28px] max-[1024px]:text-[22px] max-[899px]:text-[18px]",h4:"text-[20px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b1:"text-[18px] max-[1024px]:text-[18px] max-[899px]:text-[16px]",b2:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",b3:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",b4:"text-[12px] max-[1024px]:text-[12px] max-[899px]:text-[10px]",l1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[14px]",l2:"text-[14px] max-[1024px]:text-[14px] max-[899px]:text-[12px]",i1:"text-[16px] max-[1024px]:text-[16px] max-[899px]:text-[16px]"}},container:{lg:{h1:"text-[32px] @[899px]/pickaxe-root:text-[56px] @[1024px]/pickaxe-root:text-[72px]",h2:"text-[26px] @[899px]/pickaxe-root:text-[40px] @[1024px]/pickaxe-root:text-[56px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[32px] @[1024px]/pickaxe-root:text-[40px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[24px] @[1024px]/pickaxe-root:text-[32px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[24px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",i1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]"},md:{h1:"text-[28px] @[899px]/pickaxe-root:text-[48px] @[1024px]/pickaxe-root:text-[56px]",h2:"text-[22px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[40px]",h3:"text-[20px] @[899px]/pickaxe-root:text-[30px] @[1024px]/pickaxe-root:text-[32px]",h4:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[24px]",b1:"text-[18px] @[899px]/pickaxe-root:text-[20px] @[1024px]/pickaxe-root:text-[20px]",b2:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[12px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[14px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",i1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]"},sm:{h1:"text-[24px] @[899px]/pickaxe-root:text-[34px] @[1024px]/pickaxe-root:text-[48px]",h2:"text-[20px] @[899px]/pickaxe-root:text-[28px] @[1024px]/pickaxe-root:text-[34px]",h3:"text-[18px] @[899px]/pickaxe-root:text-[22px] @[1024px]/pickaxe-root:text-[28px]",h4:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[20px]",b1:"text-[16px] @[899px]/pickaxe-root:text-[18px] @[1024px]/pickaxe-root:text-[18px]",b2:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",b3:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",b4:"text-[10px] @[899px]/pickaxe-root:text-[12px] @[1024px]/pickaxe-root:text-[12px]",l1:"text-[14px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]",l2:"text-[12px] @[899px]/pickaxe-root:text-[14px] @[1024px]/pickaxe-root:text-[14px]",i1:"text-[16px] @[899px]/pickaxe-root:text-[16px] @[1024px]/pickaxe-root:text-[16px]"}}},e=({size:e}={})=>{const{styles:o,responsiveBy:a}=t();return x((()=>p[a][e||o.fontSize||"md"]),[e,o,a])};export{p as fontSizeMap,e as useStyleFontSize};
@@ -1 +1 @@
1
- .pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-code{margin-bottom:1.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px 10px 14px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child){margin-top:2.5rem}.pxe-prose>pre:not(:first-child){margin-top:1rem}.pxe-prose .pxe-markdown-code{display:flex;flex-direction:column}.pxe-prose .pxe-markdown-code>div:first-child{background-color:#1d1f21;border-radius:.3em;display:flex;flex-direction:column;max-width:min-content;padding-top:1em;position:relative}.pxe-prose .pxe-markdown-code>div:first-child>div:first-child{display:flex;justify-content:flex-end;padding:0 1em}.pxe-prose .pxe-markdown-code>div:first-child>div:last-child{overflow:auto}.pxe-prose .pxe-action[data-action-id]:not(:nth-child(2)){margin-top:1rem}.pxe-prose .pxe-markdown-code-inline{background-color:#1d1f21;border-radius:.3em;color:#fff;font-size:10pt;padding:.15em .4em}.pxe-prose .pxe-animated-token{animation:fadeIn .3s ease-out forwards;display:inline-block;opacity:0}.pxe-link-previews{display:flex;flex-direction:column;gap:2rem}.pxe-prose>p:first-child>.pxe-markdown-image,.pxe-prose>p:first-child>.pxe-markdown-youtube{margin-top:0}@keyframes fadeIn{0%{opacity:0;transform:translateX(5px)}to{opacity:1;transform:translateX(0)}}
1
+ .pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-loom{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-loom,.pxe-prose .pxe-markdown-youtube{display:flex;justify-content:center;width:100%}.pxe-prose .pxe-markdown-youtube{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-code{margin-bottom:1.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px 10px 14px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child){margin-top:2.5rem}.pxe-prose>pre:not(:first-child){margin-top:1rem}.pxe-prose .pxe-markdown-code{display:flex;flex-direction:column}.pxe-prose .pxe-markdown-code>div:first-child{background-color:#1d1f21;border-radius:.3em;display:flex;flex-direction:column;max-width:min-content;padding-top:1em;position:relative}.pxe-prose .pxe-markdown-code>div:first-child>div:first-child{display:flex;justify-content:flex-end;padding:0 1em}.pxe-prose .pxe-markdown-code>div:first-child>div:last-child{overflow:auto}.pxe-prose .pxe-action[data-action-id]:not(:nth-child(2)){margin-top:1rem}.pxe-prose .pxe-markdown-code-inline{background-color:#1d1f21;border-radius:.3em;color:#fff;font-size:10pt;padding:.15em .4em}.pxe-prose .pxe-animated-token{animation:fadeIn .3s ease-out forwards;display:inline-block;opacity:0}.pxe-link-previews{display:flex;flex-direction:column;gap:2rem}.pxe-prose>p:first-child>.pxe-markdown-image,.pxe-prose>p:first-child>.pxe-markdown-youtube{margin-top:0}@keyframes fadeIn{0%{opacity:0;transform:translateX(5px)}to{opacity:1;transform:translateX(0)}}
@@ -1,4 +1,4 @@
1
- import type { FC, ComponentPropsWithoutRef } from "react";
1
+ import { type FC, type ComponentPropsWithoutRef } from "react";
2
2
  import type { Node } from "../../Renderer";
3
3
  declare const P: FC<ComponentPropsWithoutRef<"p"> & Node>;
4
4
  export default P;
@@ -1,6 +1,6 @@
1
1
  import type { StudioFontSize } from "../../types/studio";
2
2
  import type { PickaxeResponsiveBy } from "../../components/Pickaxe/Provider";
3
- export type FontSizeType = "h1" | "h2" | "h3" | "h4" | "b1" | "b2" | "b3" | "b4" | "l1" | "l2";
3
+ export type FontSizeType = "h1" | "h2" | "h3" | "h4" | "b1" | "b2" | "b3" | "b4" | "l1" | "l2" | "i1";
4
4
  export type FontListType = Record<FontSizeType, string>;
5
5
  export declare const fontSizeMap: Record<PickaxeResponsiveBy, Record<StudioFontSize, Record<FontSizeType, string>>>;
6
6
  interface UseStyleFontSizeOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",