PageSourceSearch

https://v2.dende.ai/assets/index-CmCRt4GN.js

js dende.ai collected 2026-09-25 18:18:31 UTC 5,991 bytes, 1 lines download raw bytes

1import{cY as H,j as e,cZ as P,cJ as Q,H as E,C as V,o as W,A as Y,f as O,v as q,r as x,c_ as G,c$ as J,d0 as Z,d1 as $,bd as K,d2 as X,M as ee,c as C,R as B,c1 as ae}from"./index-C0tFBmn0.js";import{C as se}from"./index-BG6GMeVr.js";import{u as te}from"./useNavigationBlockerWithConfirmation-DKmiuNW_.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"985d6c62c43cf712edd27efda60c4fe03300188e"};var o=new s.Error().stack;o&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[o]="85b6b5e6-ae1b-42b4-99fc-cb8b0f424060",s._sentryDebugIdIdentifier="sentry-dbid-85b6b5e6-ae1b-42b4-99fc-cb8b0f424060")}catch{}})();const M=({name:s,control:o,minHeightClassName:n,placeholder:c})=>{const{field:{value:t,onChange:m,onBlur:f,ref:u,name:g},fieldState:{error:r,invalid:h}}=H({name:s,control:o});return e.jsxs("div",{className:"w-full",children:[e.jsx(P,{ref:u,name:g,value:t??"",onChange:l=>m(l.target.value),onBlur:f,"aria-invalid":h,placeholder:c,className:Q("resize-none bg-background",n,h&&"border-destructive focus-visible:ring-destructive")}
1),r!=null&&r.message?e.jsx("p",{className:"mt-1.5 text-xs sm:text-sm text-destructive",role:"alert",children:r.message}):null]})},ne=()=>e.jsxs("div",{className:"w-full flex flex-col gap-4 animate-pulse py-1",children:[e.jsx("div",{className:"h-4 w-1/4 bg-gray-200 rounded"}),e.jsx("div",{className:"h-24 w-full bg-gray-200 rounded-md"}),e.jsx("div",{className:"h-4 w-1/4 bg-gray-200 rounded"}),e.jsx("div",{className:"h-40 w-full bg-gray-200 rounded-md"})]}),re=()=>e.jsx("div",{className:"pt-10 sm:pt-20 flex flex-col gap-8 items-center w-full pb-10 animate-pulse",children:e.jsxs("div",{className:"w-full max-w-[680px] flex flex-col gap-6 px-5 md:px-10",children:[e.jsxs(E,{className:"w-full px-5 py-4",children:[e.jsx("div",{className:"h-4 w-1/4 bg-gray-200 rounded mb-3"}),e.jsx("div",{className:"h-20 w-full bg-gray-200 rounded"})]}),e.jsxs(E,{className:"w-full px-5 py-4",children:[e.jsx("div",{className:"h-4 w-1/4 bg-gray-200 rounded mb-3"}),e.jsx("div",{className:"h-20 w-full bg-gray-200 rounded"})]})]})}),le=(s={})=>{const n=(s.variant??"page")==="embedded",{state:c}=V(),t=W(),{flashcardId:m}=Y(),f=n?s.embeddedFlashcardId:m,{translate:u}=O(),{setFlashcard:g,setFlashcardId:r}=q(),[h,l]=x.useState(!1),{data:a,isLoading:v}=G({flashcardId:f||""},{skip:!f}),[w,d]=J(),j=x.useMemo(()=>{if(a!=null&&a.data)return Z($({translate:u,originalValues:{front:a.data.front,back:a.data.back}}))},[a,u]),b=K({defaultValues:{front:(a==null?void 0:a.data.front)||"",back:(a==null?void 0:a.data.back)||""},resolver:j,reValidateMode:"onChange"}),{control:F,reset:p,handleSubmit:T}=b,{isDirty:y,errors:S}=X({control:F}),D=Object.keys(S).length>0,R=i=>{!y||!f||(w({flashcardId:f,status:null,front:i.front,back:i.back}),p(i))},N=()=>{!m||(c==null?void 0:c.navigatedFrom)!==ee.Quiz||(r(m),g(null),t(-1),p())},k=()=>{var i;(i=s.onEmbeddedClose)==null||i.call(s)},U=()=>{p(),l(!1),n?k():N()},I=()=>{if(!y){n?k():N();return}l(!0)},{handleConfirmSave:z,handleConfirmDiscard:A}=te({hasUnsavedChanges:y,handleOpenConfirmationModal:I,onSaveChanges:T(R),onDiscardChanges:U});return x.useEffect(()=>{a!=null&&a.data&&p({front:a.data.front,back:a.data.back})},[a,p]),x.useEffect(()=>{var i;if(d.isSuccess)if(h&&l(!1),n){const{front:L,back:_}=d.originalArgs??{};typeof L=="string"&&typeof _=="string"&&((i=s.onEmbeddedSaveSuccess)==null||i.call(s,L,_)),k()}else N()},[d]),{form:b,control:F,isDirty:y,hasErrors:D,errors:S,flashcardData:a==null?void 0:a.data,stateOnUpdateFlashcardData:d,isFlashcardDataLoading:v,showConfirmCancelChanges:h,handleConfirmDiscard:A,handleConfirmSave:z,handleOpenConfirmationModal:I}},de=({variant:s="page",embeddedFlashcardId:o,onEmbeddedSaveSuccess:n,onEmbeddedClose:c}={})=>{const t=s==="embedded",m=x.useMemo(()=>t?{variant:"embedded",embeddedFlashcardId:o,onEmbeddedSaveSuccess:n,onEmbeddedClose:c}:{},[t,o,n,c]),{form:f,control:u,hasErrors:g,stateOnUpdateFlashcardData:r,isFlashcardDataLoading:h,showConfirmCancelChanges:l,handleConfirmDiscard:a,handleConfirmSave:v,handleOpenConfirmationModal:w}=le(m),{translate:d}=O();if(x.useEffect(()=>{t||scrollTo({top:0,behavior:"smooth"})},[t]),h)return t?e.jsx(ne,{}):e.jsx(re,{});const j=e.jsxs("div",{className:C("flex flex-col gap-6 w-full",!t&&"flex-1 mb-[41px]"),children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-sm text-grey-dark-stripe ",children:d("pages.hideEditBookmark.question")}),e.jsx(M,{name:"front",control:u,minHeightClassName:"min-h-[110px]"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("p",{className:"text-sm text-grey-dark-stripe ",children:d("pages.hideEditBookmark.answer")}),e.jsx(M,{name:"back",control:u,minHeightClassName:"min-h-[210px]"})]})]}),b=e.jsxs("div",{className:C("flex justify-center gap-[14px]",t&&"mt-2"),children:[e.jsx(B,{type:"button",variant:"neutral",disabled:r.isLoading,onClick:w,children:d("pages.hideEditBookmark.discardChanges")}),e.jsx(B,{type:"button",variant:"primary",disabled:r.isLoading||g,onClick:v,children:d("pages.hideEditBookmark.saveChanges")})]});return e.jsxs("div",{className:C(!t&&"relative mx-3 md:mx-0"),children:[l&&e.jsx(se,{isSaveLoading:r.isLoading,handleConfirmWithoutSaving:a,handleSaveChanges:v}),e.jsx(ae,{...f,children:e.jsx("form",{className:C(!t&&"pt-10 sm:pt-20 flex flex-col gap-8 items-center w-full pb-10",t&&"flex flex-col gap-4 w-full",l&&!t&&"filter grayscale-5 blur-[1px] opacity-40 cursor-not-allowed pointer-events-none",l&&t&&"relative filter grayscale-5 blur-[1px] opacity-40 cursor-not-allowed pointer-events-none"),children:t?e.jsxs(e.Fragment,{children:[j,b]}):e.jsxs(E,{divider:null,className:"w-full max-w-[702px] bg-white px-[48px] py-[34px] flex flex-col",children:[j,b]})})})]})},fe=Object.freeze(Object.defineProperty({__proto__:null,EditFlashcard:de},Symbol.toStringTag,{value:"Module"}));
1export{M as C,de as E,fe as i};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.