@gendive/slide 0.1.4 → 0.1.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.
@@ -248,11 +248,11 @@ ${String(y)}`)}return s&&c&&A.path.startsWith("http")?yield new Promise((y,x)=>{
248
248
 
249
249
  위 조건에 맞는 슬라이드 콘텐츠를 JSON으로 생성해주세요.
250
250
  ${t.language==="ko"?"한국어로 작성하세요.":"Write in English."}`,c=e.model||"gpt-4o",h=(await Xg(c,e,i,C6,1e3,.7)).content.text||"{}";try{const p=h.match(/\{[\s\S]*\}/);if(!p)throw new Error("JSON을 찾을 수 없습니다.");const u=JSON.parse(p[0]);return{layout:t.layout,title:u.title||"",subtitle:u.subtitle||"",content:u.content||"",bulletPoints:u.bulletPoints||[],imagePrompt:u.imagePrompt||""}}catch{throw new Tf("슬라이드 콘텐츠 파싱 실패")}},Jm={generateText:x6,generateSlides:S6,generateSlideContent:w6},uA=()=>{const{status:t,currentFeature:e,error:n,lastTextResponse:s,lastSlideResponse:i,lastImageResponse:c,lastDesignSuggestions:d,providerConfig:h,setStatus:p,setFeature:u,setError:A,setTextResponse:y,setSlideResponse:x,setProviderConfig:S,reset:C}=p6(),T=oe.useCallback(async O=>{if(!h)throw A("AI 제공자가 설정되지 않았습니다."),new Error("AI 제공자가 설정되지 않았습니다.");try{u("text"),p("loading"),A(null);let I;switch(h.provider){case"devdive":I=await Jm.generateText(O,h);break;case"glm":I=await $y.generateText(O,h);break;default:throw new Error(`지원하지 않는 AI 제공자: ${h.provider}`)}return y(I),I}catch(I){const Y=I instanceof iA||I instanceof Tf?I.message:"AI 텍스트 생성 중 오류 발생";throw A(Y),I}},[h,u,p,A,y]),R=oe.useCallback(async O=>{if(!h)throw A("AI 제공자가 설정되지 않았습니다."),new Error("AI 제공자가 설정되지 않았습니다.");try{u("slide"),p("loading"),A(null);let I;switch(h.provider){case"devdive":I=await Jm.generateSlides(O,h);break;case"glm":I=await $y.generateSlides(O,h);break;default:throw new Error(`지원하지 않는 AI 제공자: ${h.provider}`)}return x(I),I}catch(I){const Y=I instanceof iA||I instanceof Tf?I.message:"AI 슬라이드 생성 중 오류 발생";throw A(Y),I}},[h,u,p,A,x]),D=oe.useCallback(async O=>{throw A("이미지 생성은 아직 지원되지 않습니다."),new Error("이미지 생성은 아직 지원되지 않습니다.")},[A]),M=oe.useCallback(async O=>{throw A("디자인 제안은 아직 지원되지 않습니다."),new Error("디자인 제안은 아직 지원되지 않습니다.")},[A]),P=oe.useCallback(async O=>{if(!h)throw new Error("AI 제공자가 설정되지 않았습니다.");if(h.provider!=="devdive")throw new Error("슬라이드 콘텐츠 생성은 DevDive만 지원합니다.");return Jm.generateSlideContent(O,h)},[h]);return{status:t,currentFeature:e,error:n,isLoading:t==="loading",isSuccess:t==="success",isError:t==="error",providerConfig:h,setProviderConfig:S,lastTextResponse:s,lastSlideResponse:i,lastImageResponse:c,lastDesignSuggestions:d,generateText:T,generateSlides:R,generateSlideContent:P,generateImage:D,suggestDesign:M,reset:C}},_6=t=>{const e=[],n=t.split(/\[슬라이드 번호\]/g).filter(Boolean);for(const s of n){const i=E6(s);i&&e.push(i)}return e},E6=t=>{const e=t.trim().split(`
251
- `);if(e.length===0)return null;const n=e[0].trim(),s=c=>{const d=new RegExp(`\\[${c}\\]\\s*(.*)`,"i");for(const h of e){const p=h.match(d);if(p)return p[1].trim()}return""},i=()=>{var h;const c=[];let d=!1;for(const p of e){if(p.includes("[핵심 포인트]")){d=!0;const u=(h=p.split("[핵심 포인트]")[1])==null?void 0:h.trim();u&&c.push(u);continue}if(d){if(p.includes("[")&&p.includes("]"))break;const u=p.trim();u&&c.push(u)}}return c};return{slideNumber:n,sectionType:s("섹션 타입"),recommendedLayout:s("추천 레이아웃"),visualElements:s("추천 시각 요소"),layoutReason:s("레이아웃 선택 이유"),sectionTitle:s("섹션 제목"),summary:s("요약"),keyPoints:i(),keywords:s("키워드").split(",").map(c=>c.trim()).filter(Boolean)}},Sr=()=>`el-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,T6=t=>{const e=t.recommendedLayout.toLowerCase(),n=t.visualElements.toLowerCase(),s=["image","graph","chart","infographic","diagram","icon","그래프","차트","이미지","아이콘","다이어그램"],i=e.includes("image")||e.includes("graph")||e.includes("chart"),c=s.some(d=>n.includes(d));return i||c},R6=t=>{const e=t.recommendedLayout.toLowerCase();return e.includes("image_left")||e.includes("left")?"left":e.includes("image_right")||e.includes("right")?"right":e.includes("bottom")||e.includes("graph")?"bottom":"right"},e2=(t,e,n,s,i,c="이미지")=>[{id:Sr(),type:"shape",shapeType:"rect",x:t,y:e,width:n,height:s,rotation:0,fill:i.primary+"08",stroke:i.primary+"30",strokeWidth:2,cornerRadius:12},{id:Sr(),type:"shape",shapeType:"rect",x:t+n/2-30,y:e+s/2-40,width:60,height:60,rotation:0,fill:i.primary+"15",stroke:"transparent",strokeWidth:0,cornerRadius:30},{id:Sr(),type:"text",content:c,x:t,y:e+s/2+30,width:n,height:24,rotation:0,fontSize:12,fontFamily:"Malgun Gothic",fill:i.primary+"80",align:"center",textStyle:"caption",fontWeight:"500",lineHeight:1}],t2=(t,e=fs.devdive)=>{const n=[],s=t.sectionType==="cover"||t.sectionType==="closing",i=T6(t),c=i?R6(t):"none";if(s)n.push({id:Sr(),type:"shape",shapeType:"rect",x:0,y:0,width:12,height:540,rotation:0,fill:e.primary,stroke:"transparent",strokeWidth:0,cornerRadius:0}),i&&n.push(...e2(620,80,280,180,e,t.visualElements||"이미지")),n.push({id:Sr(),type:"shape",shapeType:"rect",x:60,y:400,width:200,height:4,rotation:0,fill:e.accent,stroke:"transparent",strokeWidth:0,cornerRadius:2}),n.push({id:Sr(),type:"text",content:t.sectionTitle,x:60,y:180,width:i?500:840,height:100,rotation:0,fontSize:48,fontFamily:"Malgun Gothic",fill:e.text,align:"left",textStyle:"title",fontWeight:"800",lineHeight:1.1}),t.summary&&n.push({id:Sr(),type:"text",content:t.summary,x:60,y:300,width:i?500:700,height:80,rotation:0,fontSize:20,fontFamily:"Malgun Gothic",fill:"#64748b",align:"left",textStyle:"subtitle",fontWeight:"400",lineHeight:1.5}),n.push({id:Sr(),type:"text",content:t.slideNumber.padStart(2,"0"),x:860,y:480,width:80,height:40,rotation:0,fontSize:14,fontFamily:"Malgun Gothic",fill:"#94a3b8",align:"right",textStyle:"caption",fontWeight:"500",lineHeight:1});else{const d=c==="left"?420:60,h=i&&c!=="bottom"?480:840,p=c==="left"?40:620,u=c==="bottom"?340:140,A=c==="bottom"?400:280,y=c==="bottom"?160:240;n.push({id:Sr(),type:"shape",shapeType:"rect",x:0,y:0,width:960,height:100,rotation:0,fill:e.primary+"10",stroke:"transparent",strokeWidth:0,cornerRadius:0}),n.push({id:Sr(),type:"text",content:t.sectionTitle,x:60,y:30,width:760,height:50,rotation:0,fontSize:32,fontFamily:"Malgun Gothic",fill:e.text,align:"left",textStyle:"title",fontWeight:"700",lineHeight:1.2}),n.push({id:Sr(),type:"shape",shapeType:"rect",x:860,y:30,width:50,height:50,rotation:0,fill:e.primary,stroke:"transparent",strokeWidth:0,cornerRadius:8}),n.push({id:Sr(),type:"text",content:t.slideNumber.padStart(2,"0"),x:860,y:42,width:50,height:30,rotation:0,fontSize:18,fontFamily:"Malgun Gothic",fill:"#ffffff",align:"center",textStyle:"caption",fontWeight:"700",lineHeight:1});let x=120;if(i&&n.push(...e2(p,u,A,y,e,t.visualElements||"차트/그래프")),t.summary&&(n.push({id:Sr(),type:"text",content:t.summary,x:d,y:x,width:h,height:40,rotation:0,fontSize:16,fontFamily:"Malgun Gothic",fill:"#64748b",align:"left",textStyle:"body",fontWeight:"400",lineHeight:1.5}),x+=50),t.keyPoints.length>0&&(n.push({id:Sr(),type:"shape",shapeType:"rect",x:d,y:x,width:h,height:1,rotation:0,fill:"#e2e8f0",stroke:"transparent",strokeWidth:0,cornerRadius:0}),x+=20,t.keyPoints.forEach(S=>{n.push({id:Sr(),type:"shape",shapeType:"ellipse",x:d,y:x+8,width:8,height:8,rotation:0,fill:e.primary,stroke:"transparent",strokeWidth:0,cornerRadius:0});const C=S.replace(/^[•\-\*]\s*/,"");n.push({id:Sr(),type:"text",content:C,x:d+20,y:x,width:h-20,height:35,rotation:0,fontSize:18,fontFamily:"Malgun Gothic",fill:e.text,align:"left",textStyle:"body",fontWeight:"400",lineHeight:1.6}),x+=45})),t.keywords.length>0){x=480;let S=d;t.keywords.forEach(C=>{const T=C.length*12+24;n.push({id:Sr(),type:"shape",shapeType:"rect",x:S,y:x,width:T,height:28,rotation:0,fill:e.primary+"15",stroke:e.primary+"30",strokeWidth:1,cornerRadius:14}),n.push({id:Sr(),type:"text",content:`#${C}`,x:S,y:x+5,width:T,height:20,rotation:0,fontSize:12,fontFamily:"Malgun Gothic",fill:e.primary,align:"center",textStyle:"caption",fontWeight:"500",lineHeight:1}),S+=T+8})}}return n},D6={title:"제목",subtitle:"소제목",body:"본문",caption:"캡션"},L6=({isOpen:t,onClose:e,onBack:n})=>{const[s,i]=oe.useState(""),[c,d]=oe.useState("body"),[h,p]=oe.useState(null),{generateText:u,isLoading:A,error:y,reset:x}=uA(),{addElement:S}=Ve(),C=()=>`text-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,T=async()=>{if(s.trim())try{const P=await u({prompt:s.trim(),style:c,language:"ko"});p(P.content)}catch{}},R=()=>{if(!h)return;const P=Eu[c],O={id:C(),type:"text",content:h,x:280,y:220,width:400,height:100,rotation:0,fontSize:P.fontSize,fontFamily:"Malgun Gothic",fill:"#1e293b",align:"center",textStyle:c,fontWeight:P.fontWeight,lineHeight:P.lineHeight};S(O),D()},D=()=>{i(""),p(null),x(),e()},M=()=>{p(null),T()};return w.jsx(z.Modal,{opened:t,onClose:D,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:n,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"arrow_back"})}),w.jsx(z.Text,{fw:700,children:"텍스트 생성"})]}),centered:!0,size:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Textarea,{label:"프롬프트",description:"어떤 텍스트를 생성할지 설명해주세요",placeholder:"예: 인공지능의 미래에 대한 소개 문구",value:s,onChange:P=>i(P.currentTarget.value),minRows:3,autosize:!0}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"텍스트 스타일"}),w.jsx(z.SegmentedControl,{value:c,onChange:P=>d(P),data:Object.entries(D6).map(([P,O])=>({value:P,label:O})),fullWidth:!0,color:"devdive"})]}),y&&w.jsx(z.Alert,{color:"red",variant:"light",children:y}),h&&w.jsxs(z.Paper,{p:"md",radius:"md",withBorder:!0,bg:"gray.0",children:[w.jsxs(z.Group,{justify:"space-between",mb:"xs",children:[w.jsx(z.Text,{size:"sm",fw:500,c:"dimmed",children:"생성된 텍스트"}),w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.CopyButton,{value:h,children:({copied:P,copy:O})=>w.jsx(z.Tooltip,{label:P?"복사됨!":"복사",children:w.jsx(z.ActionIcon,{variant:"subtle",color:P?"teal":"gray",onClick:O,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:P?"check":"content_copy"})})})}),w.jsx(z.Tooltip,{label:"다시 생성",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:M,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"refresh"})})})]})]}),w.jsx(z.Text,{size:c==="title"?"xl":c==="subtitle"?"lg":"sm",fw:c==="title"?700:c==="subtitle"?600:400,children:h})]}),w.jsxs(z.Group,{justify:"flex-end",gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:D,children:"취소"}),h?w.jsx(z.Button,{color:"devdive",onClick:R,children:"슬라이드에 적용"}):w.jsx(z.Button,{color:"devdive",onClick:T,loading:A,disabled:!s.trim(),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"}),children:"생성"})]})]})})},k6=[{value:"cover",label:"커버"},{value:"content",label:"콘텐츠"},{value:"data",label:"데이터/차트"},{value:"closing",label:"클로징"}],N6=({isOpen:t,onClose:e,slide:n,slideIndex:s,onSave:i,onDelete:c})=>{const[d,h]=oe.useState(n),p=(S,C)=>{h(T=>({...T,[S]:C}))},u=S=>{const C=S.split(`
252
- `).filter(T=>T.trim());p("keyPoints",C)},A=S=>{const C=S.split(",").map(T=>T.trim()).filter(Boolean);p("keywords",C)},y=()=>{i(s,d),e()},x=()=>{c(s),e()};return w.jsx(z.Modal,{opened:t,onClose:e,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Badge,{color:"devdive",size:"sm",children:s+1}),w.jsx(z.Text,{fw:700,children:"슬라이드 편집"})]}),centered:!0,size:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Select,{label:"섹션 타입",data:k6,value:d.sectionType,onChange:S=>p("sectionType",S||"content")}),w.jsx(z.TextInput,{label:"제목",value:d.sectionTitle,onChange:S=>p("sectionTitle",S.currentTarget.value),placeholder:"슬라이드 제목"}),w.jsx(z.Textarea,{label:"요약",value:d.summary,onChange:S=>p("summary",S.currentTarget.value),placeholder:"슬라이드 요약 또는 부제목",minRows:2}),w.jsx(z.Textarea,{label:"핵심 포인트",description:"한 줄에 하나씩 입력하세요",value:d.keyPoints.join(`
251
+ `);if(e.length===0)return null;const n=e[0].trim(),s=c=>{const d=new RegExp(`\\[${c}\\]\\s*(.*)`,"i");for(const h of e){const p=h.match(d);if(p)return p[1].trim()}return""},i=()=>{var h;const c=[];let d=!1;for(const p of e){if(p.includes("[핵심 포인트]")){d=!0;const u=(h=p.split("[핵심 포인트]")[1])==null?void 0:h.trim();u&&c.push(u);continue}if(d){if(p.includes("[")&&p.includes("]"))break;const u=p.trim();u&&c.push(u)}}return c};return{slideNumber:n,sectionType:s("섹션 타입"),recommendedLayout:s("추천 레이아웃"),visualElements:s("추천 시각 요소"),layoutReason:s("레이아웃 선택 이유"),sectionTitle:s("섹션 제목"),summary:s("요약"),keyPoints:i(),keywords:s("키워드").split(",").map(c=>c.trim()).filter(Boolean)}},Sr=()=>`el-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,T6=(t,e)=>{let n=0;for(const s of t){const i=/[가-힣ㄱ-ㅎㅏ-ㅣ]/.test(s);n+=i?e*1:e*.6}return Math.ceil(n)},R6=t=>{const e=t.recommendedLayout.toLowerCase(),n=t.visualElements.toLowerCase(),s=["image","graph","chart","infographic","diagram","icon","그래프","차트","이미지","아이콘","다이어그램"],i=e.includes("image")||e.includes("graph")||e.includes("chart"),c=s.some(d=>n.includes(d));return i||c},D6=t=>{const e=t.recommendedLayout.toLowerCase();return e.includes("image_left")||e.includes("left")?"left":e.includes("image_right")||e.includes("right")?"right":e.includes("bottom")||e.includes("graph")?"bottom":"right"},e2=(t,e,n,s,i,c="이미지")=>[{id:Sr(),type:"shape",shapeType:"rect",x:t,y:e,width:n,height:s,rotation:0,fill:i.primary+"08",stroke:i.primary+"30",strokeWidth:2,cornerRadius:12},{id:Sr(),type:"shape",shapeType:"rect",x:t+n/2-30,y:e+s/2-40,width:60,height:60,rotation:0,fill:i.primary+"15",stroke:"transparent",strokeWidth:0,cornerRadius:30},{id:Sr(),type:"text",content:c,x:t,y:e+s/2+30,width:n,height:24,rotation:0,fontSize:12,fontFamily:"Malgun Gothic",fill:i.primary+"80",align:"center",textStyle:"caption",fontWeight:"500",lineHeight:1}],t2=(t,e=fs.devdive)=>{const n=[],s=t.sectionType==="cover"||t.sectionType==="closing",i=R6(t),c=i?D6(t):"none";if(s)n.push({id:Sr(),type:"shape",shapeType:"rect",x:0,y:0,width:12,height:540,rotation:0,fill:e.primary,stroke:"transparent",strokeWidth:0,cornerRadius:0}),i&&n.push(...e2(620,80,280,180,e,t.visualElements||"이미지")),n.push({id:Sr(),type:"shape",shapeType:"rect",x:60,y:400,width:200,height:4,rotation:0,fill:e.accent,stroke:"transparent",strokeWidth:0,cornerRadius:2}),n.push({id:Sr(),type:"text",content:t.sectionTitle,x:60,y:180,width:i?500:840,height:100,rotation:0,fontSize:48,fontFamily:"Malgun Gothic",fill:e.text,align:"left",textStyle:"title",fontWeight:"800",lineHeight:1.1}),t.summary&&n.push({id:Sr(),type:"text",content:t.summary,x:60,y:300,width:i?500:700,height:80,rotation:0,fontSize:20,fontFamily:"Malgun Gothic",fill:"#64748b",align:"left",textStyle:"subtitle",fontWeight:"400",lineHeight:1.5}),n.push({id:Sr(),type:"text",content:t.slideNumber.padStart(2,"0"),x:860,y:480,width:80,height:40,rotation:0,fontSize:14,fontFamily:"Malgun Gothic",fill:"#94a3b8",align:"right",textStyle:"caption",fontWeight:"500",lineHeight:1});else{const d=c==="left"?420:60,h=i&&c!=="bottom"?480:840,p=c==="left"?40:620,u=c==="bottom"?340:140,A=c==="bottom"?400:280,y=c==="bottom"?160:240;n.push({id:Sr(),type:"shape",shapeType:"rect",x:0,y:0,width:960,height:100,rotation:0,fill:e.primary+"10",stroke:"transparent",strokeWidth:0,cornerRadius:0}),n.push({id:Sr(),type:"text",content:t.sectionTitle,x:60,y:30,width:760,height:50,rotation:0,fontSize:32,fontFamily:"Malgun Gothic",fill:e.text,align:"left",textStyle:"title",fontWeight:"700",lineHeight:1.2}),n.push({id:Sr(),type:"shape",shapeType:"rect",x:860,y:30,width:50,height:50,rotation:0,fill:e.primary,stroke:"transparent",strokeWidth:0,cornerRadius:8}),n.push({id:Sr(),type:"text",content:t.slideNumber.padStart(2,"0"),x:860,y:42,width:50,height:30,rotation:0,fontSize:18,fontFamily:"Malgun Gothic",fill:"#ffffff",align:"center",textStyle:"caption",fontWeight:"700",lineHeight:1});let x=120;if(i&&n.push(...e2(p,u,A,y,e,t.visualElements||"차트/그래프")),t.summary&&(n.push({id:Sr(),type:"text",content:t.summary,x:d,y:x,width:h,height:40,rotation:0,fontSize:16,fontFamily:"Malgun Gothic",fill:"#64748b",align:"left",textStyle:"body",fontWeight:"400",lineHeight:1.5}),x+=50),t.keyPoints.length>0&&(n.push({id:Sr(),type:"shape",shapeType:"rect",x:d,y:x,width:h,height:1,rotation:0,fill:"#e2e8f0",stroke:"transparent",strokeWidth:0,cornerRadius:0}),x+=20,t.keyPoints.forEach(S=>{n.push({id:Sr(),type:"shape",shapeType:"ellipse",x:d,y:x+8,width:8,height:8,rotation:0,fill:e.primary,stroke:"transparent",strokeWidth:0,cornerRadius:0});const C=S.replace(/^[•\-\*]\s*/,"");n.push({id:Sr(),type:"text",content:C,x:d+20,y:x,width:h-20,height:35,rotation:0,fontSize:18,fontFamily:"Malgun Gothic",fill:e.text,align:"left",textStyle:"body",fontWeight:"400",lineHeight:1.6}),x+=45})),t.keywords.length>0){x=480;let S=d;t.keywords.forEach(C=>{const T=`#${C}`,R=T6(T,12)+24;n.push({id:Sr(),type:"shape",shapeType:"rect",x:S,y:x,width:R,height:28,rotation:0,fill:e.primary+"15",stroke:e.primary+"30",strokeWidth:1,cornerRadius:14}),n.push({id:Sr(),type:"text",content:`#${C}`,x:S,y:x+5,width:R,height:20,rotation:0,fontSize:12,fontFamily:"Malgun Gothic",fill:e.primary,align:"center",textStyle:"caption",fontWeight:"500",lineHeight:1}),S+=R+8})}}return n},L6={title:"제목",subtitle:"소제목",body:"본문",caption:"캡션"},k6=({isOpen:t,onClose:e,onBack:n})=>{const[s,i]=oe.useState(""),[c,d]=oe.useState("body"),[h,p]=oe.useState(null),{generateText:u,isLoading:A,error:y,reset:x}=uA(),{addElement:S}=Ve(),C=()=>`text-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,T=async()=>{if(s.trim())try{const P=await u({prompt:s.trim(),style:c,language:"ko"});p(P.content)}catch{}},R=()=>{if(!h)return;const P=Eu[c],O={id:C(),type:"text",content:h,x:280,y:220,width:400,height:100,rotation:0,fontSize:P.fontSize,fontFamily:"Malgun Gothic",fill:"#1e293b",align:"center",textStyle:c,fontWeight:P.fontWeight,lineHeight:P.lineHeight};S(O),D()},D=()=>{i(""),p(null),x(),e()},M=()=>{p(null),T()};return w.jsx(z.Modal,{opened:t,onClose:D,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:n,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"arrow_back"})}),w.jsx(z.Text,{fw:700,children:"텍스트 생성"})]}),centered:!0,size:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Textarea,{label:"프롬프트",description:"어떤 텍스트를 생성할지 설명해주세요",placeholder:"예: 인공지능의 미래에 대한 소개 문구",value:s,onChange:P=>i(P.currentTarget.value),minRows:3,autosize:!0}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"텍스트 스타일"}),w.jsx(z.SegmentedControl,{value:c,onChange:P=>d(P),data:Object.entries(L6).map(([P,O])=>({value:P,label:O})),fullWidth:!0,color:"devdive"})]}),y&&w.jsx(z.Alert,{color:"red",variant:"light",children:y}),h&&w.jsxs(z.Paper,{p:"md",radius:"md",withBorder:!0,bg:"gray.0",children:[w.jsxs(z.Group,{justify:"space-between",mb:"xs",children:[w.jsx(z.Text,{size:"sm",fw:500,c:"dimmed",children:"생성된 텍스트"}),w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.CopyButton,{value:h,children:({copied:P,copy:O})=>w.jsx(z.Tooltip,{label:P?"복사됨!":"복사",children:w.jsx(z.ActionIcon,{variant:"subtle",color:P?"teal":"gray",onClick:O,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:P?"check":"content_copy"})})})}),w.jsx(z.Tooltip,{label:"다시 생성",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:M,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"refresh"})})})]})]}),w.jsx(z.Text,{size:c==="title"?"xl":c==="subtitle"?"lg":"sm",fw:c==="title"?700:c==="subtitle"?600:400,children:h})]}),w.jsxs(z.Group,{justify:"flex-end",gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:D,children:"취소"}),h?w.jsx(z.Button,{color:"devdive",onClick:R,children:"슬라이드에 적용"}):w.jsx(z.Button,{color:"devdive",onClick:T,loading:A,disabled:!s.trim(),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"}),children:"생성"})]})]})})},N6=[{value:"cover",label:"커버"},{value:"content",label:"콘텐츠"},{value:"data",label:"데이터/차트"},{value:"closing",label:"클로징"}],B6=({isOpen:t,onClose:e,slide:n,slideIndex:s,onSave:i,onDelete:c})=>{const[d,h]=oe.useState(n),p=(S,C)=>{h(T=>({...T,[S]:C}))},u=S=>{const C=S.split(`
252
+ `).filter(T=>T.trim());p("keyPoints",C)},A=S=>{const C=S.split(",").map(T=>T.trim()).filter(Boolean);p("keywords",C)},y=()=>{i(s,d),e()},x=()=>{c(s),e()};return w.jsx(z.Modal,{opened:t,onClose:e,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Badge,{color:"devdive",size:"sm",children:s+1}),w.jsx(z.Text,{fw:700,children:"슬라이드 편집"})]}),centered:!0,size:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Select,{label:"섹션 타입",data:N6,value:d.sectionType,onChange:S=>p("sectionType",S||"content")}),w.jsx(z.TextInput,{label:"제목",value:d.sectionTitle,onChange:S=>p("sectionTitle",S.currentTarget.value),placeholder:"슬라이드 제목"}),w.jsx(z.Textarea,{label:"요약",value:d.summary,onChange:S=>p("summary",S.currentTarget.value),placeholder:"슬라이드 요약 또는 부제목",minRows:2}),w.jsx(z.Textarea,{label:"핵심 포인트",description:"한 줄에 하나씩 입력하세요",value:d.keyPoints.join(`
253
253
  `),onChange:S=>u(S.currentTarget.value),placeholder:`첫 번째 포인트
254
254
  두 번째 포인트
255
- 세 번째 포인트`,minRows:4,autosize:!0}),w.jsx(z.TextInput,{label:"키워드",description:"쉼표로 구분",value:d.keywords.join(", "),onChange:S=>A(S.currentTarget.value),placeholder:"키워드1, 키워드2, 키워드3"}),w.jsxs(z.Group,{justify:"space-between",mt:"md",children:[w.jsx(z.Button,{variant:"subtle",color:"red",onClick:x,children:"삭제"}),w.jsxs(z.Group,{gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:e,children:"취소"}),w.jsx(z.Button,{color:"devdive",onClick:y,children:"저장"})]})]})]})})},B6=[{value:"business",label:"비즈니스"},{value:"creative",label:"크리에이티브"},{value:"minimal",label:"미니멀"},{value:"educational",label:"교육"}],M6=[{value:"title",label:"표지",icon:"title"},{value:"content",label:"본문",icon:"article"},{value:"bullets",label:"불릿",icon:"format_list_bulleted"},{value:"two-column",label:"2단",icon:"view_column"},{value:"image-left",label:"이미지 좌",icon:"image"},{value:"image-right",label:"이미지 우",icon:"image"},{value:"graph",label:"차트",icon:"insert_chart"}],P6=({isOpen:t,onClose:e,onBack:n})=>{const[s,i]=oe.useState("ai"),[c,d]=oe.useState("input"),[h,p]=oe.useState(0),[u,A]=oe.useState(!1),[y,x]=oe.useState(""),[S,C]=oe.useState(5),[T,R]=oe.useState("business"),[D,M]=oe.useState(!0),[P,O]=oe.useState([]),[I,Y]=oe.useState(null),[K,q]=oe.useState(""),[Q,V]=oe.useState(null),[ge,X]=oe.useState(null),[se,L]=oe.useState(null),[ne,le]=oe.useState("devdive"),{generateSlides:pe,generateSlideContent:J,isLoading:ae,error:re,reset:U}=uA(),ee=async()=>{if(!(!y.trim()||u)){A(!0);try{const j=(await pe({topic:y.trim(),slideCount:S,style:T,includeImages:D,language:"ko"})).slides.map($=>({layout:$.layout,purpose:$.title||"",content:void 0}));O(j),d("structure")}catch{}finally{A(!1)}}},Ee=async()=>{if(P.length===0)return;d("content"),p(0);const G={business:"비즈니스/전문적인 톤",creative:"창의적이고 흥미로운 톤",minimal:"간결하고 핵심만 담은 톤",educational:"교육적이고 설명적인 톤"},j=[];for(let $=0;$<P.length;$++){const ye=P[$];try{const Ce=await J({topic:y.trim(),slideIndex:$,totalSlides:P.length,layout:ye.layout,purpose:ye.purpose,style:G[T],language:"ko"});j.push(Ce),p(($+1)/P.length*100)}catch(Ce){console.error(`슬라이드 ${$+1} 콘텐츠 생성 실패:`,Ce),j.push({layout:ye.layout,title:ye.purpose,subtitle:"",content:"",bulletPoints:[],imagePrompt:""})}}Y(j),d("preview")},Te=(G,j)=>{const $=[...P];$[G]={...$[G],layout:j},O($)},Ne=(G,j)=>{const $=[...P];$[G]={...$[G],purpose:j},O($)},Ue=G=>{P.length<=1||O(P.filter((j,$)=>$!==G))},ot=()=>{O([...P,{layout:"content",purpose:"새 슬라이드"}])},lt=()=>{if(K.trim())try{X(null);const G=_6(K);if(G.length===0){X("슬라이드 데이터를 찾을 수 없습니다. 형식을 확인해주세요.");return}V(G)}catch(G){X("데이터 파싱 중 오류가 발생했습니다."),console.error(G)}},pt=(G,j)=>{if(!Q)return;const $=[...Q];$[G]=j,V($)},Lt=G=>{if(!Q)return;const j=Q.filter(($,ye)=>ye!==G);V(j.length>0?j:null)},qe=()=>{if(!Q)return;const G=fs[ne],j=Ve.getState(),$=j.slides;let Ce=$.length===1&&$[0].elements.length===0;Q.forEach(Ae=>{const ze=t2(Ae,G);if(Ce)j.selectSlide(0),Ce=!1;else{j.addSlide();const Ie=Ve.getState().slides.length-1;j.selectSlide(Ie)}ze.forEach(We=>{Ve.getState().addElement(We)}),Ve.getState().updateSlideBackground(G.background)}),ce()},Dt=(G,j)=>{const $=j===0,ye=j===I.length-1;return{slideNumber:String(j+1),sectionType:$?"cover":ye?"closing":"content",recommendedLayout:G.layout,visualElements:G.imagePrompt||"",layoutReason:"",sectionTitle:G.title||"",summary:G.subtitle||G.content||"",keyPoints:G.bulletPoints||[],keywords:[]}},me=()=>{if(!I)return;const G=fs[ne],j=Ve.getState(),$=j.slides;let Ce=$.length===1&&$[0].elements.length===0;I.forEach((Ae,ze)=>{const We=Dt(Ae,ze),Ie=t2(We,G);if(Ce)j.selectSlide(0),Ce=!1;else{j.addSlide();const Jt=Ve.getState().slides.length-1;j.selectSlide(Jt)}Ie.forEach(dt=>{Ve.getState().addElement(dt)}),Ve.getState().updateSlideBackground(G.background)}),ce()},k=()=>{c==="structure"?d("input"):c==="preview"&&(d("structure"),Y(null))},ce=()=>{x(""),O([]),Y(null),d("input"),p(0),A(!1),q(""),V(null),X(null),U(),e()},de=()=>{switch(c){case"input":return 0;case"structure":return 1;case"content":return 2;case"preview":return 3;default:return 0}};return w.jsxs(z.Modal,{opened:t,onClose:ce,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:c==="input"?n:k,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"arrow_back"})}),w.jsx(z.Text,{fw:700,children:"슬라이드 자동 생성"})]}),centered:!0,size:"lg",children:[w.jsxs(z.Box,{pos:"relative",children:[w.jsx(z.LoadingOverlay,{visible:ae||u||c==="content",zIndex:1e3,overlayProps:{radius:"sm",blur:2},loaderProps:{color:"devdive",type:"dots",size:"lg"}}),w.jsxs(z.Stack,{gap:"md",children:[s==="ai"&&w.jsxs(z.Stepper,{active:de(),size:"xs",color:"devdive",children:[w.jsx(z.Stepper.Step,{label:"주제 입력"}),w.jsx(z.Stepper.Step,{label:"구조 편집"}),w.jsx(z.Stepper.Step,{label:"콘텐츠 생성"}),w.jsx(z.Stepper.Step,{label:"미리보기"})]}),c==="content"&&w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"sm",mb:"xs",children:["콘텐츠 생성 중... (",Math.round(h),"%)"]}),w.jsx(z.Progress,{value:h,color:"devdive",animated:!0})]}),w.jsxs(z.Tabs,{value:s,onChange:i,children:[w.jsxs(z.Tabs.List,{grow:!0,children:[w.jsx(z.Tabs.Tab,{value:"ai",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"auto_awesome"}),children:"AI 생성"}),w.jsx(z.Tabs.Tab,{value:"paste",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"content_paste"}),children:"데이터 붙여넣기"})]}),w.jsx(z.Tabs.Panel,{value:"ai",pt:"md",children:w.jsxs(z.Stack,{gap:"md",children:[c==="input"&&w.jsxs(w.Fragment,{children:[w.jsx(z.TextInput,{label:"프레젠테이션 주제",description:"어떤 주제로 슬라이드를 만들까요?",placeholder:"예: 2024년 마케팅 전략 발표",value:y,onChange:G=>x(G.currentTarget.value)}),w.jsxs(z.Group,{grow:!0,children:[w.jsx(z.NumberInput,{label:"슬라이드 개수",value:S,onChange:G=>C(typeof G=="number"?G:5),min:1,max:10,clampBehavior:"strict"}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"이미지 포함"}),w.jsx(z.Switch,{checked:D,onChange:G=>M(G.currentTarget.checked),label:D?"포함":"미포함",color:"devdive"})]})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"프레젠테이션 스타일"}),w.jsx(z.SegmentedControl,{value:T,onChange:G=>R(G),data:B6,fullWidth:!0,color:"devdive"})]})]}),c==="structure"&&w.jsxs(z.Box,{children:[w.jsxs(z.Group,{justify:"space-between",mb:"xs",children:[w.jsxs(z.Text,{size:"sm",fw:500,children:["슬라이드 구조 (",P.length,"개)"]}),w.jsx(z.ActionIcon,{variant:"light",color:"devdive",size:"sm",onClick:ot,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"add"})})]}),w.jsx(z.ScrollArea,{h:250,children:w.jsx(z.Stack,{gap:"xs",children:P.map((G,j)=>w.jsx(z.Paper,{p:"sm",radius:"md",withBorder:!0,children:w.jsxs(z.Group,{gap:"xs",align:"flex-start",children:[w.jsx(z.Badge,{size:"sm",color:"devdive",variant:"light",w:28,children:j+1}),w.jsx(z.Box,{style:{flex:1},children:w.jsxs(z.Group,{gap:"xs",mb:"xs",children:[w.jsx(z.Select,{size:"xs",value:G.layout,onChange:$=>Te(j,$||"content"),data:M6.map($=>({value:$.value,label:$.label})),w:100}),w.jsx(z.TextInput,{size:"xs",placeholder:"슬라이드 목적",value:G.purpose,onChange:$=>Ne(j,$.currentTarget.value),style:{flex:1}})]})}),P.length>1&&w.jsx(z.ActionIcon,{variant:"subtle",color:"red",size:"xs",onClick:()=>Ue(j),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"delete"})})]})},j))})})]}),c==="preview"&&I&&w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"sm",fw:500,mb:"xs",children:["생성된 슬라이드 (",I.length,"개)"]}),w.jsx(z.ScrollArea,{h:200,children:w.jsx(z.Stack,{gap:"xs",children:I.map((G,j)=>w.jsxs(z.Paper,{p:"sm",radius:"md",withBorder:!0,children:[w.jsxs(z.Group,{justify:"space-between",mb:4,children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Badge,{size:"xs",color:"devdive",children:j+1}),w.jsx(z.Text,{size:"sm",fw:500,children:G.title||`슬라이드 ${j+1}`})]}),w.jsx(z.Badge,{size:"xs",variant:"light",color:"gray",children:G.layout})]}),G.subtitle&&w.jsx(z.Text,{size:"xs",c:"dimmed",lineClamp:1,children:G.subtitle}),G.bulletPoints&&G.bulletPoints.length>0&&w.jsxs(z.Text,{size:"xs",c:"dimmed",mt:4,children:["• ",G.bulletPoints[0],G.bulletPoints.length>1&&` 외 ${G.bulletPoints.length-1}개`]})]},j))})})]}),re&&w.jsx(z.Alert,{color:"red",variant:"light",children:re})]})}),w.jsx(z.Tabs.Panel,{value:"paste",pt:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Textarea,{label:"슬라이드 데이터",description:"구조화된 슬라이드 데이터를 붙여넣으세요",placeholder:`[슬라이드 번호] 01
255
+ 세 번째 포인트`,minRows:4,autosize:!0}),w.jsx(z.TextInput,{label:"키워드",description:"쉼표로 구분",value:d.keywords.join(", "),onChange:S=>A(S.currentTarget.value),placeholder:"키워드1, 키워드2, 키워드3"}),w.jsxs(z.Group,{justify:"space-between",mt:"md",children:[w.jsx(z.Button,{variant:"subtle",color:"red",onClick:x,children:"삭제"}),w.jsxs(z.Group,{gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:e,children:"취소"}),w.jsx(z.Button,{color:"devdive",onClick:y,children:"저장"})]})]})]})})},M6=[{value:"business",label:"비즈니스"},{value:"creative",label:"크리에이티브"},{value:"minimal",label:"미니멀"},{value:"educational",label:"교육"}],P6=[{value:"title",label:"표지",icon:"title"},{value:"content",label:"본문",icon:"article"},{value:"bullets",label:"불릿",icon:"format_list_bulleted"},{value:"two-column",label:"2단",icon:"view_column"},{value:"image-left",label:"이미지 좌",icon:"image"},{value:"image-right",label:"이미지 우",icon:"image"},{value:"graph",label:"차트",icon:"insert_chart"}],z6=({isOpen:t,onClose:e,onBack:n})=>{const[s,i]=oe.useState("ai"),[c,d]=oe.useState("input"),[h,p]=oe.useState(0),[u,A]=oe.useState(!1),[y,x]=oe.useState(""),[S,C]=oe.useState(5),[T,R]=oe.useState("business"),[D,M]=oe.useState(!0),[P,O]=oe.useState([]),[I,Y]=oe.useState(null),[K,q]=oe.useState(""),[Q,V]=oe.useState(null),[ge,X]=oe.useState(null),[se,L]=oe.useState(null),[ne,le]=oe.useState("devdive"),{generateSlides:pe,generateSlideContent:J,isLoading:ae,error:re,reset:U}=uA(),ee=async()=>{if(!(!y.trim()||u)){A(!0);try{const j=(await pe({topic:y.trim(),slideCount:S,style:T,includeImages:D,language:"ko"})).slides.map($=>({layout:$.layout,purpose:$.title||"",content:void 0}));O(j),d("structure")}catch{}finally{A(!1)}}},Ee=async()=>{if(P.length===0)return;d("content"),p(0);const G={business:"비즈니스/전문적인 톤",creative:"창의적이고 흥미로운 톤",minimal:"간결하고 핵심만 담은 톤",educational:"교육적이고 설명적인 톤"},j=[];for(let $=0;$<P.length;$++){const ye=P[$];try{const Ce=await J({topic:y.trim(),slideIndex:$,totalSlides:P.length,layout:ye.layout,purpose:ye.purpose,style:G[T],language:"ko"});j.push(Ce),p(($+1)/P.length*100)}catch(Ce){console.error(`슬라이드 ${$+1} 콘텐츠 생성 실패:`,Ce),j.push({layout:ye.layout,title:ye.purpose,subtitle:"",content:"",bulletPoints:[],imagePrompt:""})}}Y(j),d("preview")},Te=(G,j)=>{const $=[...P];$[G]={...$[G],layout:j},O($)},Ne=(G,j)=>{const $=[...P];$[G]={...$[G],purpose:j},O($)},Ue=G=>{P.length<=1||O(P.filter((j,$)=>$!==G))},ot=()=>{O([...P,{layout:"content",purpose:"새 슬라이드"}])},lt=()=>{if(K.trim())try{X(null);const G=_6(K);if(G.length===0){X("슬라이드 데이터를 찾을 수 없습니다. 형식을 확인해주세요.");return}V(G)}catch(G){X("데이터 파싱 중 오류가 발생했습니다."),console.error(G)}},pt=(G,j)=>{if(!Q)return;const $=[...Q];$[G]=j,V($)},Lt=G=>{if(!Q)return;const j=Q.filter(($,ye)=>ye!==G);V(j.length>0?j:null)},qe=()=>{if(!Q)return;const G=fs[ne],j=Ve.getState(),$=j.slides;let Ce=$.length===1&&$[0].elements.length===0;Q.forEach(Ae=>{const ze=t2(Ae,G);if(Ce)j.selectSlide(0),Ce=!1;else{j.addSlide();const Ie=Ve.getState().slides.length-1;j.selectSlide(Ie)}ze.forEach(We=>{Ve.getState().addElement(We)}),Ve.getState().updateSlideBackground(G.background)}),ce()},Dt=(G,j)=>{const $=j===0,ye=j===I.length-1;return{slideNumber:String(j+1),sectionType:$?"cover":ye?"closing":"content",recommendedLayout:G.layout,visualElements:G.imagePrompt||"",layoutReason:"",sectionTitle:G.title||"",summary:G.subtitle||G.content||"",keyPoints:G.bulletPoints||[],keywords:[]}},me=()=>{if(!I)return;const G=fs[ne],j=Ve.getState(),$=j.slides;let Ce=$.length===1&&$[0].elements.length===0;I.forEach((Ae,ze)=>{const We=Dt(Ae,ze),Ie=t2(We,G);if(Ce)j.selectSlide(0),Ce=!1;else{j.addSlide();const Jt=Ve.getState().slides.length-1;j.selectSlide(Jt)}Ie.forEach(dt=>{Ve.getState().addElement(dt)}),Ve.getState().updateSlideBackground(G.background)}),ce()},k=()=>{c==="structure"?d("input"):c==="preview"&&(d("structure"),Y(null))},ce=()=>{x(""),O([]),Y(null),d("input"),p(0),A(!1),q(""),V(null),X(null),U(),e()},de=()=>{switch(c){case"input":return 0;case"structure":return 1;case"content":return 2;case"preview":return 3;default:return 0}};return w.jsxs(z.Modal,{opened:t,onClose:ce,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:c==="input"?n:k,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"arrow_back"})}),w.jsx(z.Text,{fw:700,children:"슬라이드 자동 생성"})]}),centered:!0,size:"lg",children:[w.jsxs(z.Box,{pos:"relative",children:[w.jsx(z.LoadingOverlay,{visible:ae||u||c==="content",zIndex:1e3,overlayProps:{radius:"sm",blur:2},loaderProps:{color:"devdive",type:"dots",size:"lg"}}),w.jsxs(z.Stack,{gap:"md",children:[s==="ai"&&w.jsxs(z.Stepper,{active:de(),size:"xs",color:"devdive",children:[w.jsx(z.Stepper.Step,{label:"주제 입력"}),w.jsx(z.Stepper.Step,{label:"구조 편집"}),w.jsx(z.Stepper.Step,{label:"콘텐츠 생성"}),w.jsx(z.Stepper.Step,{label:"미리보기"})]}),c==="content"&&w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"sm",mb:"xs",children:["콘텐츠 생성 중... (",Math.round(h),"%)"]}),w.jsx(z.Progress,{value:h,color:"devdive",animated:!0})]}),w.jsxs(z.Tabs,{value:s,onChange:i,children:[w.jsxs(z.Tabs.List,{grow:!0,children:[w.jsx(z.Tabs.Tab,{value:"ai",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"auto_awesome"}),children:"AI 생성"}),w.jsx(z.Tabs.Tab,{value:"paste",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"content_paste"}),children:"데이터 붙여넣기"})]}),w.jsx(z.Tabs.Panel,{value:"ai",pt:"md",children:w.jsxs(z.Stack,{gap:"md",children:[c==="input"&&w.jsxs(w.Fragment,{children:[w.jsx(z.TextInput,{label:"프레젠테이션 주제",description:"어떤 주제로 슬라이드를 만들까요?",placeholder:"예: 2024년 마케팅 전략 발표",value:y,onChange:G=>x(G.currentTarget.value)}),w.jsxs(z.Group,{grow:!0,children:[w.jsx(z.NumberInput,{label:"슬라이드 개수",value:S,onChange:G=>C(typeof G=="number"?G:5),min:1,max:10,clampBehavior:"strict"}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"이미지 포함"}),w.jsx(z.Switch,{checked:D,onChange:G=>M(G.currentTarget.checked),label:D?"포함":"미포함",color:"devdive"})]})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"프레젠테이션 스타일"}),w.jsx(z.SegmentedControl,{value:T,onChange:G=>R(G),data:M6,fullWidth:!0,color:"devdive"})]})]}),c==="structure"&&w.jsxs(z.Box,{children:[w.jsxs(z.Group,{justify:"space-between",mb:"xs",children:[w.jsxs(z.Text,{size:"sm",fw:500,children:["슬라이드 구조 (",P.length,"개)"]}),w.jsx(z.ActionIcon,{variant:"light",color:"devdive",size:"sm",onClick:ot,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"add"})})]}),w.jsx(z.ScrollArea,{h:250,children:w.jsx(z.Stack,{gap:"xs",children:P.map((G,j)=>w.jsx(z.Paper,{p:"sm",radius:"md",withBorder:!0,children:w.jsxs(z.Group,{gap:"xs",align:"flex-start",children:[w.jsx(z.Badge,{size:"sm",color:"devdive",variant:"light",w:28,children:j+1}),w.jsx(z.Box,{style:{flex:1},children:w.jsxs(z.Group,{gap:"xs",mb:"xs",children:[w.jsx(z.Select,{size:"xs",value:G.layout,onChange:$=>Te(j,$||"content"),data:P6.map($=>({value:$.value,label:$.label})),w:100}),w.jsx(z.TextInput,{size:"xs",placeholder:"슬라이드 목적",value:G.purpose,onChange:$=>Ne(j,$.currentTarget.value),style:{flex:1}})]})}),P.length>1&&w.jsx(z.ActionIcon,{variant:"subtle",color:"red",size:"xs",onClick:()=>Ue(j),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"delete"})})]})},j))})})]}),c==="preview"&&I&&w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"sm",fw:500,mb:"xs",children:["생성된 슬라이드 (",I.length,"개)"]}),w.jsx(z.ScrollArea,{h:200,children:w.jsx(z.Stack,{gap:"xs",children:I.map((G,j)=>w.jsxs(z.Paper,{p:"sm",radius:"md",withBorder:!0,children:[w.jsxs(z.Group,{justify:"space-between",mb:4,children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Badge,{size:"xs",color:"devdive",children:j+1}),w.jsx(z.Text,{size:"sm",fw:500,children:G.title||`슬라이드 ${j+1}`})]}),w.jsx(z.Badge,{size:"xs",variant:"light",color:"gray",children:G.layout})]}),G.subtitle&&w.jsx(z.Text,{size:"xs",c:"dimmed",lineClamp:1,children:G.subtitle}),G.bulletPoints&&G.bulletPoints.length>0&&w.jsxs(z.Text,{size:"xs",c:"dimmed",mt:4,children:["• ",G.bulletPoints[0],G.bulletPoints.length>1&&` 외 ${G.bulletPoints.length-1}개`]})]},j))})})]}),re&&w.jsx(z.Alert,{color:"red",variant:"light",children:re})]})}),w.jsx(z.Tabs.Panel,{value:"paste",pt:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Textarea,{label:"슬라이드 데이터",description:"구조화된 슬라이드 데이터를 붙여넣으세요",placeholder:`[슬라이드 번호] 01
256
256
  [섹션 타입] cover
257
257
  [추천 레이아웃] full_title_center
258
258
  [섹션 제목] 프레젠테이션 제목
@@ -260,7 +260,7 @@ ${t.language==="ko"?"한국어로 작성하세요.":"Write in English."}`,c=e.mo
260
260
  [핵심 포인트]
261
261
  • 첫 번째 포인트
262
262
  • 두 번째 포인트
263
- [키워드] 키워드1, 키워드2`,value:K,onChange:G=>q(G.currentTarget.value),minRows:8,maxRows:12,autosize:!0,styles:{input:{fontFamily:"monospace",fontSize:12}}}),ge&&w.jsx(z.Alert,{color:"red",variant:"light",children:ge}),Q&&w.jsxs(z.Box,{children:[w.jsxs(z.Group,{gap:"xs",mb:"xs",children:[w.jsx(z.Text,{size:"sm",fw:500,children:"파싱된 슬라이드"}),w.jsxs(z.Badge,{color:"devdive",size:"sm",children:[Q.length,"개"]})]}),w.jsx(z.ScrollArea,{h:150,children:w.jsx(z.Stack,{gap:"xs",children:Q.map((G,j)=>w.jsxs(z.Paper,{p:"sm",radius:"md",withBorder:!0,style:{cursor:"pointer"},onClick:()=>L(j),children:[w.jsxs(z.Group,{justify:"space-between",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Text,{size:"xs",c:"dimmed",children:G.slideNumber}),w.jsx(z.Text,{size:"sm",fw:500,children:G.sectionTitle})]}),w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Badge,{size:"xs",variant:"light",color:"gray",children:G.sectionType}),w.jsx(z.ActionIcon,{variant:"subtle",size:"xs",color:"gray",onClick:$=>{$.stopPropagation(),L(j)},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"edit"})})]})]}),G.keyPoints.length>0&&w.jsxs(z.Text,{size:"xs",c:"dimmed",mt:4,lineClamp:1,children:[G.keyPoints[0],"..."]})]},j))})})]})]})})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"컬러 테마"}),w.jsx(z.SimpleGrid,{cols:4,spacing:"xs",children:Object.keys(fs).map(G=>w.jsx(z.Paper,{p:"xs",radius:"md",withBorder:!0,style:{cursor:"pointer",borderColor:ne===G?"var(--devdive-primary)":void 0,borderWidth:ne===G?2:1},onClick:()=>le(G),children:w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Box,{w:16,h:16,style:{borderRadius:"50%",backgroundColor:fs[G].primary}}),w.jsx(z.Text,{size:"xs",tt:"capitalize",children:G})]})},G))})]}),w.jsxs(z.Group,{justify:"flex-end",gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:ce,children:"취소"}),s==="ai"?w.jsxs(w.Fragment,{children:[c==="input"&&w.jsx(z.Button,{color:"devdive",onClick:ee,loading:u||ae,disabled:!y.trim()||u||ae,leftSection:!u&&!ae?w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"account_tree"}):void 0,children:u||ae?"생성 중...":"구조 생성"}),c==="structure"&&w.jsx(z.Button,{color:"devdive",onClick:Ee,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"}),children:"콘텐츠 생성"}),c==="preview"&&I&&w.jsxs(z.Button,{color:"devdive",onClick:me,children:[I.length,"개 슬라이드 추가"]})]}):Q?w.jsxs(z.Button,{color:"devdive",onClick:qe,children:[Q.length,"개 슬라이드 추가"]}):w.jsx(z.Button,{color:"devdive",onClick:lt,disabled:!K.trim(),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"data_object"}),children:"데이터 파싱"})]})]})]}),Q&&se!==null&&w.jsx(N6,{isOpen:se!==null,onClose:()=>L(null),slide:Q[se],slideIndex:se,onSave:pt,onDelete:Lt})]})},z6=[{value:"realistic",label:"사실적"},{value:"illustration",label:"일러스트"},{value:"abstract",label:"추상"},{value:"3d",label:"3D"},{value:"minimalist",label:"미니멀"}],F6=[{value:"512x512",label:"512×512"},{value:"1024x1024",label:"1024×1024"}],I6=({isOpen:t,onClose:e,onBack:n})=>{const[s,i]=oe.useState(""),[c,d]=oe.useState("illustration"),[h,p]=oe.useState("512x512"),[u,A]=oe.useState(null),{generateImage:y,isLoading:x,error:S,reset:C}=uA(),{addElement:T}=Ve(),R=()=>`image-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,D=async()=>{if(s.trim())try{const I=await y({prompt:s.trim(),style:c,size:h});A(I.base64||I.imageUrl)}catch{}},M=()=>{if(!u)return;const[I,Y]=h.split("x").map(Number),K=Math.min(I,300),q=K/I*Y,Q={id:R(),type:"image",src:u.startsWith("data:")?u:`data:image/png;base64,${u}`,x:480-K/2,y:270-q/2,width:K,height:q,rotation:0};T(Q),P()},P=()=>{i(""),A(null),C(),e()},O=()=>{A(null),D()};return w.jsx(z.Modal,{opened:t,onClose:P,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:n,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"arrow_back"})}),w.jsx(z.Text,{fw:700,children:"이미지 생성"})]}),centered:!0,size:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Textarea,{label:"이미지 설명",description:"생성하고 싶은 이미지를 자세히 설명해주세요",placeholder:"예: 미래 도시의 스카이라인, 푸른 하늘과 유리 건물",value:s,onChange:I=>i(I.currentTarget.value),minRows:3,autosize:!0}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"이미지 스타일"}),w.jsx(z.SegmentedControl,{value:c,onChange:I=>d(I),data:z6,fullWidth:!0,color:"devdive"})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"이미지 크기"}),w.jsx(z.SegmentedControl,{value:h,onChange:I=>p(I),data:F6,color:"devdive"})]}),S&&w.jsx(z.Alert,{color:"red",variant:"light",children:S}),x&&w.jsx(z.Paper,{p:"xl",radius:"md",withBorder:!0,bg:"gray.0",children:w.jsx(z.Center,{children:w.jsxs(z.Stack,{align:"center",gap:"md",children:[w.jsx(z.Loader,{color:"devdive",size:"lg"}),w.jsx(z.Text,{size:"sm",c:"dimmed",children:"이미지를 생성하고 있습니다..."})]})})}),u&&!x&&w.jsxs(z.Paper,{p:"md",radius:"md",withBorder:!0,bg:"gray.0",children:[w.jsxs(z.Group,{justify:"space-between",mb:"xs",children:[w.jsx(z.Text,{size:"sm",fw:500,c:"dimmed",children:"생성된 이미지"}),w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:O,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"refresh"})})]}),w.jsx(z.Center,{children:w.jsx(z.Image,{src:u.startsWith("data:")?u:`data:image/png;base64,${u}`,alt:"Generated image",radius:"md",maw:300,fit:"contain"})})]}),w.jsxs(z.Group,{justify:"flex-end",gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:P,children:"취소"}),u?w.jsx(z.Button,{color:"devdive",onClick:M,children:"슬라이드에 추가"}):w.jsx(z.Button,{color:"devdive",onClick:D,loading:x,disabled:!s.trim(),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"}),children:"이미지 생성"})]})]})})},O6=[{type:"text",icon:"edit_note",title:"텍스트 생성",description:"AI로 슬라이드 텍스트를 자동 생성",color:"blue"},{type:"slide",icon:"auto_awesome_mosaic",title:"슬라이드 자동 생성",description:"주제를 입력하면 여러 슬라이드 구성",color:"violet"},{type:"image",icon:"image",title:"이미지 생성",description:"AI로 맞춤 이미지를 생성",color:"pink"},{type:"design",icon:"palette",title:"디자인 제안",description:"레이아웃과 색상을 자동 추천",color:"teal"}],U6=({isOpen:t,onClose:e})=>{const[n,s]=oe.useState(null),i=h=>{s(h)},c=()=>{s(null)},d=()=>{s(null),e()};return w.jsxs(w.Fragment,{children:[w.jsx(z.Modal,{opened:t&&!n,onClose:d,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ThemeIcon,{variant:"gradient",gradient:{from:"#5B6EF7",to:"#3b82f6"},size:"md",radius:"md",children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"})}),w.jsx(z.Text,{fw:700,children:"AI 생성"}),w.jsx(z.Badge,{variant:"light",color:"devdive",size:"sm",children:"Beta"})]}),centered:!0,size:"lg",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Text,{size:"sm",c:"dimmed",children:"AI를 활용하여 프레젠테이션을 더 빠르고 쉽게 만들어보세요."}),w.jsx(z.SimpleGrid,{cols:2,spacing:"md",children:O6.map(h=>w.jsx(z.Card,{padding:"lg",radius:"md",withBorder:!0,style:{cursor:"pointer",transition:"all 0.2s ease"},onClick:()=>i(h.type),onMouseEnter:p=>{p.currentTarget.style.borderColor="var(--devdive-primary)",p.currentTarget.style.transform="translateY(-2px)",p.currentTarget.style.boxShadow="0 4px 12px rgba(91, 110, 247, 0.15)"},onMouseLeave:p=>{p.currentTarget.style.borderColor="",p.currentTarget.style.transform="",p.currentTarget.style.boxShadow=""},children:w.jsxs(z.Group,{gap:"md",children:[w.jsx(z.ThemeIcon,{variant:"light",color:h.color,size:"xl",radius:"md",children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:24},children:h.icon})}),w.jsxs("div",{children:[w.jsx(z.Text,{fw:600,size:"sm",children:h.title}),w.jsx(z.Text,{size:"xs",c:"dimmed",mt:4,children:h.description})]})]})},h.type))})]})}),w.jsx(L6,{isOpen:n==="text",onClose:c,onBack:c}),w.jsx(P6,{isOpen:n==="slide",onClose:c,onBack:c}),w.jsx(I6,{isOpen:n==="image",onClose:c,onBack:c})]})},mx=()=>{const[t,e]=oe.useState("Untitled Presentation"),[n,s]=oe.useState(!1),[i,c]=oe.useState(!1),[d,h]=oe.useState("new"),[p,u]=oe.useState(!1),[A,y]=oe.useState(!1),x=Ve(I=>I.slides),S=Ve(I=>I.defaultBackground),C=Ve(I=>I.resetPresentation),T=Ve(I=>I.loadSlides),R=oe.useRef(null),D=async()=>{if(!n){s(!0);try{await hx(x,t.replace(/\s+/g,"_"))}catch(I){console.error("PPTX 생성 실패:",I)}finally{s(!1)}}},M=()=>{const I={version:1,title:t,slides:x,defaultBackground:S,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},Y=new Blob([JSON.stringify(I,null,2)],{type:"application/json"}),K=URL.createObjectURL(Y),q=document.createElement("a");q.href=K,q.download=`${t.replace(/\s+/g,"_")}.ddslide`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(K)},P=I=>{var q;const Y=(q=I.target.files)==null?void 0:q[0];if(!Y)return;const K=new FileReader;K.onload=Q=>{var V;try{const ge=(V=Q.target)==null?void 0:V.result,X=JSON.parse(ge);if(!X.slides||!Array.isArray(X.slides))throw new Error("Invalid file format");T(X.slides,X.defaultBackground),X.title&&e(X.title)}catch(ge){console.error("파일 불러오기 실패:",ge),alert("파일을 불러올 수 없습니다. 올바른 .ddslide 파일인지 확인해주세요.")}},K.readAsText(Y),I.target.value=""},O=()=>{C(),e("Untitled Presentation"),y(!1)};return w.jsxs(z.Box,{component:"header",h:56,px:"md",bg:"white",style:{borderBottom:"1px solid var(--devdive-border-light)",zIndex:20,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.05)"},children:[w.jsxs(z.Group,{h:"100%",justify:"space-between",children:[w.jsxs(z.Group,{gap:"md",children:[w.jsx(z.Box,{w:32,h:32,bg:"var(--devdive-primary)",style:{borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px rgba(91, 110, 247, 0.2)"},children:w.jsx("span",{className:"material-symbols-outlined",style:{color:"white",fontSize:20},children:"auto_awesome"})}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",lts:"-0.05em",children:"Presentation"}),w.jsx(z.TextInput,{value:t,onChange:I=>e(I.currentTarget.value),placeholder:"제목을 입력하세요",variant:"unstyled",size:"sm",w:192,styles:{input:{fontWeight:600,letterSpacing:"-0.01em",padding:0,height:"auto",minHeight:"auto"}}})]})]}),w.jsxs(z.Group,{gap:"sm",children:[w.jsxs(z.Menu,{shadow:"md",width:180,position:"bottom-start",children:[w.jsx(z.Menu.Target,{children:w.jsx(z.Button,{variant:"subtle",color:"gray",size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"folder"}),children:"파일"})}),w.jsxs(z.Menu.Dropdown,{children:[w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"note_add"}),onClick:()=>y(!0),children:"새로 만들기"}),w.jsx(z.Menu.Divider,{}),w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"save"}),onClick:M,children:"저장 (.ddslide)"}),w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"folder_open"}),onClick:()=>{var I;return(I=R.current)==null?void 0:I.click()},children:"불러오기"}),w.jsx(z.Menu.Divider,{}),w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"download"}),onClick:D,disabled:n,children:"PPTX 내보내기"})]})]}),w.jsx("input",{ref:R,type:"file",accept:".ddslide,.json",style:{display:"none"},onChange:P}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Button,{variant:"subtle",color:"gray",size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"dashboard"}),onClick:()=>{h("apply"),c(!0)},children:"템플릿"}),w.jsx(z.Button,{variant:"light",color:"devdive",size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"add"}),onClick:()=>{h("new"),c(!0)},children:"새 슬라이드"}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Button,{variant:"gradient",gradient:{from:"#5B6EF7",to:"#3b82f6"},size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"auto_awesome"}),onClick:()=>u(!0),children:"AI 생성"}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Button,{color:"devdive",size:"xs",fw:700,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"download"}),onClick:D,loading:n,style:{boxShadow:"0 4px 6px rgba(91, 110, 247, 0.2)"},children:n?"Exporting...":"EXPORT"})]})]}),w.jsx(px,{isOpen:i,onClose:()=>c(!1),mode:d}),w.jsx(U6,{isOpen:p,onClose:()=>u(!1)}),w.jsx(z.Modal,{opened:A,onClose:()=>y(!1),title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20,color:"#f59e0b"},children:"warning"}),w.jsx(z.Text,{fw:700,children:"새 프레젠테이션"})]}),centered:!0,size:"sm",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsxs(z.Text,{size:"sm",c:"dimmed",children:["현재 작업 중인 프레젠테이션이 삭제됩니다.",w.jsx("br",{}),"저장하지 않은 변경사항은 복구할 수 없습니다."]}),w.jsxs(z.Group,{justify:"flex-end",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:()=>y(!1),children:"취소"}),w.jsx(z.Button,{color:"red",onClick:O,children:"새로 만들기"})]})]})})]})};function dA(){return(dA=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t}).apply(this,arguments)}function gx(t,e){if(t==null)return{};var n,s,i={},c=Object.keys(t);for(s=0;s<c.length;s++)e.indexOf(n=c[s])>=0||(i[n]=t[n]);return i}function Sg(t){var e=oe.useRef(t),n=oe.useRef(function(s){e.current&&e.current(s)});return e.current=t,n.current}var Rf=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},xf=function(t){return"touches"in t},Cg=function(t){return t&&t.ownerDocument.defaultView||self},n2=function(t,e,n){var s=t.getBoundingClientRect(),i=xf(e)?(function(c,d){for(var h=0;h<c.length;h++)if(c[h].identifier===d)return c[h];return c[0]})(e.touches,n):e;return{left:Rf((i.pageX-(s.left+Cg(t).pageXOffset))/s.width),top:Rf((i.pageY-(s.top+Cg(t).pageYOffset))/s.height)}},r2=function(t){!xf(t)&&t.preventDefault()},vx=oe.memo(function(t){var e=t.onMove,n=t.onKey,s=gx(t,["onMove","onKey"]),i=oe.useRef(null),c=Sg(e),d=Sg(n),h=oe.useRef(null),p=oe.useRef(!1),u=oe.useMemo(function(){var S=function(R){r2(R),(xf(R)?R.touches.length>0:R.buttons>0)&&i.current?c(n2(i.current,R,h.current)):T(!1)},C=function(){return T(!1)};function T(R){var D=p.current,M=Cg(i.current),P=R?M.addEventListener:M.removeEventListener;P(D?"touchmove":"mousemove",S),P(D?"touchend":"mouseup",C)}return[function(R){var D=R.nativeEvent,M=i.current;if(M&&(r2(D),!(function(O,I){return I&&!xf(O)})(D,p.current)&&M)){if(xf(D)){p.current=!0;var P=D.changedTouches||[];P.length&&(h.current=P[0].identifier)}M.focus(),c(n2(M,D,h.current)),T(!0)}},function(R){var D=R.which||R.keyCode;D<37||D>40||(R.preventDefault(),d({left:D===39?.05:D===37?-.05:0,top:D===40?.05:D===38?-.05:0}))},T]},[d,c]),A=u[0],y=u[1],x=u[2];return oe.useEffect(function(){return x},[x]),oe.createElement("div",dA({},s,{onTouchStart:A,onMouseDown:A,className:"react-colorful__interactive",ref:i,onKeyDown:y,tabIndex:0,role:"slider"}))}),Wg=function(t){return t.filter(Boolean).join(" ")},yx=function(t){var e=t.color,n=t.left,s=t.top,i=s===void 0?.5:s,c=Wg(["react-colorful__pointer",t.className]);return oe.createElement("div",{className:c,style:{top:100*i+"%",left:100*n+"%"}},oe.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Br=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},j6=function(t){return Q6(wg(t))},wg=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Br(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Br(parseInt(t.substring(6,8),16)/255,2):1}},G6=function(t){return W6(X6(t))},H6=function(t){var e=t.s,n=t.v,s=t.a,i=(200-e)*n/100;return{h:Br(t.h),s:Br(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:Br(i/2),a:Br(s,2)}},_g=function(t){var e=H6(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},X6=function(t){var e=t.h,n=t.s,s=t.v,i=t.a;e=e/360*6,n/=100,s/=100;var c=Math.floor(e),d=s*(1-n),h=s*(1-(e-c)*n),p=s*(1-(1-e+c)*n),u=c%6;return{r:Br(255*[s,h,d,d,p,s][u]),g:Br(255*[p,s,s,h,d,d][u]),b:Br(255*[d,d,p,s,s,h][u]),a:Br(i,2)}},Mp=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},W6=function(t){var e=t.r,n=t.g,s=t.b,i=t.a,c=i<1?Mp(Br(255*i)):"";return"#"+Mp(e)+Mp(n)+Mp(s)+c},Q6=function(t){var e=t.r,n=t.g,s=t.b,i=t.a,c=Math.max(e,n,s),d=c-Math.min(e,n,s),h=d?c===e?(n-s)/d:c===n?2+(s-e)/d:4+(e-n)/d:0;return{h:Br(60*(h<0?h+6:h)),s:Br(c?d/c*100:0),v:Br(c/255*100),a:i}},Y6=oe.memo(function(t){var e=t.hue,n=t.onChange,s=Wg(["react-colorful__hue",t.className]);return oe.createElement("div",{className:s},oe.createElement(vx,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:Rf(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":Br(e),"aria-valuemax":"360","aria-valuemin":"0"},oe.createElement(yx,{className:"react-colorful__hue-pointer",left:e/360,color:_g({h:e,s:100,v:100,a:1})})))}),V6=oe.memo(function(t){var e=t.hsva,n=t.onChange,s={backgroundColor:_g({h:e.h,s:100,v:100,a:1})};return oe.createElement("div",{className:"react-colorful__saturation",style:s},oe.createElement(vx,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:Rf(e.s+100*i.left,0,100),v:Rf(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Br(e.s)+"%, Brightness "+Br(e.v)+"%"},oe.createElement(yx,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:_g(e)})))}),xx=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},q6=function(t,e){return t.toLowerCase()===e.toLowerCase()||xx(wg(t),wg(e))};function K6(t,e,n){var s=Sg(n),i=oe.useState(function(){return t.toHsva(e)}),c=i[0],d=i[1],h=oe.useRef({color:e,hsva:c});oe.useEffect(function(){if(!t.equal(e,h.current.color)){var u=t.toHsva(e);h.current={hsva:u,color:e},d(u)}},[e,t]),oe.useEffect(function(){var u;xx(c,h.current.hsva)||t.equal(u=t.fromHsva(c),h.current.color)||(h.current={hsva:c,color:u},s(u))},[c,t,s]);var p=oe.useCallback(function(u){d(function(A){return Object.assign({},A,u)})},[]);return[c,p]}var J6=typeof window<"u"?oe.useLayoutEffect:oe.useEffect,Z6=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},a2=new Map,$6=function(t){J6(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!a2.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,a2.set(e,n);var s=Z6();s&&n.setAttribute("nonce",s),e.head.appendChild(n)}},[])},eC=function(t){var e=t.className,n=t.colorModel,s=t.color,i=s===void 0?n.defaultColor:s,c=t.onChange,d=gx(t,["className","colorModel","color","onChange"]),h=oe.useRef(null);$6(h);var p=K6(n,i,c),u=p[0],A=p[1],y=Wg(["react-colorful",e]);return oe.createElement("div",dA({},d,{ref:h,className:y}),oe.createElement(V6,{hsva:u,onChange:A}),oe.createElement(Y6,{hue:u.h,onChange:A,className:"react-colorful__last-control"}))},tC={defaultColor:"000",toHsva:j6,fromHsva:function(t){return G6({h:t.h,s:t.s,v:t.v,a:1})},equal:q6},bx=function(t){return oe.createElement(eC,dA({},t,{colorModel:tC}))};const Sx=()=>{var re;const t=Ve(U=>U.mode),e=Ve(U=>U.currentShapeType),n=Ve(U=>U.currentTextStyle),s=Ve(U=>U.currentFontFamily),i=Ve(U=>U.selectedElementId),c=Ve(U=>U.slides),d=Ve(U=>U.currentSlideIndex),h=Ve(U=>U.setMode),p=Ve(U=>U.setShapeType),u=Ve(U=>U.setTextStyle),A=Ve(U=>U.setFontFamily),y=Ve(U=>U.deleteElement),x=Ve(U=>U.addElement),S=Ve(U=>U.updateSlideBackground),C=Ve(U=>U.updateAllSlidesBackground),T=Ve(U=>U.snapSettings),R=Ve(U=>U.toggleSnap),[D,M]=oe.useState(!1),P=oe.useRef(null),O=oe.useRef(null),[I,Y]=oe.useState({x:0,y:0}),[K,q]=oe.useState({isDragging:!1,startX:0,startY:0,offsetX:0,offsetY:0}),Q=((re=c[d])==null?void 0:re.background)||"#ffffff",V=oe.useCallback(U=>{const ee=U.target;ee.closest("button")||ee.closest('[role="button"]')||ee.closest("input")||ee.closest("[data-mantine-popover]")||(U.preventDefault(),q({isDragging:!0,startX:U.clientX,startY:U.clientY,offsetX:I.x,offsetY:I.y}))},[I]);oe.useEffect(()=>{if(!K.isDragging)return;const U=Ee=>{const Te=Ee.clientX-K.startX,Ne=Ee.clientY-K.startY;let Ue=K.offsetX+Te,ot=K.offsetY+Ne;if(O.current){const lt=O.current.getBoundingClientRect(),pt=window.innerWidth,Lt=window.innerHeight,qe=lt.width,Dt=lt.height,me=pt/2,k=24,ce=8,de=-me+qe/2+ce,G=me-qe/2-ce;Ue=Math.max(de,Math.min(G,Ue));const j=-k+ce,$=Lt-k-Dt-ce;ot=Math.max(j,Math.min($,ot))}Y({x:Ue,y:ot})},ee=()=>{q(Ee=>({...Ee,isDragging:!1}))};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",ee),()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",ee)}},[K.isDragging,K.startX,K.startY,K.offsetX,K.offsetY]);const ge=U=>{h(U)},X=U=>{p(U),h("shape")},se=U=>{u(U),h("text")},L=()=>{i&&y(i)},ne=U=>{var Te;const ee=(Te=U.target.files)==null?void 0:Te[0];if(!ee)return;const Ee=new FileReader;Ee.onload=Ne=>{var lt;const Ue=(lt=Ne.target)==null?void 0:lt.result,ot=new window.Image;ot.onload=()=>{let qe=ot.width,Dt=ot.height;qe>400&&(Dt=400/qe*Dt,qe=400),Dt>300&&(qe=300/Dt*qe,Dt=300);const me={id:fi(),type:"image",x:100,y:100,width:qe,height:Dt,rotation:0,src:Ue};x(me)},ot.src=Ue},Ee.readAsDataURL(ee),U.target.value=""},le=()=>{const U={id:fi(),type:"shape",x:100,y:100,width:300,height:200,rotation:0,shapeType:"rect",fill:"#5B6EF720",stroke:"#5B6EF7",strokeWidth:2,text:"클릭하여 이미지 추가",textColor:"#5B6EF7",textSize:16,cornerRadius:12,isImagePlaceholder:!0};x(U),h("select")},pe={title:"제목",subtitle:"소제목",body:"본문",caption:"캡션"},J={rect:{label:"사각형",icon:"rectangle"},ellipse:{label:"원형",icon:"circle"},triangle:{label:"삼각형",icon:"change_history"},line:{label:"선",icon:"horizontal_rule"},arrow:{label:"화살표",icon:"arrow_forward"}},ae=["#ffffff","#f8fafc","#f1f5f9","#e2e8f0","#1e293b","#0f172a","#5B6EF7","#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6"];return w.jsx(z.Box,{ref:O,pos:"absolute",top:24,left:"50%",style:{transform:`translate(calc(-50% + ${I.x}px), ${I.y}px)`,zIndex:30,cursor:K.isDragging?"grabbing":"default"},children:w.jsxs(z.Group,{gap:4,px:"sm",py:10,bg:"white",wrap:"nowrap",onMouseDown:V,style:{border:"1px solid var(--devdive-border-light)",borderRadius:"var(--mantine-radius-xl)",boxShadow:"0 8px 30px rgb(0, 0, 0, 0.08)",userSelect:"none",whiteSpace:"nowrap"},children:[w.jsx(z.Tooltip,{label:"드래그하여 이동",children:w.jsx(z.Box,{style:{cursor:"grab",display:"flex",alignItems:"center",padding:"0 4px"},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--mantine-color-gray-5)"},children:"drag_indicator"})})}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Tooltip,{label:"선택 도구",children:w.jsx(z.ActionIcon,{variant:t==="select"?"light":"subtle",color:t==="select"?"devdive":"gray",size:"lg",radius:"lg",onClick:()=>ge("select"),children:w.jsx("span",{className:"material-symbols-outlined",children:"arrow_selector_tool"})})}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsxs(z.Menu,{shadow:"md",radius:"lg",children:[w.jsx(z.Menu.Target,{children:w.jsx(z.Button,{variant:t==="text"?"light":"subtle",color:t==="text"?"devdive":"gray",size:"xs",radius:"lg",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"title"}),rightSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"expand_more"}),children:pe[n]})}),w.jsx(z.Menu.Dropdown,{children:Object.keys(Eu).map(U=>w.jsx(z.Menu.Item,{onClick:()=>se(U),rightSection:n===U?w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"check"}):null,style:{backgroundColor:n===U?"rgba(91, 110, 247, 0.05)":void 0,color:n===U?"var(--devdive-primary)":void 0},children:w.jsx("span",{style:{fontSize:Math.max(14,Math.min(Eu[U].fontSize/2,18)),fontWeight:Eu[U].fontWeight},children:pe[U]})},U))})]}),w.jsx(z.Select,{value:s,onChange:U=>U&&A(U),data:f6.map(U=>({value:U.value,label:U.name})),size:"xs",w:100,variant:"unstyled",styles:{input:{fontWeight:500,cursor:"pointer"}}}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx("input",{ref:P,type:"file",accept:"image/*",onChange:ne,style:{display:"none"}}),w.jsxs(z.Menu,{shadow:"md",radius:"lg",children:[w.jsx(z.Menu.Target,{children:w.jsx(z.Button,{variant:t==="shape"?"light":"subtle",color:t==="shape"?"devdive":"gray",size:"xs",radius:"lg",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:J[e].icon}),rightSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"expand_more"}),children:J[e].label})}),w.jsxs(z.Menu.Dropdown,{children:[Object.keys(J).map(U=>w.jsx(z.Menu.Item,{onClick:()=>X(U),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:J[U].icon}),rightSection:e===U?w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"check"}):null,style:{backgroundColor:e===U?"rgba(91, 110, 247, 0.05)":void 0,color:e===U?"var(--devdive-primary)":void 0},children:J[U].label},U)),w.jsx(z.Menu.Divider,{}),w.jsx(z.Menu.Item,{onClick:le,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"image"}),children:"이미지"})]})]}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsxs(z.Popover,{opened:D,onChange:M,position:"bottom-end",radius:"lg",shadow:"xl",children:[w.jsx(z.Popover.Target,{children:w.jsx(z.Tooltip,{label:"배경 색상",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"lg",radius:"lg",onClick:()=>M(!D),children:w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Box,{w:20,h:20,style:{borderRadius:4,border:"1px solid var(--devdive-border-light)",backgroundColor:Q}}),w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14,color:"var(--mantine-color-gray-5)"},children:"expand_more"})]})})})}),w.jsx(z.Popover.Dropdown,{p:"sm",miw:220,children:w.jsxs(z.Stack,{gap:"sm",children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",children:"배경 색상"}),w.jsx(bx,{color:Q,onChange:U=>S(U)}),w.jsx(z.Box,{pt:"sm",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.SimpleGrid,{cols:4,spacing:6,children:ae.map(U=>w.jsx(z.ActionIcon,{size:"sm",variant:"outline",color:"gray",onClick:()=>S(U),style:{backgroundColor:U,borderColor:"var(--devdive-border-light)"}},U))})}),w.jsx(z.Box,{pt:"sm",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.Button,{variant:"light",color:"gray",size:"xs",fullWidth:!0,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"layers"}),onClick:()=>{C(Q),M(!1)},children:"전체 슬라이드에 적용"})})]})})]}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Tooltip,{label:`스냅 ${T.enabled?"ON":"OFF"}`,children:w.jsx(z.ActionIcon,{variant:T.enabled?"light":"subtle",color:T.enabled?"devdive":"gray",size:"lg",radius:"lg",onClick:R,children:w.jsx("span",{className:"material-symbols-outlined",children:"grid_on"})})}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Tooltip,{label:"삭제",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"red",size:"lg",radius:"lg",onClick:L,disabled:!i,children:w.jsx("span",{className:"material-symbols-outlined",children:"delete"})})})]})})},nC=Math.PI/180;function rC(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Ml=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},Qe={_global:Ml,version:"10.2.0",isBrowser:rC(),isUnminified:/param/.test((function(t){}).toString()),dblClickWindow:400,getAngle(t){return Qe.angleDeg?t*nC:t},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return Qe.DD.isDragging},isTransforming(){var t,e;return(e=(t=Qe.Transformer)===null||t===void 0?void 0:t.isTransforming())!==null&&e!==void 0?e:!1},isDragReady(){return!!Qe.DD.node},releaseCanvasOnDestroy:!0,document:Ml.document,_injectGlobal(t){typeof Ml.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),Ml.Konva=t}},Pn=t=>{Qe[t.prototype.getClassName()]=t};Qe._injectGlobal(Qe);const aC=`Konva.js unsupported environment.
263
+ [키워드] 키워드1, 키워드2`,value:K,onChange:G=>q(G.currentTarget.value),minRows:8,maxRows:12,autosize:!0,styles:{input:{fontFamily:"monospace",fontSize:12}}}),ge&&w.jsx(z.Alert,{color:"red",variant:"light",children:ge}),Q&&w.jsxs(z.Box,{children:[w.jsxs(z.Group,{gap:"xs",mb:"xs",children:[w.jsx(z.Text,{size:"sm",fw:500,children:"파싱된 슬라이드"}),w.jsxs(z.Badge,{color:"devdive",size:"sm",children:[Q.length,"개"]})]}),w.jsx(z.ScrollArea,{h:150,children:w.jsx(z.Stack,{gap:"xs",children:Q.map((G,j)=>w.jsxs(z.Paper,{p:"sm",radius:"md",withBorder:!0,style:{cursor:"pointer"},onClick:()=>L(j),children:[w.jsxs(z.Group,{justify:"space-between",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Text,{size:"xs",c:"dimmed",children:G.slideNumber}),w.jsx(z.Text,{size:"sm",fw:500,children:G.sectionTitle})]}),w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.Badge,{size:"xs",variant:"light",color:"gray",children:G.sectionType}),w.jsx(z.ActionIcon,{variant:"subtle",size:"xs",color:"gray",onClick:$=>{$.stopPropagation(),L(j)},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"edit"})})]})]}),G.keyPoints.length>0&&w.jsxs(z.Text,{size:"xs",c:"dimmed",mt:4,lineClamp:1,children:[G.keyPoints[0],"..."]})]},j))})})]})]})})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"컬러 테마"}),w.jsx(z.SimpleGrid,{cols:4,spacing:"xs",children:Object.keys(fs).map(G=>w.jsx(z.Paper,{p:"xs",radius:"md",withBorder:!0,style:{cursor:"pointer",borderColor:ne===G?"var(--devdive-primary)":void 0,borderWidth:ne===G?2:1},onClick:()=>le(G),children:w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Box,{w:16,h:16,style:{borderRadius:"50%",backgroundColor:fs[G].primary}}),w.jsx(z.Text,{size:"xs",tt:"capitalize",children:G})]})},G))})]}),w.jsxs(z.Group,{justify:"flex-end",gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:ce,children:"취소"}),s==="ai"?w.jsxs(w.Fragment,{children:[c==="input"&&w.jsx(z.Button,{color:"devdive",onClick:ee,loading:u||ae,disabled:!y.trim()||u||ae,leftSection:!u&&!ae?w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"account_tree"}):void 0,children:u||ae?"생성 중...":"구조 생성"}),c==="structure"&&w.jsx(z.Button,{color:"devdive",onClick:Ee,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"}),children:"콘텐츠 생성"}),c==="preview"&&I&&w.jsxs(z.Button,{color:"devdive",onClick:me,children:[I.length,"개 슬라이드 추가"]})]}):Q?w.jsxs(z.Button,{color:"devdive",onClick:qe,children:[Q.length,"개 슬라이드 추가"]}):w.jsx(z.Button,{color:"devdive",onClick:lt,disabled:!K.trim(),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"data_object"}),children:"데이터 파싱"})]})]})]}),Q&&se!==null&&w.jsx(B6,{isOpen:se!==null,onClose:()=>L(null),slide:Q[se],slideIndex:se,onSave:pt,onDelete:Lt})]})},F6=[{value:"realistic",label:"사실적"},{value:"illustration",label:"일러스트"},{value:"abstract",label:"추상"},{value:"3d",label:"3D"},{value:"minimalist",label:"미니멀"}],I6=[{value:"512x512",label:"512×512"},{value:"1024x1024",label:"1024×1024"}],O6=({isOpen:t,onClose:e,onBack:n})=>{const[s,i]=oe.useState(""),[c,d]=oe.useState("illustration"),[h,p]=oe.useState("512x512"),[u,A]=oe.useState(null),{generateImage:y,isLoading:x,error:S,reset:C}=uA(),{addElement:T}=Ve(),R=()=>`image-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,D=async()=>{if(s.trim())try{const I=await y({prompt:s.trim(),style:c,size:h});A(I.base64||I.imageUrl)}catch{}},M=()=>{if(!u)return;const[I,Y]=h.split("x").map(Number),K=Math.min(I,300),q=K/I*Y,Q={id:R(),type:"image",src:u.startsWith("data:")?u:`data:image/png;base64,${u}`,x:480-K/2,y:270-q/2,width:K,height:q,rotation:0};T(Q),P()},P=()=>{i(""),A(null),C(),e()},O=()=>{A(null),D()};return w.jsx(z.Modal,{opened:t,onClose:P,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:n,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"arrow_back"})}),w.jsx(z.Text,{fw:700,children:"이미지 생성"})]}),centered:!0,size:"md",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Textarea,{label:"이미지 설명",description:"생성하고 싶은 이미지를 자세히 설명해주세요",placeholder:"예: 미래 도시의 스카이라인, 푸른 하늘과 유리 건물",value:s,onChange:I=>i(I.currentTarget.value),minRows:3,autosize:!0}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"이미지 스타일"}),w.jsx(z.SegmentedControl,{value:c,onChange:I=>d(I),data:F6,fullWidth:!0,color:"devdive"})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"sm",fw:500,mb:"xs",children:"이미지 크기"}),w.jsx(z.SegmentedControl,{value:h,onChange:I=>p(I),data:I6,color:"devdive"})]}),S&&w.jsx(z.Alert,{color:"red",variant:"light",children:S}),x&&w.jsx(z.Paper,{p:"xl",radius:"md",withBorder:!0,bg:"gray.0",children:w.jsx(z.Center,{children:w.jsxs(z.Stack,{align:"center",gap:"md",children:[w.jsx(z.Loader,{color:"devdive",size:"lg"}),w.jsx(z.Text,{size:"sm",c:"dimmed",children:"이미지를 생성하고 있습니다..."})]})})}),u&&!x&&w.jsxs(z.Paper,{p:"md",radius:"md",withBorder:!0,bg:"gray.0",children:[w.jsxs(z.Group,{justify:"space-between",mb:"xs",children:[w.jsx(z.Text,{size:"sm",fw:500,c:"dimmed",children:"생성된 이미지"}),w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:O,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"refresh"})})]}),w.jsx(z.Center,{children:w.jsx(z.Image,{src:u.startsWith("data:")?u:`data:image/png;base64,${u}`,alt:"Generated image",radius:"md",maw:300,fit:"contain"})})]}),w.jsxs(z.Group,{justify:"flex-end",gap:"sm",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:P,children:"취소"}),u?w.jsx(z.Button,{color:"devdive",onClick:M,children:"슬라이드에 추가"}):w.jsx(z.Button,{color:"devdive",onClick:D,loading:x,disabled:!s.trim(),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"}),children:"이미지 생성"})]})]})})},U6=[{type:"text",icon:"edit_note",title:"텍스트 생성",description:"AI로 슬라이드 텍스트를 자동 생성",color:"blue"},{type:"slide",icon:"auto_awesome_mosaic",title:"슬라이드 자동 생성",description:"주제를 입력하면 여러 슬라이드 구성",color:"violet"},{type:"image",icon:"image",title:"이미지 생성",description:"AI로 맞춤 이미지를 생성",color:"pink"},{type:"design",icon:"palette",title:"디자인 제안",description:"레이아웃과 색상을 자동 추천",color:"teal"}],j6=({isOpen:t,onClose:e})=>{const[n,s]=oe.useState(null),i=h=>{s(h)},c=()=>{s(null)},d=()=>{s(null),e()};return w.jsxs(w.Fragment,{children:[w.jsx(z.Modal,{opened:t&&!n,onClose:d,title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx(z.ThemeIcon,{variant:"gradient",gradient:{from:"#5B6EF7",to:"#3b82f6"},size:"md",radius:"md",children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"auto_awesome"})}),w.jsx(z.Text,{fw:700,children:"AI 생성"}),w.jsx(z.Badge,{variant:"light",color:"devdive",size:"sm",children:"Beta"})]}),centered:!0,size:"lg",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsx(z.Text,{size:"sm",c:"dimmed",children:"AI를 활용하여 프레젠테이션을 더 빠르고 쉽게 만들어보세요."}),w.jsx(z.SimpleGrid,{cols:2,spacing:"md",children:U6.map(h=>w.jsx(z.Card,{padding:"lg",radius:"md",withBorder:!0,style:{cursor:"pointer",transition:"all 0.2s ease"},onClick:()=>i(h.type),onMouseEnter:p=>{p.currentTarget.style.borderColor="var(--devdive-primary)",p.currentTarget.style.transform="translateY(-2px)",p.currentTarget.style.boxShadow="0 4px 12px rgba(91, 110, 247, 0.15)"},onMouseLeave:p=>{p.currentTarget.style.borderColor="",p.currentTarget.style.transform="",p.currentTarget.style.boxShadow=""},children:w.jsxs(z.Group,{gap:"md",children:[w.jsx(z.ThemeIcon,{variant:"light",color:h.color,size:"xl",radius:"md",children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:24},children:h.icon})}),w.jsxs("div",{children:[w.jsx(z.Text,{fw:600,size:"sm",children:h.title}),w.jsx(z.Text,{size:"xs",c:"dimmed",mt:4,children:h.description})]})]})},h.type))})]})}),w.jsx(k6,{isOpen:n==="text",onClose:c,onBack:c}),w.jsx(z6,{isOpen:n==="slide",onClose:c,onBack:c}),w.jsx(O6,{isOpen:n==="image",onClose:c,onBack:c})]})},mx=()=>{const[t,e]=oe.useState("Untitled Presentation"),[n,s]=oe.useState(!1),[i,c]=oe.useState(!1),[d,h]=oe.useState("new"),[p,u]=oe.useState(!1),[A,y]=oe.useState(!1),x=Ve(I=>I.slides),S=Ve(I=>I.defaultBackground),C=Ve(I=>I.resetPresentation),T=Ve(I=>I.loadSlides),R=oe.useRef(null),D=async()=>{if(!n){s(!0);try{await hx(x,t.replace(/\s+/g,"_"))}catch(I){console.error("PPTX 생성 실패:",I)}finally{s(!1)}}},M=()=>{const I={version:1,title:t,slides:x,defaultBackground:S,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},Y=new Blob([JSON.stringify(I,null,2)],{type:"application/json"}),K=URL.createObjectURL(Y),q=document.createElement("a");q.href=K,q.download=`${t.replace(/\s+/g,"_")}.ddslide`,document.body.appendChild(q),q.click(),document.body.removeChild(q),URL.revokeObjectURL(K)},P=I=>{var q;const Y=(q=I.target.files)==null?void 0:q[0];if(!Y)return;const K=new FileReader;K.onload=Q=>{var V;try{const ge=(V=Q.target)==null?void 0:V.result,X=JSON.parse(ge);if(!X.slides||!Array.isArray(X.slides))throw new Error("Invalid file format");T(X.slides,X.defaultBackground),X.title&&e(X.title)}catch(ge){console.error("파일 불러오기 실패:",ge),alert("파일을 불러올 수 없습니다. 올바른 .ddslide 파일인지 확인해주세요.")}},K.readAsText(Y),I.target.value=""},O=()=>{C(),e("Untitled Presentation"),y(!1)};return w.jsxs(z.Box,{component:"header",h:56,px:"md",bg:"white",style:{borderBottom:"1px solid var(--devdive-border-light)",zIndex:20,boxShadow:"0 1px 3px rgba(0, 0, 0, 0.05)"},children:[w.jsxs(z.Group,{h:"100%",justify:"space-between",children:[w.jsxs(z.Group,{gap:"md",children:[w.jsx(z.Box,{w:32,h:32,bg:"var(--devdive-primary)",style:{borderRadius:"var(--mantine-radius-md)",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 6px rgba(91, 110, 247, 0.2)"},children:w.jsx("span",{className:"material-symbols-outlined",style:{color:"white",fontSize:20},children:"auto_awesome"})}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:700,c:"dimmed",tt:"uppercase",lts:"-0.05em",children:"Presentation"}),w.jsx(z.TextInput,{value:t,onChange:I=>e(I.currentTarget.value),placeholder:"제목을 입력하세요",variant:"unstyled",size:"sm",w:192,styles:{input:{fontWeight:600,letterSpacing:"-0.01em",padding:0,height:"auto",minHeight:"auto"}}})]})]}),w.jsxs(z.Group,{gap:"sm",children:[w.jsxs(z.Menu,{shadow:"md",width:180,position:"bottom-start",children:[w.jsx(z.Menu.Target,{children:w.jsx(z.Button,{variant:"subtle",color:"gray",size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"folder"}),children:"파일"})}),w.jsxs(z.Menu.Dropdown,{children:[w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"note_add"}),onClick:()=>y(!0),children:"새로 만들기"}),w.jsx(z.Menu.Divider,{}),w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"save"}),onClick:M,children:"저장 (.ddslide)"}),w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"folder_open"}),onClick:()=>{var I;return(I=R.current)==null?void 0:I.click()},children:"불러오기"}),w.jsx(z.Menu.Divider,{}),w.jsx(z.Menu.Item,{leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"download"}),onClick:D,disabled:n,children:"PPTX 내보내기"})]})]}),w.jsx("input",{ref:R,type:"file",accept:".ddslide,.json",style:{display:"none"},onChange:P}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Button,{variant:"subtle",color:"gray",size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"dashboard"}),onClick:()=>{h("apply"),c(!0)},children:"템플릿"}),w.jsx(z.Button,{variant:"light",color:"devdive",size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"add"}),onClick:()=>{h("new"),c(!0)},children:"새 슬라이드"}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Button,{variant:"gradient",gradient:{from:"#5B6EF7",to:"#3b82f6"},size:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"auto_awesome"}),onClick:()=>u(!0),children:"AI 생성"}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Button,{color:"devdive",size:"xs",fw:700,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"download"}),onClick:D,loading:n,style:{boxShadow:"0 4px 6px rgba(91, 110, 247, 0.2)"},children:n?"Exporting...":"EXPORT"})]})]}),w.jsx(px,{isOpen:i,onClose:()=>c(!1),mode:d}),w.jsx(j6,{isOpen:p,onClose:()=>u(!1)}),w.jsx(z.Modal,{opened:A,onClose:()=>y(!1),title:w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20,color:"#f59e0b"},children:"warning"}),w.jsx(z.Text,{fw:700,children:"새 프레젠테이션"})]}),centered:!0,size:"sm",children:w.jsxs(z.Stack,{gap:"md",children:[w.jsxs(z.Text,{size:"sm",c:"dimmed",children:["현재 작업 중인 프레젠테이션이 삭제됩니다.",w.jsx("br",{}),"저장하지 않은 변경사항은 복구할 수 없습니다."]}),w.jsxs(z.Group,{justify:"flex-end",children:[w.jsx(z.Button,{variant:"subtle",color:"gray",onClick:()=>y(!1),children:"취소"}),w.jsx(z.Button,{color:"red",onClick:O,children:"새로 만들기"})]})]})})]})};function dA(){return(dA=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t}).apply(this,arguments)}function gx(t,e){if(t==null)return{};var n,s,i={},c=Object.keys(t);for(s=0;s<c.length;s++)e.indexOf(n=c[s])>=0||(i[n]=t[n]);return i}function Sg(t){var e=oe.useRef(t),n=oe.useRef(function(s){e.current&&e.current(s)});return e.current=t,n.current}var Rf=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},xf=function(t){return"touches"in t},Cg=function(t){return t&&t.ownerDocument.defaultView||self},n2=function(t,e,n){var s=t.getBoundingClientRect(),i=xf(e)?(function(c,d){for(var h=0;h<c.length;h++)if(c[h].identifier===d)return c[h];return c[0]})(e.touches,n):e;return{left:Rf((i.pageX-(s.left+Cg(t).pageXOffset))/s.width),top:Rf((i.pageY-(s.top+Cg(t).pageYOffset))/s.height)}},r2=function(t){!xf(t)&&t.preventDefault()},vx=oe.memo(function(t){var e=t.onMove,n=t.onKey,s=gx(t,["onMove","onKey"]),i=oe.useRef(null),c=Sg(e),d=Sg(n),h=oe.useRef(null),p=oe.useRef(!1),u=oe.useMemo(function(){var S=function(R){r2(R),(xf(R)?R.touches.length>0:R.buttons>0)&&i.current?c(n2(i.current,R,h.current)):T(!1)},C=function(){return T(!1)};function T(R){var D=p.current,M=Cg(i.current),P=R?M.addEventListener:M.removeEventListener;P(D?"touchmove":"mousemove",S),P(D?"touchend":"mouseup",C)}return[function(R){var D=R.nativeEvent,M=i.current;if(M&&(r2(D),!(function(O,I){return I&&!xf(O)})(D,p.current)&&M)){if(xf(D)){p.current=!0;var P=D.changedTouches||[];P.length&&(h.current=P[0].identifier)}M.focus(),c(n2(M,D,h.current)),T(!0)}},function(R){var D=R.which||R.keyCode;D<37||D>40||(R.preventDefault(),d({left:D===39?.05:D===37?-.05:0,top:D===40?.05:D===38?-.05:0}))},T]},[d,c]),A=u[0],y=u[1],x=u[2];return oe.useEffect(function(){return x},[x]),oe.createElement("div",dA({},s,{onTouchStart:A,onMouseDown:A,className:"react-colorful__interactive",ref:i,onKeyDown:y,tabIndex:0,role:"slider"}))}),Wg=function(t){return t.filter(Boolean).join(" ")},yx=function(t){var e=t.color,n=t.left,s=t.top,i=s===void 0?.5:s,c=Wg(["react-colorful__pointer",t.className]);return oe.createElement("div",{className:c,style:{top:100*i+"%",left:100*n+"%"}},oe.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Br=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},G6=function(t){return Y6(wg(t))},wg=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Br(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Br(parseInt(t.substring(6,8),16)/255,2):1}},H6=function(t){return Q6(W6(t))},X6=function(t){var e=t.s,n=t.v,s=t.a,i=(200-e)*n/100;return{h:Br(t.h),s:Br(i>0&&i<200?e*n/100/(i<=100?i:200-i)*100:0),l:Br(i/2),a:Br(s,2)}},_g=function(t){var e=X6(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},W6=function(t){var e=t.h,n=t.s,s=t.v,i=t.a;e=e/360*6,n/=100,s/=100;var c=Math.floor(e),d=s*(1-n),h=s*(1-(e-c)*n),p=s*(1-(1-e+c)*n),u=c%6;return{r:Br(255*[s,h,d,d,p,s][u]),g:Br(255*[p,s,s,h,d,d][u]),b:Br(255*[d,d,p,s,s,h][u]),a:Br(i,2)}},Mp=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Q6=function(t){var e=t.r,n=t.g,s=t.b,i=t.a,c=i<1?Mp(Br(255*i)):"";return"#"+Mp(e)+Mp(n)+Mp(s)+c},Y6=function(t){var e=t.r,n=t.g,s=t.b,i=t.a,c=Math.max(e,n,s),d=c-Math.min(e,n,s),h=d?c===e?(n-s)/d:c===n?2+(s-e)/d:4+(e-n)/d:0;return{h:Br(60*(h<0?h+6:h)),s:Br(c?d/c*100:0),v:Br(c/255*100),a:i}},V6=oe.memo(function(t){var e=t.hue,n=t.onChange,s=Wg(["react-colorful__hue",t.className]);return oe.createElement("div",{className:s},oe.createElement(vx,{onMove:function(i){n({h:360*i.left})},onKey:function(i){n({h:Rf(e+360*i.left,0,360)})},"aria-label":"Hue","aria-valuenow":Br(e),"aria-valuemax":"360","aria-valuemin":"0"},oe.createElement(yx,{className:"react-colorful__hue-pointer",left:e/360,color:_g({h:e,s:100,v:100,a:1})})))}),q6=oe.memo(function(t){var e=t.hsva,n=t.onChange,s={backgroundColor:_g({h:e.h,s:100,v:100,a:1})};return oe.createElement("div",{className:"react-colorful__saturation",style:s},oe.createElement(vx,{onMove:function(i){n({s:100*i.left,v:100-100*i.top})},onKey:function(i){n({s:Rf(e.s+100*i.left,0,100),v:Rf(e.v-100*i.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Br(e.s)+"%, Brightness "+Br(e.v)+"%"},oe.createElement(yx,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:_g(e)})))}),xx=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},K6=function(t,e){return t.toLowerCase()===e.toLowerCase()||xx(wg(t),wg(e))};function J6(t,e,n){var s=Sg(n),i=oe.useState(function(){return t.toHsva(e)}),c=i[0],d=i[1],h=oe.useRef({color:e,hsva:c});oe.useEffect(function(){if(!t.equal(e,h.current.color)){var u=t.toHsva(e);h.current={hsva:u,color:e},d(u)}},[e,t]),oe.useEffect(function(){var u;xx(c,h.current.hsva)||t.equal(u=t.fromHsva(c),h.current.color)||(h.current={hsva:c,color:u},s(u))},[c,t,s]);var p=oe.useCallback(function(u){d(function(A){return Object.assign({},A,u)})},[]);return[c,p]}var Z6=typeof window<"u"?oe.useLayoutEffect:oe.useEffect,$6=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},a2=new Map,eC=function(t){Z6(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!a2.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,a2.set(e,n);var s=$6();s&&n.setAttribute("nonce",s),e.head.appendChild(n)}},[])},tC=function(t){var e=t.className,n=t.colorModel,s=t.color,i=s===void 0?n.defaultColor:s,c=t.onChange,d=gx(t,["className","colorModel","color","onChange"]),h=oe.useRef(null);eC(h);var p=J6(n,i,c),u=p[0],A=p[1],y=Wg(["react-colorful",e]);return oe.createElement("div",dA({},d,{ref:h,className:y}),oe.createElement(q6,{hsva:u,onChange:A}),oe.createElement(V6,{hue:u.h,onChange:A,className:"react-colorful__last-control"}))},nC={defaultColor:"000",toHsva:G6,fromHsva:function(t){return H6({h:t.h,s:t.s,v:t.v,a:1})},equal:K6},bx=function(t){return oe.createElement(tC,dA({},t,{colorModel:nC}))};const Sx=()=>{var re;const t=Ve(U=>U.mode),e=Ve(U=>U.currentShapeType),n=Ve(U=>U.currentTextStyle),s=Ve(U=>U.currentFontFamily),i=Ve(U=>U.selectedElementId),c=Ve(U=>U.slides),d=Ve(U=>U.currentSlideIndex),h=Ve(U=>U.setMode),p=Ve(U=>U.setShapeType),u=Ve(U=>U.setTextStyle),A=Ve(U=>U.setFontFamily),y=Ve(U=>U.deleteElement),x=Ve(U=>U.addElement),S=Ve(U=>U.updateSlideBackground),C=Ve(U=>U.updateAllSlidesBackground),T=Ve(U=>U.snapSettings),R=Ve(U=>U.toggleSnap),[D,M]=oe.useState(!1),P=oe.useRef(null),O=oe.useRef(null),[I,Y]=oe.useState({x:0,y:0}),[K,q]=oe.useState({isDragging:!1,startX:0,startY:0,offsetX:0,offsetY:0}),Q=((re=c[d])==null?void 0:re.background)||"#ffffff",V=oe.useCallback(U=>{const ee=U.target;ee.closest("button")||ee.closest('[role="button"]')||ee.closest("input")||ee.closest("[data-mantine-popover]")||(U.preventDefault(),q({isDragging:!0,startX:U.clientX,startY:U.clientY,offsetX:I.x,offsetY:I.y}))},[I]);oe.useEffect(()=>{if(!K.isDragging)return;const U=Ee=>{const Te=Ee.clientX-K.startX,Ne=Ee.clientY-K.startY;let Ue=K.offsetX+Te,ot=K.offsetY+Ne;if(O.current){const lt=O.current.getBoundingClientRect(),pt=window.innerWidth,Lt=window.innerHeight,qe=lt.width,Dt=lt.height,me=pt/2,k=24,ce=8,de=-me+qe/2+ce,G=me-qe/2-ce;Ue=Math.max(de,Math.min(G,Ue));const j=-k+ce,$=Lt-k-Dt-ce;ot=Math.max(j,Math.min($,ot))}Y({x:Ue,y:ot})},ee=()=>{q(Ee=>({...Ee,isDragging:!1}))};return document.addEventListener("mousemove",U),document.addEventListener("mouseup",ee),()=>{document.removeEventListener("mousemove",U),document.removeEventListener("mouseup",ee)}},[K.isDragging,K.startX,K.startY,K.offsetX,K.offsetY]);const ge=U=>{h(U)},X=U=>{p(U),h("shape")},se=U=>{u(U),h("text")},L=()=>{i&&y(i)},ne=U=>{var Te;const ee=(Te=U.target.files)==null?void 0:Te[0];if(!ee)return;const Ee=new FileReader;Ee.onload=Ne=>{var lt;const Ue=(lt=Ne.target)==null?void 0:lt.result,ot=new window.Image;ot.onload=()=>{let qe=ot.width,Dt=ot.height;qe>400&&(Dt=400/qe*Dt,qe=400),Dt>300&&(qe=300/Dt*qe,Dt=300);const me={id:fi(),type:"image",x:100,y:100,width:qe,height:Dt,rotation:0,src:Ue};x(me)},ot.src=Ue},Ee.readAsDataURL(ee),U.target.value=""},le=()=>{const U={id:fi(),type:"shape",x:100,y:100,width:300,height:200,rotation:0,shapeType:"rect",fill:"#5B6EF720",stroke:"#5B6EF7",strokeWidth:2,text:"클릭하여 이미지 추가",textColor:"#5B6EF7",textSize:16,cornerRadius:12,isImagePlaceholder:!0};x(U),h("select")},pe={title:"제목",subtitle:"소제목",body:"본문",caption:"캡션"},J={rect:{label:"사각형",icon:"rectangle"},ellipse:{label:"원형",icon:"circle"},triangle:{label:"삼각형",icon:"change_history"},line:{label:"선",icon:"horizontal_rule"},arrow:{label:"화살표",icon:"arrow_forward"}},ae=["#ffffff","#f8fafc","#f1f5f9","#e2e8f0","#1e293b","#0f172a","#5B6EF7","#3b82f6","#ef4444","#22c55e","#f97316","#8b5cf6"];return w.jsx(z.Box,{ref:O,pos:"absolute",top:24,left:"50%",style:{transform:`translate(calc(-50% + ${I.x}px), ${I.y}px)`,zIndex:30,cursor:K.isDragging?"grabbing":"default"},children:w.jsxs(z.Group,{gap:4,px:"sm",py:10,bg:"white",wrap:"nowrap",onMouseDown:V,style:{border:"1px solid var(--devdive-border-light)",borderRadius:"var(--mantine-radius-xl)",boxShadow:"0 8px 30px rgb(0, 0, 0, 0.08)",userSelect:"none",whiteSpace:"nowrap"},children:[w.jsx(z.Tooltip,{label:"드래그하여 이동",children:w.jsx(z.Box,{style:{cursor:"grab",display:"flex",alignItems:"center",padding:"0 4px"},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--mantine-color-gray-5)"},children:"drag_indicator"})})}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Tooltip,{label:"선택 도구",children:w.jsx(z.ActionIcon,{variant:t==="select"?"light":"subtle",color:t==="select"?"devdive":"gray",size:"lg",radius:"lg",onClick:()=>ge("select"),children:w.jsx("span",{className:"material-symbols-outlined",children:"arrow_selector_tool"})})}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsxs(z.Menu,{shadow:"md",radius:"lg",children:[w.jsx(z.Menu.Target,{children:w.jsx(z.Button,{variant:t==="text"?"light":"subtle",color:t==="text"?"devdive":"gray",size:"xs",radius:"lg",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"title"}),rightSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"expand_more"}),children:pe[n]})}),w.jsx(z.Menu.Dropdown,{children:Object.keys(Eu).map(U=>w.jsx(z.Menu.Item,{onClick:()=>se(U),rightSection:n===U?w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"check"}):null,style:{backgroundColor:n===U?"rgba(91, 110, 247, 0.05)":void 0,color:n===U?"var(--devdive-primary)":void 0},children:w.jsx("span",{style:{fontSize:Math.max(14,Math.min(Eu[U].fontSize/2,18)),fontWeight:Eu[U].fontWeight},children:pe[U]})},U))})]}),w.jsx(z.Select,{value:s,onChange:U=>U&&A(U),data:f6.map(U=>({value:U.value,label:U.name})),size:"xs",w:100,variant:"unstyled",styles:{input:{fontWeight:500,cursor:"pointer"}}}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx("input",{ref:P,type:"file",accept:"image/*",onChange:ne,style:{display:"none"}}),w.jsxs(z.Menu,{shadow:"md",radius:"lg",children:[w.jsx(z.Menu.Target,{children:w.jsx(z.Button,{variant:t==="shape"?"light":"subtle",color:t==="shape"?"devdive":"gray",size:"xs",radius:"lg",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:J[e].icon}),rightSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"expand_more"}),children:J[e].label})}),w.jsxs(z.Menu.Dropdown,{children:[Object.keys(J).map(U=>w.jsx(z.Menu.Item,{onClick:()=>X(U),leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:J[U].icon}),rightSection:e===U?w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"check"}):null,style:{backgroundColor:e===U?"rgba(91, 110, 247, 0.05)":void 0,color:e===U?"var(--devdive-primary)":void 0},children:J[U].label},U)),w.jsx(z.Menu.Divider,{}),w.jsx(z.Menu.Item,{onClick:le,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"image"}),children:"이미지"})]})]}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsxs(z.Popover,{opened:D,onChange:M,position:"bottom-end",radius:"lg",shadow:"xl",children:[w.jsx(z.Popover.Target,{children:w.jsx(z.Tooltip,{label:"배경 색상",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"lg",radius:"lg",onClick:()=>M(!D),children:w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Box,{w:20,h:20,style:{borderRadius:4,border:"1px solid var(--devdive-border-light)",backgroundColor:Q}}),w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14,color:"var(--mantine-color-gray-5)"},children:"expand_more"})]})})})}),w.jsx(z.Popover.Dropdown,{p:"sm",miw:220,children:w.jsxs(z.Stack,{gap:"sm",children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",children:"배경 색상"}),w.jsx(bx,{color:Q,onChange:U=>S(U)}),w.jsx(z.Box,{pt:"sm",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.SimpleGrid,{cols:4,spacing:6,children:ae.map(U=>w.jsx(z.ActionIcon,{size:"sm",variant:"outline",color:"gray",onClick:()=>S(U),style:{backgroundColor:U,borderColor:"var(--devdive-border-light)"}},U))})}),w.jsx(z.Box,{pt:"sm",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.Button,{variant:"light",color:"gray",size:"xs",fullWidth:!0,leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"layers"}),onClick:()=>{C(Q),M(!1)},children:"전체 슬라이드에 적용"})})]})})]}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Tooltip,{label:`스냅 ${T.enabled?"ON":"OFF"}`,children:w.jsx(z.ActionIcon,{variant:T.enabled?"light":"subtle",color:T.enabled?"devdive":"gray",size:"lg",radius:"lg",onClick:R,children:w.jsx("span",{className:"material-symbols-outlined",children:"grid_on"})})}),w.jsx(z.Divider,{orientation:"vertical",h:24,my:"auto"}),w.jsx(z.Tooltip,{label:"삭제",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"red",size:"lg",radius:"lg",onClick:L,disabled:!i,children:w.jsx("span",{className:"material-symbols-outlined",children:"delete"})})})]})})},rC=Math.PI/180;function aC(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}const Ml=typeof global<"u"?global:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},Qe={_global:Ml,version:"10.2.0",isBrowser:aC(),isUnminified:/param/.test((function(t){}).toString()),dblClickWindow:400,getAngle(t){return Qe.angleDeg?t*rC:t},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,_renderBackend:"web",legacyTextRendering:!1,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return Qe.DD.isDragging},isTransforming(){var t,e;return(e=(t=Qe.Transformer)===null||t===void 0?void 0:t.isTransforming())!==null&&e!==void 0?e:!1},isDragReady(){return!!Qe.DD.node},releaseCanvasOnDestroy:!0,document:Ml.document,_injectGlobal(t){typeof Ml.Konva<"u"&&console.error("Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment."),Ml.Konva=t}},Pn=t=>{Qe[t.prototype.getClassName()]=t};Qe._injectGlobal(Qe);const iC=`Konva.js unsupported environment.
264
264
 
265
265
  Looks like you are trying to use Konva.js in Node.js environment. because "document" object is undefined.
266
266
 
@@ -273,8 +273,8 @@ or
273
273
 
274
274
  bash: npm install skia-canvas
275
275
  js: import "konva/skia-backend";
276
- `,i2=()=>{if(typeof document>"u")throw new Error(aC)};class Qa{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Qa(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){const n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){const n=Math.cos(e),s=Math.sin(e),i=this.m[0]*n+this.m[2]*s,c=this.m[1]*n+this.m[3]*s,d=this.m[0]*-s+this.m[2]*n,h=this.m[1]*-s+this.m[3]*n;return this.m[0]=i,this.m[1]=c,this.m[2]=d,this.m[3]=h,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){const s=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,c=this.m[2]+this.m[0]*e,d=this.m[3]+this.m[1]*e;return this.m[0]=s,this.m[1]=i,this.m[2]=c,this.m[3]=d,this}multiply(e){const n=this.m[0]*e.m[0]+this.m[2]*e.m[1],s=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],c=this.m[1]*e.m[2]+this.m[3]*e.m[3],d=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],h=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=s,this.m[2]=i,this.m[3]=c,this.m[4]=d,this.m[5]=h,this}invert(){const e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,s=-this.m[1]*e,i=-this.m[2]*e,c=this.m[0]*e,d=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),h=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=s,this.m[2]=i,this.m[3]=c,this.m[4]=d,this.m[5]=h,this}getMatrix(){return this.m}decompose(){const e=this.m[0],n=this.m[1],s=this.m[2],i=this.m[3],c=this.m[4],d=this.m[5],h=e*i-n*s,p={x:c,y:d,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){const u=Math.sqrt(e*e+n*n);p.rotation=n>0?Math.acos(e/u):-Math.acos(e/u),p.scaleX=u,p.scaleY=h/u,p.skewX=(e*s+n*i)/h,p.skewY=0}else if(s!=0||i!=0){const u=Math.sqrt(s*s+i*i);p.rotation=Math.PI/2-(i>0?Math.acos(-s/u):-Math.acos(s/u)),p.scaleX=h/u,p.scaleY=u,p.skewX=0,p.skewY=(e*s+n*i)/h}return p.rotation=he._getRotation(p.rotation),p}}const iC="[object Array]",sC="[object Number]",oC="[object String]",lC="[object Boolean]",cC=Math.PI/180,uC=180/Math.PI,af="#",dC="",fC="0",hC="Konva warning: ",s2="Konva error: ",pC="rgb(",Zm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},AC=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let Pp=[],sf=null;const mC=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,16)},he={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===iC},_isNumber(t){return Object.prototype.toString.call(t)===sC&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===oC},_isBoolean(t){return Object.prototype.toString.call(t)===lC},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;const e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Pp.push(t),Pp.length===1&&mC(function(){const e=Pp;Pp=[],e.forEach(function(n){n()})})},createCanvasElement(){i2();const t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return i2(),document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){const n=he.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(af,dC);const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){let t=(Math.random()*16777215<<0).toString(16);for(;t.length<6;)t=fC+t;return af+t},isCanvasFarblingActive(){if(sf!==null)return sf;if(typeof document>"u")return sf=!1,!1;const t=this.createCanvasElement();t.width=10,t.height=10;const e=t.getContext("2d",{willReadFrequently:!0});e.clearRect(0,0,10,10),e.fillStyle="#282828",e.fillRect(0,0,10,10);const n=e.getImageData(0,0,10,10).data;let s=!1;for(let i=0;i<100;i++)if(n[i*4]!==40||n[i*4+1]!==40||n[i*4+2]!==40||n[i*4+3]!==255){s=!0;break}return sf=s,this.releaseCanvas(t),sf},getHitColor(){const t=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(t):t},getHitColorKey(t,e,n){return this.isCanvasFarblingActive()&&(t=Math.round(t/5)*5,e=Math.round(e/5)*5,n=Math.round(n/5)*5),af+this._rgbToHex(t,e,n)},getSnappedHexColor(t){const e=this._hexToRgb(t);return af+this._rgbToHex(Math.round(e.r/5)*5,Math.round(e.g/5)*5,Math.round(e.b/5)*5)},getRGB(t){let e;return t in Zm?(e=Zm[t],{r:e[0],g:e[1],b:e[2]}):t[0]===af?this._hexToRgb(t.substring(1)):t.substr(0,4)===pC?(e=AC.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",he._namedColorToRBA(t)||he._hex3ColorToRGBA(t)||he._hex4ColorToRGBA(t)||he._hex6ColorToRGBA(t)||he._hex8ColorToRGBA(t)||he._rgbColorToRGBA(t)||he._rgbaColorToRGBA(t)||he._hslColorToRGBA(t)},_namedColorToRBA(t){const e=Zm[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];const e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];const e=t.split(/ *, */).map((n,s)=>n.slice(-1)==="%"?s===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),s=Number(n[0])/360,i=Number(n[1])/100,c=Number(n[2])/100;let d,h,p;if(i===0)return p=c*255,{r:Math.round(p),g:Math.round(p),b:Math.round(p),a:1};c<.5?d=c*(1+i):d=c+i-c*i;const u=2*c-d,A=[0,0,0];for(let y=0;y<3;y++)h=s+1/3*-(y-1),h<0&&h++,h>1&&h--,6*h<1?p=u+(d-u)*6*h:2*h<1?p=d:3*h<2?p=u+(d-u)*(2/3-h)*6:p=u,A[y]=p*255;return{r:Math.round(A[0]),g:Math.round(A[1]),b:Math.round(A[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y)},cloneObject(t){const e={};for(const n in t)this._isPlainObject(t[n])?e[n]=this.cloneObject(t[n]):this._isArray(t[n])?e[n]=this.cloneArray(t[n]):e[n]=t[n];return e},cloneArray(t){return t.slice(0)},degToRad(t){return t*cC},radToDeg(t){return t*uC},_degToRad(t){return he.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),he.degToRad(t)},_radToDeg(t){return he.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),he.radToDeg(t)},_getRotation(t){return Qe.angleDeg?he.radToDeg(t):t},_capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw(t){throw new Error(s2+t)},error(t){console.error(s2+t)},warn(t){Qe.showWarnings&&console.warn(hC+t)},each(t,e){for(const n in t)e(n,t[n])},_inRange(t,e,n){return e<=t&&t<n},_getProjectionToSegment(t,e,n,s,i,c){let d,h,p;const u=(t-n)*(t-n)+(e-s)*(e-s);if(u==0)d=t,h=e,p=(i-n)*(i-n)+(c-s)*(c-s);else{const A=((i-t)*(n-t)+(c-e)*(s-e))/u;A<0?(d=t,h=e,p=(t-i)*(t-i)+(e-c)*(e-c)):A>1?(d=n,h=s,p=(n-i)*(n-i)+(s-c)*(s-c)):(d=t+A*(n-t),h=e+A*(s-e),p=(d-i)*(d-i)+(h-c)*(h-c))}return[d,h,p]},_getProjectionToLine(t,e,n){const s=he.cloneObject(t);let i=Number.MAX_VALUE;return e.forEach(function(c,d){if(!n&&d===e.length-1)return;const h=e[(d+1)%e.length],p=he._getProjectionToSegment(c.x,c.y,h.x,h.y,t.x,t.y),u=p[0],A=p[1],y=p[2];y<i&&(s.x=u,s.y=A,i=y)}),s},_prepareArrayForTween(t,e,n){const s=[],i=[];if(t.length>e.length){const d=e;e=t,t=d}for(let d=0;d<t.length;d+=2)s.push({x:t[d],y:t[d+1]});for(let d=0;d<e.length;d+=2)i.push({x:e[d],y:e[d+1]});const c=[];return i.forEach(function(d){const h=he._getProjectionToLine(d,s,n);c.push(h.x),c.push(h.y)}),c},_prepareToStringify(t){let e;t.visitedByCircularReferenceRemoval=!0;for(const n in t)if(t.hasOwnProperty(n)&&t[n]&&typeof t[n]=="object"){if(e=Object.getOwnPropertyDescriptor(t,n),t[n].visitedByCircularReferenceRemoval||he._isElement(t[n]))if(e.configurable)delete t[n];else return null;else if(he._prepareToStringify(t[n])===null)if(e.configurable)delete t[n];else return null}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(const n in e)t[n]=e[n];return t},_getFirstPointerId(t){return t.touches?t.changedTouches[0].identifier:t.pointerId||999},releaseCanvas(...t){Qe.releaseCanvasOnDestroy&&t.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,s){let i=e<0?e:0,c=n<0?n:0;e=Math.abs(e),n=Math.abs(n);let d=0,h=0,p=0,u=0;typeof s=="number"?d=h=p=u=Math.min(s,e/2,n/2):(d=Math.min(s[0]||0,e/2,n/2),h=Math.min(s[1]||0,e/2,n/2),u=Math.min(s[2]||0,e/2,n/2),p=Math.min(s[3]||0,e/2,n/2)),t.moveTo(i+d,c),t.lineTo(i+e-h,c),t.arc(i+e-h,c+h,h,Math.PI*3/2,0,!1),t.lineTo(i+e,c+n-u),t.arc(i+e-u,c+n-u,u,0,Math.PI/2,!1),t.lineTo(i+p,c+n),t.arc(i+p,c+n-p,p,Math.PI/2,Math.PI,!1),t.lineTo(i,c+d),t.arc(i+d,c+d,d,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(t,e,n,s,i){s=Math.abs(s);for(let c=0;c<n;c++){const d=e[(c-1+n)%n],h=e[c],p=e[(c+1)%n],u={x:h.x-d.x,y:h.y-d.y},A={x:p.x-h.x,y:p.y-h.y},y=Math.hypot(u.x,u.y),x=Math.hypot(A.x,A.y);let S;typeof i=="number"?S=i:S=c<i.length?i[c]:0,S=s*Math.cos(Math.PI/n)*Math.min(1,S/s*2);const T={x:u.x/y,y:u.y/y},R={x:A.x/x,y:A.y/x},D={x:h.x-T.x*S,y:h.y-T.y*S},M={x:h.x+R.x*S,y:h.y+R.y*S};c===0?t.moveTo(D.x,D.y):t.lineTo(D.x,D.y),t.arcTo(h.x,h.y,M.x,M.y,S)}}};function gC(t){const e=[],n=t.length,s=he;for(let i=0;i<n;i++){let c=t[i];s._isNumber(c)?c=Math.round(c*1e3)/1e3:s._isString(c)||(c=c+""),e.push(c)}return e}const o2=",",vC="(",yC=")",xC="([",bC="])",SC=";",CC="()",wC="=",l2=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],_C=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],EC=100;let zp=null;function c2(){if(zp!==null)return zp;try{const e=he.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(zp=!1,!1)}catch{return zp=!1,!1}}class fA{constructor(e){this.canvas=e,Qe.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,n){let s=this.traceArr,i=s.length,c="",d,h,p,u;for(d=0;d<i;d++)h=s[d],p=h.method,p?(u=h.args,c+=p,e?c+=CC:he._isArray(u[0])?c+=xC+u.join(o2)+bC:(n&&(u=u.map(A=>typeof A=="number"?Math.floor(A):A)),c+=vC+u.join(o2)+yC)):(c+=h.property,e||(c+=wC+h.val)),c+=SC;return c}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,s;n.push(e),s=n.length,s>=EC&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){const n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}_applyMiterLimit(e){const n=e.attrs.miterLimit;n!=null&&this.setAttr("miterLimit",n)}setAttr(e,n){this._context[e]=n}arc(e,n,s,i,c,d){this._context.arc(e,n,s,i,c,d)}arcTo(e,n,s,i,c){this._context.arcTo(e,n,s,i,c)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,s,i,c,d){this._context.bezierCurveTo(e,n,s,i,c,d)}clearRect(e,n,s,i){this._context.clearRect(e,n,s,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){const s=arguments;if(s.length===2)return this._context.createImageData(e,n);if(s.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,s,i){return this._context.createLinearGradient(e,n,s,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,s,i,c,d){return this._context.createRadialGradient(e,n,s,i,c,d)}drawImage(e,n,s,i,c,d,h,p,u){const A=arguments,y=this._context;A.length===3?y.drawImage(e,n,s):A.length===5?y.drawImage(e,n,s,i,c):A.length===9&&y.drawImage(e,n,s,i,c,d,h,p,u)}ellipse(e,n,s,i,c,d,h,p){this._context.ellipse(e,n,s,i,c,d,h,p)}isPointInPath(e,n,s,i){return s?this._context.isPointInPath(s,e,n,i):this._context.isPointInPath(e,n,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,s,i){this._context.fillRect(e,n,s,i)}strokeRect(e,n,s,i){this._context.strokeRect(e,n,s,i)}fillText(e,n,s,i){i?this._context.fillText(e,n,s,i):this._context.fillText(e,n,s)}measureText(e){return this._context.measureText(e)}getImageData(e,n,s,i){return this._context.getImageData(e,n,s,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,s,i){this._context.rect(e,n,s,i)}roundRect(e,n,s,i,c){this._context.roundRect(e,n,s,i,c)}putImageData(e,n,s){this._context.putImageData(e,n,s)}quadraticCurveTo(e,n,s,i){this._context.quadraticCurveTo(e,n,s,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,s,i,c,d){this._context.setTransform(e,n,s,i,c,d)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,s,i){this._context.strokeText(e,n,s,i)}transform(e,n,s,i,c,d){this._context.transform(e,n,s,i,c,d)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=l2.length,s=this.setAttr,i,c;const d=function(h){let p=e[h],u;e[h]=function(){return c=gC(Array.prototype.slice.call(arguments,0)),u=p.apply(e,arguments),e._trace({method:h,args:c}),u}};for(i=0;i<n;i++)d(l2[i]);e.setAttr=function(){s.apply(e,arguments);const h=arguments[0];let p=arguments[1];(h==="shadowOffsetX"||h==="shadowOffsetY"||h==="shadowBlur")&&(p=p/this.canvas.getPixelRatio()),e._trace({property:h,val:p})}}_applyGlobalCompositeOperation(e){const n=e.attrs.globalCompositeOperation;!n||n==="source-over"||this.setAttr("globalCompositeOperation",n)}}_C.forEach(function(t){Object.defineProperty(fA.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class TC extends fA{constructor(e,{willReadFrequently:n=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){const n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const n=e._getLinearGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fillRadialGradient(e){const n=e._getRadialGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fill(e){const n=e.fill(),s=e.getFillPriority();if(n&&s==="color"){this._fillColor(e);return}const i=e.getFillPatternImage();if(i&&s==="pattern"){this._fillPattern(e);return}const c=e.getFillLinearGradientColorStops();if(c&&s==="linear-gradient"){this._fillLinearGradient(e);return}const d=e.getFillRadialGradientColorStops();if(d&&s==="radial-gradient"){this._fillRadialGradient(e);return}n?this._fillColor(e):i?this._fillPattern(e):c?this._fillLinearGradient(e):d&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const n=e.getStrokeLinearGradientStartPoint(),s=e.getStrokeLinearGradientEndPoint(),i=e.getStrokeLinearGradientColorStops(),c=this.createLinearGradient(n.x,n.y,s.x,s.y);if(i){for(let d=0;d<i.length;d+=2)c.addColorStop(i[d],i[d+1]);this.setAttr("strokeStyle",c)}}_stroke(e){const n=e.dash(),s=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!s){this.save();const c=this.getCanvas().getPixelRatio();this.setTransform(c,0,0,c,0,0)}this._applyLineCap(e),n&&e.dashEnabled()&&(this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),s||this.restore()}}_applyShadow(e){var n,s,i;const c=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",d=(s=e.getShadowBlur())!==null&&s!==void 0?s:5,h=(i=e.getShadowOffset())!==null&&i!==void 0?i:{x:0,y:0},p=e.getAbsoluteScale(),u=this.canvas.getPixelRatio(),A=p.x*u,y=p.y*u;this.setAttr("shadowColor",c),this.setAttr("shadowBlur",d*Math.min(Math.abs(A),Math.abs(y))),this.setAttr("shadowOffsetX",h.x*A),this.setAttr("shadowOffsetY",h.y*y)}}class RC extends fA{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const n=e.getStrokeScaleEnabled();if(!n){this.save();const c=this.getCanvas().getPixelRatio();this.setTransform(c,0,0,c,0,0)}this._applyLineCap(e);const s=e.hitStrokeWidth(),i=s==="auto"?e.strokeWidth():s;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),n||this.restore()}}}let Fp;function DC(){if(Fp)return Fp;const t=he.createCanvasElement(),e=t.getContext("2d");return Fp=(function(){const n=Qe._global.devicePixelRatio||1,s=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return n/s})(),he.releaseCanvas(t),Fp}class Qg{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const s=(e||{}).pixelRatio||Qe.pixelRatio||DC();this.pixelRatio=s,this._canvas=he.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const n=this.pixelRatio;this.getContext()._context.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const n=this.pixelRatio;this.getContext()._context.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch{try{return this._canvas.toDataURL()}catch(i){return he.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Oo extends Qg{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new TC(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}class Yg extends Qg{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new RC(this),this.setSize(e.width,e.height)}}const on={get isDragging(){let t=!1;return on._dragElements.forEach(e=>{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){let t;return on._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];on._dragElements.forEach((n,s)=>{const{node:i}=n,c=i.getStage();c.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=he._getFirstPointerId(t));const d=c._changedPointerPositions.find(h=>h.id===n.pointerId);if(d){if(n.dragStatus!=="dragging"){const h=i.dragDistance();if(Math.max(Math.abs(d.x-n.startPointerPos.x),Math.abs(d.y-n.startPointerPos.y))<h||(i.startDrag({evt:t}),!i.isDragging()))return}i._setDragPosition(t,n),e.push(i)}}),e.forEach(n=>{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];on._dragElements.forEach(n=>{const{node:s}=n,i=s.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(h=>h.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(on.justDragged=!0,Qe._mouseListenClick=!1,Qe._touchListenClick=!1,Qe._pointerListenClick=!1,n.dragStatus="stopped");const d=n.node.getLayer()||n.node instanceof Qe.Stage&&n.node;d&&e.indexOf(d)===-1&&e.push(d)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){on._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&on._dragElements.delete(n)})}};Qe.isBrowser&&(window.addEventListener("mouseup",on._endDragBefore,!0),window.addEventListener("touchend",on._endDragBefore,!0),window.addEventListener("touchcancel",on._endDragBefore,!0),window.addEventListener("mousemove",on._drag),window.addEventListener("touchmove",on._drag),window.addEventListener("mouseup",on._endDragAfter,!1),window.addEventListener("touchend",on._endDragAfter,!1),window.addEventListener("touchcancel",on._endDragAfter,!1));function Go(t){return he._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||he._isBoolean(t)?t:Object.prototype.toString.call(t)}function Cx(t){return t>255?255:t<0?0:Math.round(t)}function Xe(){if(Qe.isUnminified)return function(t,e){return he._isNumber(t)||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function hA(t){if(Qe.isUnminified)return function(e,n){let s=he._isNumber(e),i=he._isArray(e)&&e.length==t;return!s&&!i&&he.warn(Go(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function Vg(){if(Qe.isUnminified)return function(t,e){return he._isNumber(t)||t==="auto"||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function zl(){if(Qe.isUnminified)return function(t,e){return he._isString(t)||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function wx(){if(Qe.isUnminified)return function(t,e){const n=he._isString(t),s=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||s||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function LC(){if(Qe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(he._isArray(t)?t.forEach(function(s){he._isNumber(s)||he.warn('"'+e+'" attribute has non numeric element '+s+". Make sure that all elements are numbers.")}):he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function zi(){if(Qe.isUnminified)return function(t,e){return t===!0||t===!1||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function kC(t){if(Qe.isUnminified)return function(e,n){return e==null||he.isObject(e)||he.warn(Go(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}const of="get",lf="set",te={addGetterSetter(t,e,n,s,i){te.addGetter(t,e,n),te.addSetter(t,e,s,i),te.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){const s=of+he._capitalize(e);t.prototype[s]=t.prototype[s]||function(){const i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,s){const i=lf+he._capitalize(e);t.prototype[i]||te.overWriteSetter(t,e,n,s)},overWriteSetter(t,e,n,s){const i=lf+he._capitalize(e);t.prototype[i]=function(c){return n&&c!==void 0&&c!==null&&(c=n.call(this,c,e)),this._setAttr(e,c),s&&s.call(this),this}},addComponentsGetterSetter(t,e,n,s,i){const c=n.length,d=he._capitalize,h=of+d(e),p=lf+d(e);t.prototype[h]=function(){const A={};for(let y=0;y<c;y++){const x=n[y];A[x]=this.getAttr(e+d(x))}return A};const u=kC(n);t.prototype[p]=function(A){const y=this.attrs[e];s&&(A=s.call(this,A,e)),u&&u.call(this,A,e);for(const x in A)A.hasOwnProperty(x)&&this._setAttr(e+d(x),A[x]);return A||n.forEach(x=>{this._setAttr(e+d(x),void 0)}),this._fireChangeEvent(e,y,A),i&&i.call(this),this},te.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){const n=he._capitalize(e),s=lf+n,i=of+n;t.prototype[e]=function(){return arguments.length?(this[s](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,s){he.error("Adding deprecated "+e);const i=of+he._capitalize(e),c=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){he.error(c);const d=this.attrs[e];return d===void 0?n:d},te.addSetter(t,e,s,function(){he.error(c)}),te.addOverloadedGetterSetter(t,e)},backCompat(t,e){he.each(e,function(n,s){const i=t.prototype[s],c=of+he._capitalize(n),d=lf+he._capitalize(n);function h(){i.apply(this,arguments),he.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}t.prototype[n]=h,t.prototype[c]=h,t.prototype[d]=h})},afterSetFilter(){this._filterUpToDate=!1}};function NC(t){const e=/(\w+)\(([^)]+)\)/g;let n;for(;(n=e.exec(t))!==null;){const[,s,i]=n;switch(s){case"blur":{const c=parseFloat(i.replace("px",""));return function(d){this.blurRadius(c*.5);const h=Qe.Filters;h&&h.Blur&&h.Blur.call(this,d)}}case"brightness":{const c=i.includes("%")?parseFloat(i)/100:parseFloat(i);return function(d){this.brightness(c);const h=Qe.Filters;h&&h.Brightness&&h.Brightness.call(this,d)}}case"contrast":{const c=parseFloat(i);return function(d){const h=100*(Math.sqrt(c)-1);this.contrast(h);const p=Qe.Filters;p&&p.Contrast&&p.Contrast.call(this,d)}}case"grayscale":return function(c){const d=Qe.Filters;d&&d.Grayscale&&d.Grayscale.call(this,c)};case"sepia":return function(c){const d=Qe.Filters;d&&d.Sepia&&d.Sepia.call(this,c)};case"invert":return function(c){const d=Qe.Filters;d&&d.Invert&&d.Invert.call(this,c)};default:he.warn(`CSS filter "${s}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}const eA="absoluteOpacity",u2="allEventListeners",Vs="absoluteTransform",d2="absoluteScale",kl="canvas",BC="Change",MC="children",PC="konva",Eg="listening",zC="mouseenter",FC="mouseleave",IC="pointerenter",OC="pointerleave",UC="touchenter",jC="touchleave",f2="set",h2="Shape",tA=" ",p2="stage",zo="transform",GC="Stage",Tg="visible",HC=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(tA);let XC=1;class Ge{constructor(e){this._id=XC++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===zo||e===Vs)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){let s=this._cache.get(e);return(s===void 0||(e===zo||e===Vs)&&s.dirty===!0)&&(s=n.call(this),this._cache.set(e,s)),s}_calculate(e,n,s){if(!this._attachedDepsListeners.get(e)){const i=n.map(c=>c+"Change.konva").join(tA);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,s)}_getCanvasCache(){return this._cache.get(kl)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Vs&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(kl)){const{scene:e,filter:n,hit:s}=this._cache.get(kl);he.releaseCanvas(e._canvas,n._canvas,s._canvas),this._cache.delete(kl)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const n=e||{};let s={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(s=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let i=Math.ceil(n.width||s.width),c=Math.ceil(n.height||s.height),d=n.pixelRatio,h=n.x===void 0?Math.floor(s.x):n.x,p=n.y===void 0?Math.floor(s.y):n.y,u=n.offset||0,A=n.drawBorder||!1,y=n.hitCanvasPixelRatio||1;if(!i||!c){he.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const x=Math.abs(Math.round(s.x)-h)>.5?1:0,S=Math.abs(Math.round(s.y)-p)>.5?1:0;i+=u*2+x,c+=u*2+S,h-=u,p-=u;const C=new Oo({pixelRatio:d,width:i,height:c}),T=new Oo({pixelRatio:d,width:0,height:0,willReadFrequently:!0}),R=new Yg({pixelRatio:y,width:i,height:c}),D=C.getContext(),M=R.getContext(),P=new Oo({width:C.width/C.pixelRatio+Math.abs(h),height:C.height/C.pixelRatio+Math.abs(p),pixelRatio:C.pixelRatio}),O=P.getContext();return R.isCache=!0,C.isCache=!0,this._cache.delete(kl),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(C.getContext()._context.imageSmoothingEnabled=!1,T.getContext()._context.imageSmoothingEnabled=!1),D.save(),M.save(),O.save(),D.translate(-h,-p),M.translate(-h,-p),O.translate(-h,-p),P.x=h,P.y=p,this._isUnderCache=!0,this._clearSelfAndDescendantCache(eA),this._clearSelfAndDescendantCache(d2),this.drawScene(C,this,P),this.drawHit(R,this),this._isUnderCache=!1,D.restore(),M.restore(),A&&(D.save(),D.beginPath(),D.rect(0,0,i,c),D.closePath(),D.setAttr("strokeStyle","red"),D.setAttr("lineWidth",5),D.stroke(),D.restore()),he.releaseCanvas(P._canvas),this._cache.set(kl,{scene:C,filter:T,hit:R,x:h,y:p}),this._requestDraw(),this}isCached(){return this._cache.has(kl)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){const s=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,c=1/0,d=-1/0,h=-1/0;const p=this.getAbsoluteTransform(n);return s.forEach(function(u){const A=p.point(u);i===void 0&&(i=d=A.x,c=h=A.y),i=Math.min(i,A.x),c=Math.min(c,A.y),d=Math.max(d,A.x),h=Math.max(h,A.y)}),{x:i,y:c,width:d-i,height:h-c}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const s=this._getCachedSceneCanvas(),i=s.pixelRatio;e.drawImage(s._canvas,0,0,s.width/i,s.height/i),e.restore()}_drawCachedHitCanvas(e){const n=this._getCanvasCache(),s=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(s._canvas,0,0,s.width/s.pixelRatio,s.height/s.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),s=n.scene,i=n.filter,c=i.getContext(),d,h,p,u;if(!e||e.length===0)return s;if(this._filterUpToDate)return i;let A=!0;for(let x=0;x<e.length;x++)if(typeof e[x]=="string"&&c2(),typeof e[x]!="string"||!c2()){A=!1;break}const y=s.pixelRatio;if(i.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio),A){const x=e.join(" ");return c.save(),c.setAttr("filter",x),c.drawImage(s._canvas,0,0,s.getWidth()/y,s.getHeight()/y),c.restore(),this._filterUpToDate=!0,i}try{for(d=e.length,c.clear(),c.drawImage(s._canvas,0,0,s.getWidth()/y,s.getHeight()/y),h=c.getImageData(0,0,i.getWidth(),i.getHeight()),p=0;p<d;p++)u=e[p],typeof u=="string"&&(u=NC(u)),u.call(this,h),c.putImageData(h,0,0)}catch(x){he.error("Unable to apply filter. "+x.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,i}on(e,n){if(this._cache&&this._cache.delete(u2),arguments.length===3)return this._delegate.apply(this,arguments);const s=e.split(tA);for(let i=0;i<s.length;i++){const d=s[i].split("."),h=d[0],p=d[1]||"";this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:p,handler:n})}return this}off(e,n){let s=(e||"").split(tA),i=s.length,c,d,h,p,u,A;if(this._cache&&this._cache.delete(u2),!e)for(d in this.eventListeners)this._off(d);for(c=0;c<i;c++)if(h=s[c],p=h.split("."),u=p[0],A=p[1],u)this.eventListeners[u]&&this._off(u,A,n);else for(d in this.eventListeners)this._off(d,A,n);return this}dispatchEvent(e){const n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(s){n.call(this,s.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,s){const i=this;this.on(e,function(c){const d=c.target.findAncestors(n,!0,i);for(let h=0;h<d.length;h++)c=he.cloneObject(c),c.currentTarget=d[h],s.call(d[h],c)})}remove(){return this.isDragging()&&this.stopDrag(),on._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Vs),this._clearSelfAndDescendantCache(eA),this._clearSelfAndDescendantCache(d2),this._clearSelfAndDescendantCache(p2),this._clearSelfAndDescendantCache(Tg),this._clearSelfAndDescendantCache(Eg)}_remove(){this._clearCaches();const e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){const n="get"+he._capitalize(e);return he._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){let e=this.getParent(),n=[];for(;e;)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let n,s;if(!e)return this;for(n in e)n!==MC&&(s=f2+he._capitalize(n),he._isFunction(this[s])?this[s](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(Eg,this._isListening)}_isListening(e){if(!this.listening())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isListening(e):!0}isVisible(){return this._getCache(Tg,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);const s=this.getLayer();let i=!1;on._dragElements.forEach(d=>{d.dragStatus==="dragging"&&(d.node.nodeType==="Stage"||d.node.getLayer()===s)&&(i=!0)});const c=!n&&!Qe.hitOnDragEnabled&&(i||Qe.isTransforming());return this.isListening()&&this.isVisible()&&!c}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,s=0,i,c,d,h;function p(A){for(i=[],c=A.length,d=0;d<c;d++)h=A[d],s++,h.nodeType!==h2&&(i=i.concat(h.getChildren().slice())),h._id===n._id&&(d=c);i.length>0&&i[0].getDepth()<=e&&p(i)}const u=this.getStage();return n.nodeType!==GC&&u&&p(u.getChildren()),s}getDepth(){let e=0,n=this.parent;for(;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(zo),this._clearSelfAndDescendantCache(Vs)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const n=e.getPointerPosition();if(!n)return null;const s=this.getAbsoluteTransform().copy();return s.invert(),s.point(n)}getAbsolutePosition(e){let n=!1,s=this.parent;for(;s;){if(s.isCached()){n=!0;break}s=s.parent}n&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),c=new Qa,d=this.offset();return c.m=i.slice(),c.translate(d.x,d.y),c.getTranslation()}setAbsolutePosition(e){const{x:n,y:s,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=s,this._clearCache(zo);const c=this._getAbsoluteTransform().copy();return c.invert(),c.translate(e.x,e.y),e={x:this.attrs.x+c.getTranslation().x,y:this.attrs.y+c.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(zo),this._clearSelfAndDescendantCache(Vs),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let n=e.x,s=e.y,i=this.x(),c=this.y();return n!==void 0&&(i+=n),s!==void 0&&(c+=s),this.setPosition({x:i,y:c}),this}_eachAncestorReverse(e,n){let s=[],i=this.getParent(),c,d;if(!(n&&n._id===this._id)){for(s.unshift(this);i&&(!n||i._id!==n._id);)s.unshift(i),i=i.parent;for(c=s.length,d=0;d<c;d++)e(s[d])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return he.warn("Node has no parent. moveToTop function is ignored."),!1;const e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return he.warn("Node has no parent. moveUp function is ignored."),!1;const e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return he.warn("Node has no parent. moveDown function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return he.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return he.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&he.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(eA,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),n,s,i,c,d;const h={attrs:{},className:this.getClassName()};for(n in e)s=e[n],d=he.isObject(s)&&!he._isPlainObject(s)&&!he._isArray(s),!d&&(i=typeof this[n]=="function"&&this[n],delete e[n],c=i?i.call(this):null,e[n]=s,c!==s&&(h.attrs[n]=s));return he._prepareToStringify(h)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,s){const i=[];n&&this._isMatch(e)&&i.push(this);let c=this.parent;for(;c;){if(c===s)return i;c._isMatch(e)&&i.push(c),c=c.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,s){return this.findAncestors(e,n,s)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let n=e.replace(/ /g,"").split(","),s=n.length,i,c;for(i=0;i<s;i++)if(c=n[i],he.isValidSelector(c)||(he.warn('Selector "'+c+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),he.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),he.warn("Konva is awesome, right?")),c.charAt(0)==="#"){if(this.id()===c.slice(1))return!0}else if(c.charAt(0)==="."){if(this.hasName(c.slice(1)))return!0}else if(this.className===c||this.nodeType===c)return!0;return!1}getLayer(){const e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(p2,this._getStage)}_getStage(){const e=this.getParent();return e?e.getStage():null}fire(e,n={},s){return n.target=n.target||this,s?this._fireAndBubble(e,n):this._fire(e,n),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Vs,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new Qa,this._eachAncestorReverse(function(s){const i=s.transformsEnabled();i==="all"?n.multiply(s.getTransform()):i==="position"&&n.translate(s.x()-s.offsetX(),s.y()-s.offsetY())},e),n;{n=this._cache.get(Vs)||new Qa,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const s=this.transformsEnabled();if(s==="all")n.multiply(this.getTransform());else if(s==="position"){const i=this.attrs.x||0,c=this.attrs.y||0,d=this.attrs.offsetX||0,h=this.attrs.offsetY||0;n.translate(i-d,c-h)}return n.dirty=!1,n}}getAbsoluteScale(e){let n=this;for(;n;)n._isUnderCache&&(e=n),n=n.getParent();const i=this.getAbsoluteTransform(e).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(zo,this._getTransform)}_getTransform(){var e,n;const s=this._cache.get(zo)||new Qa;s.reset();const i=this.x(),c=this.y(),d=Qe.getAngle(this.rotation()),h=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,p=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,A=this.attrs.skewY||0,y=this.attrs.offsetX||0,x=this.attrs.offsetY||0;return(i!==0||c!==0)&&s.translate(i,c),d!==0&&s.rotate(d),(u!==0||A!==0)&&s.skew(u,A),(h!==1||p!==1)&&s.scale(h,p),(y!==0||x!==0)&&s.translate(-1*y,-1*x),s.dirty=!1,s}clone(e){let n=he.cloneObject(this.attrs),s,i,c,d,h;for(s in e)n[s]=e[s];const p=new this.constructor(n);for(s in this.eventListeners)for(i=this.eventListeners[s],c=i.length,d=0;d<c;d++)h=i[d],h.name.indexOf(PC)<0&&(p.eventListeners[s]||(p.eventListeners[s]=[]),p.eventListeners[s].push(h));return p}_toKonvaCanvas(e){e=e||{};const n=this.getClientRect(),s=this.getStage(),i=e.x!==void 0?e.x:Math.floor(n.x),c=e.y!==void 0?e.y:Math.floor(n.y),d=e.pixelRatio||1,h=new Oo({width:e.width||Math.ceil(n.width)||(s?s.width():0),height:e.height||Math.ceil(n.height)||(s?s.height():0),pixelRatio:d}),p=h.getContext(),u=new Oo({width:h.width/h.pixelRatio+Math.abs(i),height:h.height/h.pixelRatio+Math.abs(c),pixelRatio:h.pixelRatio});return e.imageSmoothingEnabled===!1&&(p._context.imageSmoothingEnabled=!1),p.save(),(i||c)&&p.translate(-1*i,-1*c),this.drawScene(h,void 0,u),p.restore(),h}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};const n=e.mimeType||null,s=e.quality||null,i=this._toKonvaCanvas(e).toDataURL(n,s);return e.callback&&e.callback(i),i}toImage(e){return new Promise((n,s)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,he._urlToImage(this.toDataURL(e),function(c){n(c),i==null||i(c)})}catch(i){s(i)}})}toBlob(e){return new Promise((n,s)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(c=>{n(c),i==null||i(c)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(i){s(i)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Qe.dragDistance}_off(e,n,s){let i=this.eventListeners[e],c,d,h;for(c=0;c<i.length;c++)if(d=i[c].name,h=i[c].handler,(d!=="konva"||n==="konva")&&(!n||d===n)&&(!s||s===h)){if(i.splice(c,1),i.length===0){delete this.eventListeners[e];break}c--}}_fireChangeEvent(e,n,s){this._fire(e+BC,{oldVal:n,newVal:s})}addName(e){if(!this.hasName(e)){const n=this.name(),s=n?n+" "+e:e;this.name(s)}return this}hasName(e){if(!e)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(e)!==-1:!1}removeName(e){const n=(this.name()||"").split(/\s/g),s=n.indexOf(e);return s!==-1&&(n.splice(s,1),this.name(n.join(" "))),this}setAttr(e,n){const s=this[f2+he._capitalize(e)];return he._isFunction(s)?s.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(Qe.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,n){const s=this.attrs[e];s===n&&!he.isObject(n)||(n==null?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,s,n),this._requestDraw())}_setComponentAttr(e,n,s){let i;s!==void 0&&(i=this.attrs[e],i||(this.attrs[e]=this.getAttr(e)),this.attrs[e][n]=s,this._fireChangeEvent(e,i,s))}_fireAndBubble(e,n,s){n&&this.nodeType===h2&&(n.target=this);const i=[zC,FC,IC,OC,UC,jC];if(!(i.indexOf(e)!==-1&&(s&&(this===s||this.isAncestorOf&&this.isAncestorOf(s))||this.nodeType==="Stage"&&!s))){this._fire(e,n);const d=i.indexOf(e)!==-1&&s&&s.isAncestorOf&&s.isAncestorOf(this)&&!s.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!d&&(s&&s.parent?this._fireAndBubble.call(this.parent,e,n,s):this._fireAndBubble.call(this.parent,e,n))}}_getProtoListeners(e){var n,s;const{nodeType:i}=this,c=Ge.protoListenerMap.get(i)||{};let d=c==null?void 0:c[e];if(d===void 0){d=[];let h=Object.getPrototypeOf(this);for(;h;){const p=(s=(n=h.eventListeners)===null||n===void 0?void 0:n[e])!==null&&s!==void 0?s:[];d.push(...p),h=Object.getPrototypeOf(h)}c[e]=d,Ge.protoListenerMap.set(i,c)}return d}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;const s=this._getProtoListeners(e);if(s)for(let c=0;c<s.length;c++)s[c].handler.call(this,n);const i=this.eventListeners[e];if(i)for(let c=0;c<i.length;c++)i[c].handler.call(this,n)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){const n=e?e.pointerId:void 0,s=this.getStage(),i=this.getAbsolutePosition();if(!s)return;const c=s._getPointerById(n)||s._changedPointerPositions[0]||i;on._dragElements.set(this._id,{node:this,startPointerPos:c,offset:{x:c.x-i.x,y:c.y-i.y},dragStatus:"ready",pointerId:n})}startDrag(e,n=!0){on._dragElements.has(this._id)||this._createDragElement(e);const s=on._dragElements.get(this._id);s.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},n)}_setDragPosition(e,n){const s=this.getStage()._getPointerById(n.pointerId);if(!s)return;let i={x:s.x-n.offset.x,y:s.y-n.offset.y};const c=this.dragBoundFunc();if(c!==void 0){const d=c.call(this,i,e);d?i=d:he.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==i.x||this._lastPos.y!==i.y)&&(this.setAbsolutePosition(i),this._requestDraw()),this._lastPos=i}stopDrag(e){const n=on._dragElements.get(this._id);n&&(n.dragStatus="stopped"),on._endDragBefore(e),on._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=on._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if(!(!(e.evt.button!==void 0)||Qe.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let i=!1;on._dragElements.forEach(c=>{this.isAncestorOf(c.node)&&(i=!0)}),i||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=on._dragElements.get(this._id),s=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";s?this.stopDrag():i&&on._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const s={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return he.haveIntersection(s,this.getClientRect())}static create(e,n){return he._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let s=Ge.prototype.getClassName.call(e),i=e.children,c,d,h;n&&(e.attrs.container=n),Qe[s]||(he.warn('Can not find a node with class name "'+s+'". Fallback to "Shape".'),s="Shape");const p=Qe[s];if(c=new p(e.attrs),i)for(d=i.length,h=0;h<d;h++)c.add(Ge._createNode(i[h]));return c}}Ge.protoListenerMap=new Map;Ge.prototype.nodeType="Node";Ge.prototype._attrsAffectingSize=[];Ge.prototype.eventListeners={};Ge.prototype.on.call(Ge.prototype,HC,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(zo),this._clearSelfAndDescendantCache(Vs)});Ge.prototype.on.call(Ge.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Tg)});Ge.prototype.on.call(Ge.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Eg)});Ge.prototype.on.call(Ge.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(eA)});const xn=te.addGetterSetter;xn(Ge,"zIndex");xn(Ge,"absolutePosition");xn(Ge,"position");xn(Ge,"x",0,Xe());xn(Ge,"y",0,Xe());xn(Ge,"globalCompositeOperation","source-over",zl());xn(Ge,"opacity",1,Xe());xn(Ge,"name","",zl());xn(Ge,"id","",zl());xn(Ge,"rotation",0,Xe());te.addComponentsGetterSetter(Ge,"scale",["x","y"]);xn(Ge,"scaleX",1,Xe());xn(Ge,"scaleY",1,Xe());te.addComponentsGetterSetter(Ge,"skew",["x","y"]);xn(Ge,"skewX",0,Xe());xn(Ge,"skewY",0,Xe());te.addComponentsGetterSetter(Ge,"offset",["x","y"]);xn(Ge,"offsetX",0,Xe());xn(Ge,"offsetY",0,Xe());xn(Ge,"dragDistance",void 0,Xe());xn(Ge,"width",0,Xe());xn(Ge,"height",0,Xe());xn(Ge,"listening",!0,zi());xn(Ge,"preventDefault",!0,zi());xn(Ge,"filters",void 0,function(t){return this._filterUpToDate=!1,t});xn(Ge,"visible",!0,zi());xn(Ge,"transformsEnabled","all",zl());xn(Ge,"size");xn(Ge,"dragBoundFunc");xn(Ge,"draggable",!1,zi());te.backCompat(Ge,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Ya extends Ge{constructor(){super(...arguments),this.children=[]}getChildren(e){const n=this.children||[];return e?n.filter(e):n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let s=0;s<e.length;s++)this.add(e[s]);return this}const n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){const s=[];return this._descendants(i=>{const c=i._isMatch(e);return c&&s.push(i),!!(c&&n)}),s}_descendants(e){let n=!1;const s=this.getChildren();for(const i of s){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){const e=Ge.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();for(;n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){const n=Ge.prototype.clone.call(this,e);return this.getChildren().forEach(function(s){n.add(s.clone())}),n}getAllIntersections(e){const n=[];return this.find("Shape").forEach(s=>{s.isVisible()&&s.intersects(e)&&n.push(s)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(s){s._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,s){n.index=s}),this._requestDraw()}drawScene(e,n,s){const i=this.getLayer(),c=e||i&&i.getCanvas(),d=c&&c.getContext(),h=this._getCanvasCache(),p=h&&h.scene,u=c&&c.isCache;if(!this.isVisible()&&!u)return this;if(p){d.save();const A=this.getAbsoluteTransform(n).getMatrix();d.transform(A[0],A[1],A[2],A[3],A[4],A[5]),this._drawCachedSceneCanvas(d),d.restore()}else this._drawChildren("drawScene",c,n,s);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const s=this.getLayer(),i=e||s&&s.hitCanvas,c=i&&i.getContext(),d=this._getCanvasCache();if(d&&d.hit){c.save();const p=this.getAbsoluteTransform(n).getMatrix();c.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedHitCanvas(c),c.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,s,i){var c;const d=n&&n.getContext(),h=this.clipWidth(),p=this.clipHeight(),u=this.clipFunc(),A=typeof h=="number"&&typeof p=="number"||u,y=s===this;if(A){d.save();const S=this.getAbsoluteTransform(s);let C=S.getMatrix();d.transform(C[0],C[1],C[2],C[3],C[4],C[5]),d.beginPath();let T;if(u)T=u.call(this,d,this);else{const R=this.clipX(),D=this.clipY();d.rect(R||0,D||0,h,p)}d.clip.apply(d,T),C=S.copy().invert().getMatrix(),d.transform(C[0],C[1],C[2],C[3],C[4],C[5])}const x=!y&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";x&&(d.save(),d._applyGlobalCompositeOperation(this)),(c=this.children)===null||c===void 0||c.forEach(function(S){S[e](n,s,i)}),x&&d.restore(),A&&d.restore()}getClientRect(e={}){var n;const s=e.skipTransform,i=e.relativeTo;let c,d,h,p,u={x:1/0,y:1/0,width:0,height:0};const A=this;(n=this.children)===null||n===void 0||n.forEach(function(S){if(!S.visible())return;const C=S.getClientRect({relativeTo:A,skipShadow:e.skipShadow,skipStroke:e.skipStroke});C.width===0&&C.height===0||(c===void 0?(c=C.x,d=C.y,h=C.x+C.width,p=C.y+C.height):(c=Math.min(c,C.x),d=Math.min(d,C.y),h=Math.max(h,C.x+C.width),p=Math.max(p,C.y+C.height)))});const y=this.find("Shape");let x=!1;for(let S=0;S<y.length;S++)if(y[S]._isVisible(this)){x=!0;break}return x&&c!==void 0?u={x:c,y:d,width:h-c,height:p-d}:u={x:0,y:0,width:0,height:0},s?u:this._transformedRect(u,i)}}te.addComponentsGetterSetter(Ya,"clip",["x","y","width","height"]);te.addGetterSetter(Ya,"clipX",void 0,Xe());te.addGetterSetter(Ya,"clipY",void 0,Xe());te.addGetterSetter(Ya,"clipWidth",void 0,Xe());te.addGetterSetter(Ya,"clipHeight",void 0,Xe());te.addGetterSetter(Ya,"clipFunc");const Df=new Map,_x=Qe._global.PointerEvent!==void 0;function $m(t){return Df.get(t)}function qg(t){return{evt:t,pointerId:t.pointerId}}function Ex(t,e){return Df.get(t)===e}function Tx(t,e){bf(t),e.getStage()&&(Df.set(t,e),_x&&e._fire("gotpointercapture",qg(new PointerEvent("gotpointercapture"))))}function bf(t,e){const n=Df.get(t);if(!n)return;const s=n.getStage();s&&s.content,Df.delete(t),_x&&n._fire("lostpointercapture",qg(new PointerEvent("lostpointercapture")))}const WC="Stage",QC="string",A2="px",YC="mouseout",Rx="mouseleave",Dx="mouseover",Lx="mouseenter",kx="mousemove",Nx="mousedown",Bx="mouseup",hf="pointermove",pf="pointerdown",_u="pointerup",Af="pointercancel",VC="lostpointercapture",Ip="pointerout",mf="pointerleave",Op="pointerover",Up="pointerenter",Rg="contextmenu",Mx="touchstart",Px="touchend",zx="touchmove",Fx="touchcancel",Dg="wheel",qC=5,KC=[[Lx,"_pointerenter"],[Nx,"_pointerdown"],[kx,"_pointermove"],[Bx,"_pointerup"],[Rx,"_pointerleave"],[Mx,"_pointerdown"],[zx,"_pointermove"],[Px,"_pointerup"],[Fx,"_pointercancel"],[Dx,"_pointerover"],[Dg,"_wheel"],[Rg,"_contextmenu"],[pf,"_pointerdown"],[hf,"_pointermove"],[_u,"_pointerup"],[Af,"_pointercancel"],[mf,"_pointerleave"],[VC,"_lostpointercapture"]],eg={mouse:{[Ip]:YC,[mf]:Rx,[Op]:Dx,[Up]:Lx,[hf]:kx,[pf]:Nx,[_u]:Bx,[Af]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Ip]:"touchout",[mf]:"touchleave",[Op]:"touchover",[Up]:"touchenter",[hf]:zx,[pf]:Mx,[_u]:Px,[Af]:Fx,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Ip]:Ip,[mf]:mf,[Op]:Op,[Up]:Up,[hf]:hf,[pf]:pf,[_u]:_u,[Af]:Af,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},gf=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",mu=t=>{const e=gf(t);if(e==="pointer")return Qe.pointerEventsEnabled&&eg.pointer;if(e==="touch")return eg.touch;if(e==="mouse")return eg.mouse};function m2(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&he.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const JC="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",Sf=[];let pA=class extends Ya{constructor(e){super(m2(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Sf.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{m2(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",s=e.getType()==="FastLayer";n||s||he.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===QC){let n;if(e.charAt(0)==="."){const s=e.slice(1);e=document.getElementsByClassName(s)[0]}else e.charAt(0)!=="#"?n=e:n=e.slice(1),e=document.getElementById(n);if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,n=e.length;for(let s=0;s<n;s++)e[s].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),Ya.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&he._isInDocument(e)&&this.container().removeChild(e);const n=Sf.indexOf(this);return n>-1&&Sf.splice(n,1),he.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(he.warn(JC),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const n=new Oo({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),s=n.getContext()._context,i=this.children;return(e.x||e.y)&&s.translate(-1*e.x,-1*e.y),i.forEach(function(c){if(!c.isVisible())return;const d=c._toKonvaCanvas(e);s.drawImage(d._canvas,e.x,e.y,d.getWidth()/d.getPixelRatio(),d.getHeight()/d.getPixelRatio())}),n}getIntersection(e){if(!e)return null;const n=this.children,s=n.length,i=s-1;for(let c=i;c>=0;c--){const d=n[c].getIntersection(e);if(d)return d}return null}_resizeDOM(){const e=this.width(),n=this.height();this.content&&(this.content.style.width=e+A2,this.content.style.height=n+A2),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(s=>{s.setSize({width:e,height:n}),s.draw()})}add(e,...n){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}super.add(e);const s=this.children.length;return s>qC&&he.warn("The stage has "+s+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),Qe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Ex(e,this)}setPointerCapture(e){Tx(e,this)}releaseCapture(e){bf(e)}getLayers(){return this.children}_bindContentEvents(){Qe.isBrowser&&KC.forEach(([e,n])=>{this.content.addEventListener(e,s=>{this[n](s)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=mu(e.type);n&&this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=mu(e.type);n&&this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=mu(e.type),s=gf(e.type);if(!n)return;this.setPointersPositions(e);const i=this._getTargetShape(s),c=!(Qe.isDragging()||Qe.isTransforming())||Qe.hitOnDragEnabled;i&&c?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[s+"targetShape"]=null):c&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const n=mu(e.type),s=gf(e.type);if(!n)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(c=>{const d=this.getIntersection(c);if(on.justDragged=!1,Qe["_"+s+"ListenClick"]=!0,!d||!d.isListening()){this[s+"ClickStartShape"]=void 0;return}Qe.capturePointerEventsEnabled&&d.setPointerCapture(c.id),this[s+"ClickStartShape"]=d,d._fireAndBubble(n.pointerdown,{evt:e,pointerId:c.id}),i=!0;const h=e.type.indexOf("touch")>=0;d.preventDefault()&&e.cancelable&&h&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const n=mu(e.type),s=gf(e.type);if(!n)return;const i=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Qe.isDragging()&&on.node.preventDefault()&&e.cancelable&&i&&e.preventDefault(),this.setPointersPositions(e),!(!(Qe.isDragging()||Qe.isTransforming())||Qe.hitOnDragEnabled))return;const d={};let h=!1;const p=this._getTargetShape(s);this._changedPointerPositions.forEach(u=>{const A=$m(u.id)||this.getIntersection(u),y=u.id,x={evt:e,pointerId:y},S=p!==A;if(S&&p&&(p._fireAndBubble(n.pointerout,{...x},A),p._fireAndBubble(n.pointerleave,{...x},A)),A){if(d[A._id])return;d[A._id]=!0}A&&A.isListening()?(h=!0,S&&(A._fireAndBubble(n.pointerover,{...x},p),A._fireAndBubble(n.pointerenter,{...x},p),this[s+"targetShape"]=A),A._fireAndBubble(n.pointermove,{...x})):p&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:y}),this[s+"targetShape"]=null)}),h||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=mu(e.type),s=gf(e.type);if(!n)return;this.setPointersPositions(e);const i=this[s+"ClickStartShape"],c=this[s+"ClickEndShape"],d={};let h=!1;this._changedPointerPositions.forEach(p=>{const u=$m(p.id)||this.getIntersection(p);if(u){if(u.releaseCapture(p.id),d[u._id])return;d[u._id]=!0}const A=p.id,y={evt:e,pointerId:A};let x=!1;Qe["_"+s+"InDblClickWindow"]?(x=!0,clearTimeout(this[s+"DblTimeout"])):on.justDragged||(Qe["_"+s+"InDblClickWindow"]=!0,clearTimeout(this[s+"DblTimeout"])),this[s+"DblTimeout"]=setTimeout(function(){Qe["_"+s+"InDblClickWindow"]=!1},Qe.dblClickWindow),u&&u.isListening()?(h=!0,this[s+"ClickEndShape"]=u,u._fireAndBubble(n.pointerup,{...y}),Qe["_"+s+"ListenClick"]&&i&&i===u&&(u._fireAndBubble(n.pointerclick,{...y}),x&&c&&c===u&&u._fireAndBubble(n.pointerdblclick,{...y}))):(this[s+"ClickEndShape"]=null,h||(this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),h=!0),Qe["_"+s+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:A}),x&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:A}))}),h||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Qe["_"+s+"ListenClick"]=!1,e.cancelable&&s!=="touch"&&s!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(Rg,{evt:e}):this._fire(Rg,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(Dg,{evt:e}):this._fire(Dg,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=$m(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(_u,qg(e)),bf(e.pointerId)}_lostpointercapture(e){bf(e.pointerId)}setPointersPositions(e){const n=this._getContentPosition();let s=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,c=>{this._pointerPositions.push({id:c.identifier,x:(c.clientX-n.left)/n.scaleX,y:(c.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,c=>{this._changedPointerPositions.push({id:c.identifier,x:(c.clientX-n.left)/n.scaleX,y:(c.clientY-n.top)/n.scaleY})})):(s=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:s,y:i},this._pointerPositions=[{x:s,y:i,id:he._getFirstPointerId(e)}],this._changedPointerPositions=[{x:s,y:i,id:he._getFirstPointerId(e)}])}_setPointerPosition(e){he.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Oo({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Yg({pixelRatio:1,width:this.width(),height:this.height()}),!Qe.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return he.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};pA.prototype.nodeType=WC;Pn(pA);te.addGetterSetter(pA,"container");Qe.isBrowser&&document.addEventListener("visibilitychange",()=>{Sf.forEach(t=>{t.batchDraw()})});const Ix="hasShadow",Ox="shadowRGBA",Ux="patternImage",jx="linearGradient",Gx="radialGradient";let jp;function tg(){return jp||(jp=he.createCanvasElement().getContext("2d"),jp)}const Cf={};function ZC(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function $C(t){t.stroke()}function ew(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function tw(t){t.stroke()}function nw(){this._clearCache(Ix)}function rw(){this._clearCache(Ox)}function aw(){this._clearCache(Ux)}function iw(){this._clearCache(jx)}function sw(){this._clearCache(Gx)}class Fe extends Ge{constructor(e){super(e);let n,s=0;for(;n=he.getHitColor(),!(n&&!(n in Cf));)if(s++,s>=1e4){he.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),n=he.getRandomColor();break}this.colorKey=n,Cf[n]=this}getContext(){return he.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return he.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Ix,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Ux,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const n=tg().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const s=new Qa;s.translate(this.fillPatternX(),this.fillPatternY()),s.rotate(Qe.getAngle(this.fillPatternRotation())),s.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),s.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=s.getMatrix(),c=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(c)}return n}}_getLinearGradient(){return this._getCache(jx,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const n=tg(),s=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),c=n.createLinearGradient(s.x,s.y,i.x,i.y);for(let d=0;d<e.length;d+=2)c.addColorStop(e[d],e[d+1]);return c}}_getRadialGradient(){return this._getCache(Gx,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const n=tg(),s=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),c=n.createRadialGradient(s.x,s.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let d=0;d<e.length;d+=2)c.addColorStop(e[d],e[d+1]);return c}}getShadowRGBA(){return this._getCache(Ox,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=he.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const n=this.getStage();if(!n)return!1;const s=n.bufferHitCanvas;return s.getContext().clear(),this.drawHit(s,void 0,!0),s.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return Ge.prototype.destroy.call(this),delete Cf[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),c=this.hasStroke(),d=this.getAbsoluteOpacity()!==1;if(i&&c&&d)return!0;const h=this.hasShadow(),p=this.shadowForStrokeEnabled();return!!(i&&c&&h&&p)}setStrokeHitEnabled(e){he.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let n=!1,s=this.getParent();for(;s;){if(s.isCached()){n=!0;break}s=s.getParent()}const i=e.skipTransform,c=e.relativeTo||n&&this.getStage()||void 0,d=this.getSelfRect(),p=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=d.width+p,A=d.height+p,y=!e.skipShadow&&this.hasShadow(),x=y?this.shadowOffsetX():0,S=y?this.shadowOffsetY():0,C=u+Math.abs(x),T=A+Math.abs(S),R=y&&this.shadowBlur()||0,D=C+R*2,M=T+R*2,P={width:D,height:M,x:-(p/2+R)+Math.min(x,0)+d.x,y:-(p/2+R)+Math.min(S,0)+d.y};return i?P:this._transformedRect(P,c)}drawScene(e,n,s){const i=this.getLayer(),c=e||i.getCanvas(),d=c.getContext(),h=this._getCanvasCache(),p=this.getSceneFunc(),u=this.hasShadow();let A;const y=n===this;if(!this.isVisible()&&!y)return this;if(h){d.save();const x=this.getAbsoluteTransform(n).getMatrix();return d.transform(x[0],x[1],x[2],x[3],x[4],x[5]),this._drawCachedSceneCanvas(d),d.restore(),this}if(!p)return this;if(d.save(),this._useBufferCanvas()){A=this.getStage();const x=s||A.bufferCanvas,S=x.getContext();s?(S.save(),S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,x.width,x.height),S.restore()):S.clear(),S.save(),S._applyLineJoin(this),S._applyMiterLimit(this);const C=this.getAbsoluteTransform(n).getMatrix();S.transform(C[0],C[1],C[2],C[3],C[4],C[5]),p.call(this,S,this),S.restore();const T=x.pixelRatio;u&&d._applyShadow(this),y||(d._applyOpacity(this),d._applyGlobalCompositeOperation(this)),d.drawImage(x._canvas,x.x||0,x.y||0,x.width/T,x.height/T)}else{if(d._applyLineJoin(this),d._applyMiterLimit(this),!y){const x=this.getAbsoluteTransform(n).getMatrix();d.transform(x[0],x[1],x[2],x[3],x[4],x[5]),d._applyOpacity(this),d._applyGlobalCompositeOperation(this)}u&&d._applyShadow(this),p.call(this,d,this)}return d.restore(),this}drawHit(e,n,s=!1){if(!this.shouldDrawHit(n,s))return this;const i=this.getLayer(),c=e||i.hitCanvas,d=c&&c.getContext(),h=this.hitFunc()||this.sceneFunc(),p=this._getCanvasCache(),u=p&&p.hit;if(this.colorKey||he.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),u){d.save();const y=this.getAbsoluteTransform(n).getMatrix();return d.transform(y[0],y[1],y[2],y[3],y[4],y[5]),this._drawCachedHitCanvas(d),d.restore(),this}if(!h)return this;if(d.save(),d._applyLineJoin(this),d._applyMiterLimit(this),!(this===n)){const y=this.getAbsoluteTransform(n).getMatrix();d.transform(y[0],y[1],y[2],y[3],y[4],y[5])}return h.call(this,d,this),d.restore(),this}drawHitFromCache(e=0){const n=this._getCanvasCache(),s=this._getCachedSceneCanvas(),i=n.hit,c=i.getContext(),d=i.getWidth(),h=i.getHeight();c.clear(),c.drawImage(s._canvas,0,0,d,h);try{const p=c.getImageData(0,0,d,h),u=p.data,A=u.length,y=he._hexToRgb(this.colorKey);for(let x=0;x<A;x+=4)u[x+3]>e?(u[x]=y.r,u[x+1]=y.g,u[x+2]=y.b,u[x+3]=255):u[x+3]=0;c.putImageData(p,0,0)}catch(p){he.error("Unable to draw hit graph from cached scene canvas. "+p.message)}return this}hasPointerCapture(e){return Ex(e,this)}setPointerCapture(e){Tx(e,this)}releaseCapture(e){bf(e)}}Fe.prototype._fillFunc=ZC;Fe.prototype._strokeFunc=$C;Fe.prototype._fillFuncHit=ew;Fe.prototype._strokeFuncHit=tw;Fe.prototype._centroid=!1;Fe.prototype.nodeType="Shape";Pn(Fe);Fe.prototype.eventListeners={};Fe.prototype.on.call(Fe.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",nw);Fe.prototype.on.call(Fe.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",rw);Fe.prototype.on.call(Fe.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",aw);Fe.prototype.on.call(Fe.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",iw);Fe.prototype.on.call(Fe.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",sw);te.addGetterSetter(Fe,"stroke",void 0,wx());te.addGetterSetter(Fe,"strokeWidth",2,Xe());te.addGetterSetter(Fe,"fillAfterStrokeEnabled",!1);te.addGetterSetter(Fe,"hitStrokeWidth","auto",Vg());te.addGetterSetter(Fe,"strokeHitEnabled",!0,zi());te.addGetterSetter(Fe,"perfectDrawEnabled",!0,zi());te.addGetterSetter(Fe,"shadowForStrokeEnabled",!0,zi());te.addGetterSetter(Fe,"lineJoin");te.addGetterSetter(Fe,"lineCap");te.addGetterSetter(Fe,"miterLimit");te.addGetterSetter(Fe,"sceneFunc");te.addGetterSetter(Fe,"hitFunc");te.addGetterSetter(Fe,"dash");te.addGetterSetter(Fe,"dashOffset",0,Xe());te.addGetterSetter(Fe,"shadowColor",void 0,zl());te.addGetterSetter(Fe,"shadowBlur",0,Xe());te.addGetterSetter(Fe,"shadowOpacity",1,Xe());te.addComponentsGetterSetter(Fe,"shadowOffset",["x","y"]);te.addGetterSetter(Fe,"shadowOffsetX",0,Xe());te.addGetterSetter(Fe,"shadowOffsetY",0,Xe());te.addGetterSetter(Fe,"fillPatternImage");te.addGetterSetter(Fe,"fill",void 0,wx());te.addGetterSetter(Fe,"fillPatternX",0,Xe());te.addGetterSetter(Fe,"fillPatternY",0,Xe());te.addGetterSetter(Fe,"fillLinearGradientColorStops");te.addGetterSetter(Fe,"strokeLinearGradientColorStops");te.addGetterSetter(Fe,"fillRadialGradientStartRadius",0);te.addGetterSetter(Fe,"fillRadialGradientEndRadius",0);te.addGetterSetter(Fe,"fillRadialGradientColorStops");te.addGetterSetter(Fe,"fillPatternRepeat","repeat");te.addGetterSetter(Fe,"fillEnabled",!0);te.addGetterSetter(Fe,"strokeEnabled",!0);te.addGetterSetter(Fe,"shadowEnabled",!0);te.addGetterSetter(Fe,"dashEnabled",!0);te.addGetterSetter(Fe,"strokeScaleEnabled",!0);te.addGetterSetter(Fe,"fillPriority","color");te.addComponentsGetterSetter(Fe,"fillPatternOffset",["x","y"]);te.addGetterSetter(Fe,"fillPatternOffsetX",0,Xe());te.addGetterSetter(Fe,"fillPatternOffsetY",0,Xe());te.addComponentsGetterSetter(Fe,"fillPatternScale",["x","y"]);te.addGetterSetter(Fe,"fillPatternScaleX",1,Xe());te.addGetterSetter(Fe,"fillPatternScaleY",1,Xe());te.addComponentsGetterSetter(Fe,"fillLinearGradientStartPoint",["x","y"]);te.addComponentsGetterSetter(Fe,"strokeLinearGradientStartPoint",["x","y"]);te.addGetterSetter(Fe,"fillLinearGradientStartPointX",0);te.addGetterSetter(Fe,"strokeLinearGradientStartPointX",0);te.addGetterSetter(Fe,"fillLinearGradientStartPointY",0);te.addGetterSetter(Fe,"strokeLinearGradientStartPointY",0);te.addComponentsGetterSetter(Fe,"fillLinearGradientEndPoint",["x","y"]);te.addComponentsGetterSetter(Fe,"strokeLinearGradientEndPoint",["x","y"]);te.addGetterSetter(Fe,"fillLinearGradientEndPointX",0);te.addGetterSetter(Fe,"strokeLinearGradientEndPointX",0);te.addGetterSetter(Fe,"fillLinearGradientEndPointY",0);te.addGetterSetter(Fe,"strokeLinearGradientEndPointY",0);te.addComponentsGetterSetter(Fe,"fillRadialGradientStartPoint",["x","y"]);te.addGetterSetter(Fe,"fillRadialGradientStartPointX",0);te.addGetterSetter(Fe,"fillRadialGradientStartPointY",0);te.addComponentsGetterSetter(Fe,"fillRadialGradientEndPoint",["x","y"]);te.addGetterSetter(Fe,"fillRadialGradientEndPointX",0);te.addGetterSetter(Fe,"fillRadialGradientEndPointY",0);te.addGetterSetter(Fe,"fillPatternRotation",0);te.addGetterSetter(Fe,"fillRule",void 0,zl());te.backCompat(Fe,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});const ow="beforeDraw",lw="draw",Hx=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],cw=Hx.length;let Fl=class extends Ya{constructor(e){super(e),this.canvas=new Oo,this.hitCanvas=new Yg({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Ge.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!Ge.prototype.moveUp.call(this))return!1;const n=this.getStage();return!n||!n.content?!1:(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Ge.prototype.moveDown.call(this)){const e=this.getStage();if(e){const n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Ge.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return Ge.prototype.remove.call(this),e&&e.parentNode&&he._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this.hitCanvas.setSize(e,n),this._setSmoothEnabled(),this}_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&he.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Ge.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){he.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){he.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,he.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,s=!1;for(;;){for(let i=0;i<cw;i++){const c=Hx[i],d=this._getIntersection({x:e.x+c.x*n,y:e.y+c.y*n}),h=d.shape;if(h)return h;if(s=!!d.antialiased,!d.antialiased)break}if(s)n+=1;else return null}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,s=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,i=s[3];if(i===255){const c=he.getHitColorKey(s[0],s[1],s[2]),d=Cf[c];return d?{shape:d}:{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(e,n,s){const i=this.getLayer(),c=e||i&&i.getCanvas();return this._fire(ow,{node:this}),this.clearBeforeDraw()&&c.getContext().clear(),Ya.prototype.drawScene.call(this,c,n,s),this._fire(lw,{node:this}),this}drawHit(e,n){const s=this.getLayer(),i=e||s&&s.hitCanvas;return s&&s.clearBeforeDraw()&&s.getHitCanvas().getContext().clear(),Ya.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){he.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return he.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return he.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Fl.prototype.nodeType="Layer";Pn(Fl);te.addGetterSetter(Fl,"imageSmoothingEnabled",!0);te.addGetterSetter(Fl,"clearBeforeDraw",!0);te.addGetterSetter(Fl,"hitGraphEnabled",!0,zi());class Kg extends Fl{constructor(e){super(e),this.listening(!1),he.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Kg.prototype.nodeType="FastLayer";Pn(Kg);let Ru=class extends Ya{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&he.throw("You may only add groups and shapes to groups.")}};Ru.prototype.nodeType="Group";Pn(Ru);const ng=(function(){return Ml.performance&&Ml.performance.now?function(){return Ml.performance.now()}:function(){return new Date().getTime()}})();class pi{constructor(e,n){this.id=pi.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:ng(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,s=n.length;for(let i=0;i<s;i++)if(n[i]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const n=pi.animations,s=n.length;for(let i=0;i<s;i++)if(n[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=ng(),pi._addAnimation(this),this}stop(){return pi._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const n=e.id,s=this.animations,i=s.length;for(let c=0;c<i;c++)if(s[c].id===n){this.animations.splice(c,1);break}}static _runFrames(){const e={},n=this.animations;for(let s=0;s<n.length;s++){const i=n[s],c=i.layers,d=i.func;i._updateFrameObject(ng());const h=c.length;let p;if(d?p=d.call(i,i.frame)!==!1:p=!0,!!p)for(let u=0;u<h;u++){const A=c[u];A._id!==void 0&&(e[A._id]=A)}}for(const s in e)e.hasOwnProperty(s)&&e[s].batchDraw()}static _animationLoop(){const e=pi;e.animations.length?(e._runFrames(),he.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,he.requestAnimFrame(this._animationLoop))}}pi.animations=[];pi.animIdCounter=0;pi.animRunning=!1;const uw={node:1,duration:1,easing:1,onFinish:1,yoyo:1},dw=1,g2=2,v2=3,y2=["fill","stroke","shadowColor"];let fw=0;class hw{constructor(e,n,s,i,c,d,h){this.prop=e,this.propFunc=n,this.begin=i,this._pos=i,this.duration=d,this._change=0,this.prevPos=0,this.yoyo=h,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=s,this._change=c-this.begin,this.pause()}fire(e){const n=this[e];n&&n()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=g2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=v2,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===g2?this.setTime(e):this.state===v2&&this.setTime(this.duration-e)}pause(){this.state=dw,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Cn{constructor(e){const n=this,s=e.node,i=s._id,c=e.easing||wf.Linear,d=!!e.yoyo;let h,p;typeof e.duration>"u"?h=.3:e.duration===0?h=.001:h=e.duration,this.node=s,this._id=fw++;const u=s.getLayer()||(s instanceof Qe.Stage?s.getLayers():null);u||he.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new pi(function(){n.tween.onEnterFrame()},u),this.tween=new hw(p,function(A){n._tweenFunc(A)},c,0,1,h*1e3,d),this._addListeners(),Cn.attrs[i]||(Cn.attrs[i]={}),Cn.attrs[i][this._id]||(Cn.attrs[i][this._id]={}),Cn.tweens[i]||(Cn.tweens[i]={});for(p in e)uw[p]===void 0&&this._addAttr(p,e[p]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){const s=this.node,i=s._id;let c,d,h,p,u;const A=Cn.tweens[i][e];A&&delete Cn.attrs[i][A][e];let y=s.getAttr(e);if(he._isArray(n))if(c=[],d=Math.max(n.length,y.length),e==="points"&&n.length!==y.length&&(n.length>y.length?(p=y,y=he._prepareArrayForTween(y,n,s.closed())):(h=n,n=he._prepareArrayForTween(n,y,s.closed()))),e.indexOf("fill")===0)for(let x=0;x<d;x++)if(x%2===0)c.push(n[x]-y[x]);else{const S=he.colorToRGBA(y[x]);u=he.colorToRGBA(n[x]),y[x]=S,c.push({r:u.r-S.r,g:u.g-S.g,b:u.b-S.b,a:u.a-S.a})}else for(let x=0;x<d;x++)c.push(n[x]-y[x]);else y2.indexOf(e)!==-1?(y=he.colorToRGBA(y),u=he.colorToRGBA(n),c={r:u.r-y.r,g:u.g-y.g,b:u.b-y.b,a:u.a-y.a}):c=n-y;Cn.attrs[i][this._id][e]={start:y,diff:c,end:n,trueEnd:h,trueStart:p},Cn.tweens[i][e]=this._id}_tweenFunc(e){const n=this.node,s=Cn.attrs[n._id][this._id];let i,c,d,h,p,u,A,y;for(i in s){if(c=s[i],d=c.start,h=c.diff,y=c.end,he._isArray(d))if(p=[],A=Math.max(d.length,y.length),i.indexOf("fill")===0)for(u=0;u<A;u++)u%2===0?p.push((d[u]||0)+h[u]*e):p.push("rgba("+Math.round(d[u].r+h[u].r*e)+","+Math.round(d[u].g+h[u].g*e)+","+Math.round(d[u].b+h[u].b*e)+","+(d[u].a+h[u].a*e)+")");else for(u=0;u<A;u++)p.push((d[u]||0)+h[u]*e);else y2.indexOf(i)!==-1?p="rgba("+Math.round(d.r+h.r*e)+","+Math.round(d.g+h.g*e)+","+Math.round(d.b+h.b*e)+","+(d.a+h.a*e)+")":p=d+h*e;n.setAttr(i,p)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const e=this.node,n=Cn.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const e=this.node,n=Cn.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const e=this.node._id,n=this._id,s=Cn.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const i in s)delete Cn.tweens[e][i];delete Cn.attrs[e][n],Cn.tweens[e]&&(Object.keys(Cn.tweens[e]).length===0&&delete Cn.tweens[e],Object.keys(Cn.attrs[e]).length===0&&delete Cn.attrs[e])}}Cn.attrs={};Cn.tweens={};Ge.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Cn(t).play()};const wf={BackEaseIn(t,e,n,s){return n*(t/=s)*t*((1.70158+1)*t-1.70158)+e},BackEaseOut(t,e,n,s){return n*((t=t/s-1)*t*((1.70158+1)*t+1.70158)+1)+e},BackEaseInOut(t,e,n,s){let i=1.70158;return(t/=s/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,s,i,c){let d=0;return t===0?e:(t/=s)===1?e+n:(c||(c=s*.3),!i||i<Math.abs(n)?(i=n,d=c/4):d=c/(2*Math.PI)*Math.asin(n/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((t*s-d)*(2*Math.PI)/c))+e)},ElasticEaseOut(t,e,n,s,i,c){let d=0;return t===0?e:(t/=s)===1?e+n:(c||(c=s*.3),!i||i<Math.abs(n)?(i=n,d=c/4):d=c/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*t)*Math.sin((t*s-d)*(2*Math.PI)/c)+n+e)},ElasticEaseInOut(t,e,n,s,i,c){let d=0;return t===0?e:(t/=s/2)===2?e+n:(c||(c=s*(.3*1.5)),!i||i<Math.abs(n)?(i=n,d=c/4):d=c/(2*Math.PI)*Math.asin(n/i),t<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((t*s-d)*(2*Math.PI)/c))+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*s-d)*(2*Math.PI)/c)*.5+n+e)},BounceEaseOut(t,e,n,s){return(t/=s)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn(t,e,n,s){return n-wf.BounceEaseOut(s-t,0,n,s)+e},BounceEaseInOut(t,e,n,s){return t<s/2?wf.BounceEaseIn(t*2,0,n,s)*.5+e:wf.BounceEaseOut(t*2-s,0,n,s)*.5+n*.5+e},EaseIn(t,e,n,s){return n*(t/=s)*t+e},EaseOut(t,e,n,s){return-n*(t/=s)*(t-2)+e},EaseInOut(t,e,n,s){return(t/=s/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},StrongEaseIn(t,e,n,s){return n*(t/=s)*t*t*t*t+e},StrongEaseOut(t,e,n,s){return n*((t=t/s-1)*t*t*t*t+1)+e},StrongEaseInOut(t,e,n,s){return(t/=s/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},Linear(t,e,n,s){return n*t/s+e}},Pl=he._assign(Qe,{Util:he,Transform:Qa,Node:Ge,Container:Ya,Stage:pA,stages:Sf,Layer:Fl,FastLayer:Kg,Group:Ru,DD:on,Shape:Fe,shapes:Cf,Animation:pi,Tween:Cn,Easings:wf,Context:fA,Canvas:Qg});class Zs extends Fe{_sceneFunc(e){const n=Qe.getAngle(this.angle()),s=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,s),e.arc(0,0,this.innerRadius(),n,0,!s),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),n=this.outerRadius(),s=this.clockwise(),i=Qe.getAngle(s?360-this.angle():this.angle()),c=Math.cos(Math.min(i,Math.PI)),d=1,h=Math.sin(Math.min(Math.max(Math.PI,i),3*Math.PI/2)),p=Math.sin(Math.min(i,Math.PI/2)),u=c*(c>0?e:n),A=d*n,y=h*(h>0?e:n),x=p*(p>0?n:e);return{x:u,y:s?-1*x:y,width:A-u,height:x-y}}}Zs.prototype._centroid=!0;Zs.prototype.className="Arc";Zs.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];Pn(Zs);te.addGetterSetter(Zs,"innerRadius",0,Xe());te.addGetterSetter(Zs,"outerRadius",0,Xe());te.addGetterSetter(Zs,"angle",0,Xe());te.addGetterSetter(Zs,"clockwise",!1,zi());function Lg(t,e,n,s,i,c,d){const h=Math.sqrt(Math.pow(n-t,2)+Math.pow(s-e,2)),p=Math.sqrt(Math.pow(i-n,2)+Math.pow(c-s,2)),u=d*h/(h+p),A=d*p/(h+p),y=n-u*(i-t),x=s-u*(c-e),S=n+A*(i-t),C=s+A*(c-e);return[y,x,S,C]}function x2(t,e){const n=t.length,s=[];for(let i=2;i<n-2;i+=2){const c=Lg(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e);isNaN(c[0])||(s.push(c[0]),s.push(c[1]),s.push(t[i]),s.push(t[i+1]),s.push(c[2]),s.push(c[3]))}return s}function pw(t){const e=[[t[0],t[2],t[4],t[6]],[t[1],t[3],t[5],t[7]]],n=[];for(const s of e){const i=-3*s[0]+9*s[1]-9*s[2]+3*s[3];if(i!==0){const c=6*s[0]-12*s[1]+6*s[2],d=-3*s[0]+3*s[1],h=c*c-4*i*d;if(h>=0){const p=Math.sqrt(h);n.push((-c+p)/(2*i)),n.push((-c-p)/(2*i))}}}return n.filter(s=>s>0&&s<1).flatMap(s=>e.map(i=>{const c=1-s;return c*c*c*i[0]+3*c*c*s*i[1]+3*c*s*s*i[2]+s*s*s*i[3]}))}let $s=class extends Fe{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const n=this.points(),s=n.length,i=this.tension(),c=this.closed(),d=this.bezier();if(!s)return;let h=0;if(e.beginPath(),e.moveTo(n[0],n[1]),i!==0&&s>4){const p=this.getTensionPoints(),u=p.length;for(h=c?0:4,c||e.quadraticCurveTo(p[0],p[1],p[2],p[3]);h<u-2;)e.bezierCurveTo(p[h++],p[h++],p[h++],p[h++],p[h++],p[h++]);c||e.quadraticCurveTo(p[u-2],p[u-1],n[s-2],n[s-1])}else if(d)for(h=2;h<s;)e.bezierCurveTo(n[h++],n[h++],n[h++],n[h++],n[h++],n[h++]);else for(h=2;h<s;h+=2)e.lineTo(n[h],n[h+1]);c?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():x2(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),n=e.length,s=this.tension(),i=Lg(e[n-2],e[n-1],e[0],e[1],e[2],e[3],s),c=Lg(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],s),d=x2(e,s);return[i[2],i[3]].concat(d).concat([c[0],c[1],e[n-2],e[n-1],c[2],c[3],i[0],i[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...pw(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let n=e[0],s=e[0],i=e[1],c=e[1],d,h;for(let p=0;p<e.length/2;p++)d=e[p*2],h=e[p*2+1],n=Math.min(n,d),s=Math.max(s,d),i=Math.min(i,h),c=Math.max(c,h);return{x:n,y:i,width:s-n,height:c-i}}};$s.prototype.className="Line";$s.prototype._attrsAffectingSize=["points","bezier","tension"];Pn($s);te.addGetterSetter($s,"closed",!1);te.addGetterSetter($s,"bezier",!1);te.addGetterSetter($s,"tension",0,Xe());te.addGetterSetter($s,"points",[],LC());const Aw=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],mw=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],gw=[[1],[1,1],[1,2,1],[1,3,3,1]],b2=(t,e,n)=>{let s,i;const d=n/2;s=0;for(let h=0;h<20;h++)i=d*Aw[20][h]+d,s+=mw[20][h]*vw(t,e,i);return d*s},S2=(t,e,n)=>{n===void 0&&(n=1);const s=t[0]-2*t[1]+t[2],i=e[0]-2*e[1]+e[2],c=2*t[1]-2*t[0],d=2*e[1]-2*e[0],h=4*(s*s+i*i),p=4*(s*c+i*d),u=c*c+d*d;if(h===0)return n*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const A=p/(2*h),y=u/h,x=n+A,S=y-A*A,C=x*x+S>0?Math.sqrt(x*x+S):0,T=A*A+S>0?Math.sqrt(A*A+S):0,R=A+Math.sqrt(A*A+S)!==0?S*Math.log(Math.abs((x+C)/(A+T))):0;return Math.sqrt(h)/2*(x*C-A*T+R)};function vw(t,e,n){const s=kg(1,n,t),i=kg(1,n,e),c=s*s+i*i;return Math.sqrt(c)}const kg=(t,e,n)=>{const s=n.length-1;let i,c;if(s===0)return 0;if(t===0){c=0;for(let d=0;d<=s;d++)c+=gw[s][d]*Math.pow(1-e,s-d)*Math.pow(e,d)*n[d];return c}else{i=new Array(s);for(let d=0;d<s;d++)i[d]=s*(n[d+1]-n[d]);return kg(t-1,e,i)}},C2=(t,e,n)=>{let s=1,i=t/e,c=(t-n(i))/e,d=0;for(;s>.001;){const h=n(i+c),p=Math.abs(t-h)/e;if(p<s)s=p,i+=c;else{const u=n(i-c),A=Math.abs(t-u)/e;A<s?(s=A,i-=c):c/=2}if(d++,d>500)break}return i};class wn extends Fe{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=wn.parsePathData(this.data()),this.pathLength=wn.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let s=!1;for(let i=0;i<n.length;i++){const c=n[i].command,d=n[i].points;switch(c){case"L":e.lineTo(d[0],d[1]);break;case"M":e.moveTo(d[0],d[1]);break;case"C":e.bezierCurveTo(d[0],d[1],d[2],d[3],d[4],d[5]);break;case"Q":e.quadraticCurveTo(d[0],d[1],d[2],d[3]);break;case"A":const h=d[0],p=d[1],u=d[2],A=d[3],y=d[4],x=d[5],S=d[6],C=d[7],T=u>A?u:A,R=u>A?1:u/A,D=u>A?A/u:1;e.translate(h,p),e.rotate(S),e.scale(R,D),e.arc(0,0,T,y,y+x,1-C),e.scale(1/R,1/D),e.rotate(-S),e.translate(-h,-p);break;case"z":s=!0,e.closePath();break}}!s&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(p){if(p.command==="A"){const u=p.points[4],A=p.points[5],y=p.points[4]+A;let x=Math.PI/180;if(Math.abs(u-y)<x&&(x=Math.abs(u-y)),A<0)for(let S=u-x;S>y;S-=x){const C=wn.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],S,0);e.push(C.x,C.y)}else for(let S=u+x;S<y;S+=x){const C=wn.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],S,0);e.push(C.x,C.y)}}else if(p.command==="C")for(let u=0;u<=1;u+=.01){const A=wn.getPointOnCubicBezier(u,p.start.x,p.start.y,p.points[0],p.points[1],p.points[2],p.points[3],p.points[4],p.points[5]);e.push(A.x,A.y)}else e=e.concat(p.points)});let n=e[0],s=e[0],i=e[1],c=e[1],d,h;for(let p=0;p<e.length/2;p++)d=e[p*2],h=e[p*2+1],isNaN(d)||(n=Math.min(n,d),s=Math.max(s,d)),isNaN(h)||(i=Math.min(i,h),c=Math.max(c,h));return{x:n,y:i,width:s-n,height:c-i}}getLength(){return this.pathLength}getPointAtLength(e){return wn.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,s,i){return Math.sqrt((s-e)*(s-e)+(i-n)*(i-n))}static getPathLength(e){let n=0;for(let s=0;s<e.length;++s)n+=e[s].pathLength;return n}static getPointAtLengthOfDataArray(e,n){let s,i=0,c=n.length;if(!c)return null;for(;i<c&&e>n[i].pathLength;)e-=n[i].pathLength,++i;if(i===c)return s=n[i-1].points.slice(-2),{x:s[0],y:s[1]};if(e<.01)return n[i].command==="M"?(s=n[i].points.slice(0,2),{x:s[0],y:s[1]}):{x:n[i].start.x,y:n[i].start.y};const d=n[i],h=d.points;switch(d.command){case"L":return wn.getPointOnLine(e,d.start.x,d.start.y,h[0],h[1]);case"C":return wn.getPointOnCubicBezier(C2(e,wn.getPathLength(n),T=>b2([d.start.x,h[0],h[2],h[4]],[d.start.y,h[1],h[3],h[5]],T)),d.start.x,d.start.y,h[0],h[1],h[2],h[3],h[4],h[5]);case"Q":return wn.getPointOnQuadraticBezier(C2(e,wn.getPathLength(n),T=>S2([d.start.x,h[0],h[2]],[d.start.y,h[1],h[3]],T)),d.start.x,d.start.y,h[0],h[1],h[2],h[3]);case"A":const p=h[0],u=h[1],A=h[2],y=h[3],x=h[5],S=h[6];let C=h[4];return C+=x*e/d.pathLength,wn.getPointOnEllipticalArc(p,u,A,y,C,S)}return null}static getPointOnLine(e,n,s,i,c,d,h){d=d??n,h=h??s;const p=this.getLineLength(n,s,i,c);if(p<1e-10)return{x:n,y:s};if(i===n)return{x:d,y:h+(c>s?e:-e)};const u=(c-s)/(i-n),A=Math.sqrt(e*e/(1+u*u))*(i<n?-1:1),y=u*A;if(Math.abs(h-s-u*(d-n))<1e-10)return{x:d+A,y:h+y};const x=((d-n)*(i-n)+(h-s)*(c-s))/(p*p),S=n+x*(i-n),C=s+x*(c-s),T=this.getLineLength(d,h,S,C),R=Math.sqrt(e*e-T*T),D=Math.sqrt(R*R/(1+u*u))*(i<n?-1:1),M=u*D;return{x:S+D,y:C+M}}static getPointOnCubicBezier(e,n,s,i,c,d,h,p,u){function A(R){return R*R*R}function y(R){return 3*R*R*(1-R)}function x(R){return 3*R*(1-R)*(1-R)}function S(R){return(1-R)*(1-R)*(1-R)}const C=p*A(e)+d*y(e)+i*x(e)+n*S(e),T=u*A(e)+h*y(e)+c*x(e)+s*S(e);return{x:C,y:T}}static getPointOnQuadraticBezier(e,n,s,i,c,d,h){function p(S){return S*S}function u(S){return 2*S*(1-S)}function A(S){return(1-S)*(1-S)}const y=d*p(e)+i*u(e)+n*A(e),x=h*p(e)+c*u(e)+s*A(e);return{x:y,y:x}}static getPointOnEllipticalArc(e,n,s,i,c,d){const h=Math.cos(d),p=Math.sin(d),u={x:s*Math.cos(c),y:i*Math.sin(c)};return{x:e+(u.x*h-u.y*p),y:n+(u.x*p+u.y*h)}}static parsePathData(e){if(!e)return[];let n=e;const s=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let y=0;y<s.length;y++)n=n.replace(new RegExp(s[y],"g"),"|"+s[y]);const i=n.split("|"),c=[],d=[];let h=0,p=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let A;for(let y=1;y<i.length;y++){let x=i[y],S=x.charAt(0);for(x=x.slice(1),d.length=0;A=u.exec(x);)d.push(A[0]);let C=[],T=S==="A"||S==="a"?0:-1;for(let R=0,D=d.length;R<D;R++){const M=d[R];if(M==="00"){C.push(0,0),T>=0&&(T+=2,T>=7&&(T-=7));continue}if(T>=0){if(T===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(M)){C.push(parseInt(M[0],10)),C.push(parseInt(M[1],10)),C.push(parseFloat(M.slice(2))),T+=3,T>=7&&(T-=7);continue}if(M==="11"||M==="10"||M==="01"){C.push(parseInt(M[0],10)),C.push(parseInt(M[1],10)),T+=2,T>=7&&(T-=7);continue}if(M==="0"||M==="1"){C.push(parseInt(M,10)),T+=1,T>=7&&(T-=7);continue}}else if(T===4){if(/^[01]\d+(?:\.\d+)?$/.test(M)){C.push(parseInt(M[0],10)),C.push(parseFloat(M.slice(1))),T+=2,T>=7&&(T-=7);continue}if(M==="0"||M==="1"){C.push(parseInt(M,10)),T+=1,T>=7&&(T-=7);continue}}const P=parseFloat(M);isNaN(P)?C.push(0):C.push(P),T+=1,T>=7&&(T-=7)}else{const P=parseFloat(M);isNaN(P)?C.push(0):C.push(P)}}for(;C.length>0&&!isNaN(C[0]);){let R="",D=[];const M=h,P=p;let O,I,Y,K,q,Q,V,ge,X,se;switch(S){case"l":h+=C.shift(),p+=C.shift(),R="L",D.push(h,p);break;case"L":h=C.shift(),p=C.shift(),D.push(h,p);break;case"m":const L=C.shift(),ne=C.shift();if(h+=L,p+=ne,R="M",c.length>2&&c[c.length-1].command==="z"){for(let le=c.length-2;le>=0;le--)if(c[le].command==="M"){h=c[le].points[0]+L,p=c[le].points[1]+ne;break}}D.push(h,p),S="l";break;case"M":h=C.shift(),p=C.shift(),R="M",D.push(h,p),S="L";break;case"h":h+=C.shift(),R="L",D.push(h,p);break;case"H":h=C.shift(),R="L",D.push(h,p);break;case"v":p+=C.shift(),R="L",D.push(h,p);break;case"V":p=C.shift(),R="L",D.push(h,p);break;case"C":D.push(C.shift(),C.shift(),C.shift(),C.shift()),h=C.shift(),p=C.shift(),D.push(h,p);break;case"c":D.push(h+C.shift(),p+C.shift(),h+C.shift(),p+C.shift()),h+=C.shift(),p+=C.shift(),R="C",D.push(h,p);break;case"S":I=h,Y=p,O=c[c.length-1],O.command==="C"&&(I=h+(h-O.points[2]),Y=p+(p-O.points[3])),D.push(I,Y,C.shift(),C.shift()),h=C.shift(),p=C.shift(),R="C",D.push(h,p);break;case"s":I=h,Y=p,O=c[c.length-1],O.command==="C"&&(I=h+(h-O.points[2]),Y=p+(p-O.points[3])),D.push(I,Y,h+C.shift(),p+C.shift()),h+=C.shift(),p+=C.shift(),R="C",D.push(h,p);break;case"Q":D.push(C.shift(),C.shift()),h=C.shift(),p=C.shift(),D.push(h,p);break;case"q":D.push(h+C.shift(),p+C.shift()),h+=C.shift(),p+=C.shift(),R="Q",D.push(h,p);break;case"T":I=h,Y=p,O=c[c.length-1],O.command==="Q"&&(I=h+(h-O.points[0]),Y=p+(p-O.points[1])),h=C.shift(),p=C.shift(),R="Q",D.push(I,Y,h,p);break;case"t":I=h,Y=p,O=c[c.length-1],O.command==="Q"&&(I=h+(h-O.points[0]),Y=p+(p-O.points[1])),h+=C.shift(),p+=C.shift(),R="Q",D.push(I,Y,h,p);break;case"A":K=C.shift(),q=C.shift(),Q=C.shift(),V=C.shift(),ge=C.shift(),X=h,se=p,h=C.shift(),p=C.shift(),R="A",D=this.convertEndpointToCenterParameterization(X,se,h,p,V,ge,K,q,Q);break;case"a":K=C.shift(),q=C.shift(),Q=C.shift(),V=C.shift(),ge=C.shift(),X=h,se=p,h+=C.shift(),p+=C.shift(),R="A",D=this.convertEndpointToCenterParameterization(X,se,h,p,V,ge,K,q,Q);break}c.push({command:R||S,points:D,start:{x:M,y:P},pathLength:this.calcLength(M,P,R||S,D)})}(S==="z"||S==="Z")&&c.push({command:"z",points:[],start:void 0,pathLength:0})}return c}static calcLength(e,n,s,i){let c,d,h,p;const u=wn;switch(s){case"L":return u.getLineLength(e,n,i[0],i[1]);case"C":return b2([e,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return S2([e,i[0],i[2]],[n,i[1],i[3]],1);case"A":c=0;const A=i[4],y=i[5],x=i[4]+y;let S=Math.PI/180;if(Math.abs(A-x)<S&&(S=Math.abs(A-x)),d=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],A,0),y<0)for(p=A-S;p>x;p-=S)h=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],p,0),c+=u.getLineLength(d.x,d.y,h.x,h.y),d=h;else for(p=A+S;p<x;p+=S)h=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],p,0),c+=u.getLineLength(d.x,d.y,h.x,h.y),d=h;return h=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],x,0),c+=u.getLineLength(d.x,d.y,h.x,h.y),c}return 0}static convertEndpointToCenterParameterization(e,n,s,i,c,d,h,p,u){const A=u*(Math.PI/180),y=Math.cos(A)*(e-s)/2+Math.sin(A)*(n-i)/2,x=-1*Math.sin(A)*(e-s)/2+Math.cos(A)*(n-i)/2,S=y*y/(h*h)+x*x/(p*p);S>1&&(h*=Math.sqrt(S),p*=Math.sqrt(S));let C=Math.sqrt((h*h*(p*p)-h*h*(x*x)-p*p*(y*y))/(h*h*(x*x)+p*p*(y*y)));c===d&&(C*=-1),isNaN(C)&&(C=0);const T=C*h*x/p,R=C*-p*y/h,D=(e+s)/2+Math.cos(A)*T-Math.sin(A)*R,M=(n+i)/2+Math.sin(A)*T+Math.cos(A)*R,P=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},O=function(V,ge){return(V[0]*ge[0]+V[1]*ge[1])/(P(V)*P(ge))},I=function(V,ge){return(V[0]*ge[1]<V[1]*ge[0]?-1:1)*Math.acos(O(V,ge))},Y=I([1,0],[(y-T)/h,(x-R)/p]),K=[(y-T)/h,(x-R)/p],q=[(-1*y-T)/h,(-1*x-R)/p];let Q=I(K,q);return O(K,q)<=-1&&(Q=Math.PI),O(K,q)>=1&&(Q=0),d===0&&Q>0&&(Q=Q-2*Math.PI),d===1&&Q<0&&(Q=Q+2*Math.PI),[D,M,h,p,Y,Q,A,d]}}wn.prototype.className="Path";wn.prototype._attrsAffectingSize=["data"];Pn(wn);te.addGetterSetter(wn,"data");let Il=class extends $s{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,s=this.points();let i=s;const c=this.tension()!==0&&s.length>4;c&&(i=this.getTensionPoints());const d=this.pointerLength(),h=s.length;let p,u;if(c){const x=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],s[h-2],s[h-1]],S=wn.calcLength(i[i.length-4],i[i.length-3],"C",x),C=wn.getPointOnQuadraticBezier(Math.min(1,1-d/S),x[0],x[1],x[2],x[3],x[4],x[5]);p=s[h-2]-C.x,u=s[h-1]-C.y}else p=s[h-2]-s[h-4],u=s[h-1]-s[h-3];const A=(Math.atan2(u,p)+n)%n,y=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(s[h-2],s[h-1]),e.rotate(A),e.moveTo(0,0),e.lineTo(-d,y/2),e.lineTo(-d,-y/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(s[0],s[1]),c?(p=(i[0]+i[2])/2-s[0],u=(i[1]+i[3])/2-s[1]):(p=s[2]-s[0],u=s[3]-s[1]),e.rotate((Math.atan2(-u,-p)+n)%n),e.moveTo(0,0),e.lineTo(-d,y/2),e.lineTo(-d,-y/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}};Il.prototype.className="Arrow";Pn(Il);te.addGetterSetter(Il,"pointerLength",10,Xe());te.addGetterSetter(Il,"pointerWidth",10,Xe());te.addGetterSetter(Il,"pointerAtBeginning",!1);te.addGetterSetter(Il,"pointerAtEnding",!0);class Du extends Fe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Du.prototype._centroid=!0;Du.prototype.className="Circle";Du.prototype._attrsAffectingSize=["radius"];Pn(Du);te.addGetterSetter(Du,"radius",0,Xe());let Ho=class extends Fe{_sceneFunc(e){const n=this.radiusX(),s=this.radiusY();e.beginPath(),e.save(),n!==s&&e.scale(1,s/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};Ho.prototype.className="Ellipse";Ho.prototype._centroid=!0;Ho.prototype._attrsAffectingSize=["radiusX","radiusY"];Pn(Ho);te.addComponentsGetterSetter(Ho,"radius",["x","y"]);te.addGetterSetter(Ho,"radiusX",0,Xe());te.addGetterSetter(Ho,"radiusY",0,Xe());let Fi=class Xx extends Fe{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const e=!!this.cornerRadius(),n=this.hasShadow();return e&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),s=this.getHeight(),i=this.cornerRadius(),c=this.attrs.image;let d;if(c){const h=this.attrs.cropWidth,p=this.attrs.cropHeight;h&&p?d=[c,this.cropX(),this.cropY(),h,p,0,0,n,s]:d=[c,0,0,n,s]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?he.drawRoundedRectPath(e,n,s,i):e.rect(0,0,n,s),e.closePath(),e.fillStrokeShape(this)),c&&(i&&e.clip(),e.drawImage.apply(e,d))}_hitFunc(e){const n=this.width(),s=this.height(),i=this.cornerRadius();e.beginPath(),i?he.drawRoundedRectPath(e,n,s,i):e.rect(0,0,n,s),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n,s;return(s=(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&s!==void 0?s:0}getHeight(){var e,n,s;return(s=(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&s!==void 0?s:0}static fromURL(e,n,s=null){const i=he.createImageElement();i.onload=function(){const c=new Xx({image:i});n(c)},i.onerror=s,i.crossOrigin="Anonymous",i.src=e}};Fi.prototype.className="Image";Fi.prototype._attrsAffectingSize=["image"];Pn(Fi);te.addGetterSetter(Fi,"cornerRadius",0,hA(4));te.addGetterSetter(Fi,"image");te.addComponentsGetterSetter(Fi,"crop",["x","y","width","height"]);te.addGetterSetter(Fi,"cropX",0,Xe());te.addGetterSetter(Fi,"cropY",0,Xe());te.addGetterSetter(Fi,"cropWidth",0,Xe());te.addGetterSetter(Fi,"cropHeight",0,Xe());const Wx=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],yw="Change.konva",xw="none",Ng="up",Bg="right",Mg="down",Pg="left",bw=Wx.length;class Jg extends Ru{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,s;const i=function(){n._sync()};for(s=0;s<bw;s++)e.on(Wx[s]+yw,i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),n=this.getTag(),s,i,c,d,h,p,u;if(e&&n){switch(s=e.width(),i=e.height(),c=n.pointerDirection(),d=n.pointerWidth(),u=n.pointerHeight(),h=0,p=0,c){case Ng:h=s/2,p=-1*u;break;case Bg:h=s+d,p=i/2;break;case Mg:h=s/2,p=i+u;break;case Pg:h=-1*d,p=i/2;break}n.setAttrs({x:-1*h,y:-1*p,width:s,height:i}),e.setAttrs({x:-1*h,y:-1*p})}}}Jg.prototype.className="Label";Pn(Jg);class Ol extends Fe{_sceneFunc(e){const n=this.width(),s=this.height(),i=this.pointerDirection(),c=this.pointerWidth(),d=this.pointerHeight(),h=this.cornerRadius();let p=0,u=0,A=0,y=0;typeof h=="number"?p=u=A=y=Math.min(h,n/2,s/2):(p=Math.min(h[0]||0,n/2,s/2),u=Math.min(h[1]||0,n/2,s/2),y=Math.min(h[2]||0,n/2,s/2),A=Math.min(h[3]||0,n/2,s/2)),e.beginPath(),e.moveTo(p,0),i===Ng&&(e.lineTo((n-c)/2,0),e.lineTo(n/2,-1*d),e.lineTo((n+c)/2,0)),e.lineTo(n-u,0),e.arc(n-u,u,u,Math.PI*3/2,0,!1),i===Bg&&(e.lineTo(n,(s-d)/2),e.lineTo(n+c,s/2),e.lineTo(n,(s+d)/2)),e.lineTo(n,s-y),e.arc(n-y,s-y,y,0,Math.PI/2,!1),i===Mg&&(e.lineTo((n+c)/2,s),e.lineTo(n/2,s+d),e.lineTo((n-c)/2,s)),e.lineTo(A,s),e.arc(A,s-A,A,Math.PI/2,Math.PI,!1),i===Pg&&(e.lineTo(0,(s+d)/2),e.lineTo(-1*c,s/2),e.lineTo(0,(s-d)/2)),e.lineTo(0,p),e.arc(p,p,p,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,n=0,s=this.pointerWidth(),i=this.pointerHeight(),c=this.pointerDirection(),d=this.width(),h=this.height();return c===Ng?(n-=i,h+=i):c===Mg?h+=i:c===Pg?(e-=s*1.5,d+=s):c===Bg&&(d+=s*1.5),{x:e,y:n,width:d,height:h}}}Ol.prototype.className="Tag";Pn(Ol);te.addGetterSetter(Ol,"pointerDirection",xw);te.addGetterSetter(Ol,"pointerWidth",0,Xe());te.addGetterSetter(Ol,"pointerHeight",0,Xe());te.addGetterSetter(Ol,"cornerRadius",0,hA(4));let kf=class extends Fe{_sceneFunc(e){const n=this.cornerRadius(),s=this.width(),i=this.height();e.beginPath(),n?he.drawRoundedRectPath(e,s,i,n):e.rect(0,0,s,i),e.closePath(),e.fillStrokeShape(this)}};kf.prototype.className="Rect";Pn(kf);te.addGetterSetter(kf,"cornerRadius",0,hA(4));class Xo extends Fe{_sceneFunc(e){const n=this._getPoints(),s=this.radius(),i=this.sides(),c=this.cornerRadius();if(e.beginPath(),c)he.drawRoundedPolygonPath(e,n,i,s,c);else{e.moveTo(n[0].x,n[0].y);for(let d=1;d<n.length;d++)e.lineTo(n[d].x,n[d].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,n=this.attrs.radius||0,s=[];for(let i=0;i<e;i++)s.push({x:n*Math.sin(i*2*Math.PI/e),y:-1*n*Math.cos(i*2*Math.PI/e)});return s}getSelfRect(){const e=this._getPoints();let n=e[0].x,s=e[0].x,i=e[0].y,c=e[0].y;return e.forEach(d=>{n=Math.min(n,d.x),s=Math.max(s,d.x),i=Math.min(i,d.y),c=Math.max(c,d.y)}),{x:n,y:i,width:s-n,height:c-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Xo.prototype.className="RegularPolygon";Xo.prototype._centroid=!0;Xo.prototype._attrsAffectingSize=["radius"];Pn(Xo);te.addGetterSetter(Xo,"radius",0,Xe());te.addGetterSetter(Xo,"sides",0,Xe());te.addGetterSetter(Xo,"cornerRadius",0,hA(4));const w2=Math.PI*2;class Ul extends Fe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,w2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),w2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ul.prototype.className="Ring";Ul.prototype._centroid=!0;Ul.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Pn(Ul);te.addGetterSetter(Ul,"innerRadius",0,Xe());te.addGetterSetter(Ul,"outerRadius",0,Xe());class hs extends Fe{constructor(e){super(e),this._updated=!0,this.anim=new pi(()=>{const n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const n=this.animation(),s=this.frameIndex(),i=s*4,c=this.animations()[n],d=this.frameOffsets(),h=c[i+0],p=c[i+1],u=c[i+2],A=c[i+3],y=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,u,A),e.closePath(),e.fillStrokeShape(this)),y)if(d){const x=d[n],S=s*2;e.drawImage(y,h,p,u,A,x[S+0],x[S+1],u,A)}else e.drawImage(y,h,p,u,A,0,0,u,A)}_hitFunc(e){const n=this.animation(),s=this.frameIndex(),i=s*4,c=this.animations()[n],d=this.frameOffsets(),h=c[i+2],p=c[i+3];if(e.beginPath(),d){const u=d[n],A=s*2;e.rect(u[A+0],u[A+1],h,p)}else e.rect(0,0,h,p);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),n=this.animation(),s=this.animations(),i=s[n],c=i.length/4;e<c-1?this.frameIndex(e+1):this.frameIndex(0)}}hs.prototype.className="Sprite";Pn(hs);te.addGetterSetter(hs,"animation");te.addGetterSetter(hs,"animations");te.addGetterSetter(hs,"frameOffsets");te.addGetterSetter(hs,"image");te.addGetterSetter(hs,"frameIndex",0,Xe());te.addGetterSetter(hs,"frameRate",17,Xe());te.backCompat(hs,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Wo extends Fe{_sceneFunc(e){const n=this.innerRadius(),s=this.outerRadius(),i=this.numPoints();e.beginPath(),e.moveTo(0,0-s);for(let c=1;c<i*2;c++){const d=c%2===0?s:n,h=d*Math.sin(c*Math.PI/i),p=-1*d*Math.cos(c*Math.PI/i);e.lineTo(h,p)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Wo.prototype.className="Star";Wo.prototype._centroid=!0;Wo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Pn(Wo);te.addGetterSetter(Wo,"numPoints",5,Xe());te.addGetterSetter(Wo,"innerRadius",0,Xe());te.addGetterSetter(Wo,"outerRadius",0,Xe());function Fo(t){return[...t].reduce((e,n,s,i)=>{if(new RegExp("\\p{Emoji}","u").test(n)){const c=i[s+1];c&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(c)?(e.push(n+c),i[s+1]=""):e.push(n)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(i[s+1]||""))?e.push(n+i[s+1]):s>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(n)?e[e.length-1]+=n:n&&e.push(n);return e},[])}const gu="auto",Sw="center",Qx="inherit",cf="justify",Cw="Change.konva",ww="2d",_2="-",Yx="left",_w="text",Ew="Text",Tw="top",Rw="bottom",E2="middle",Vx="normal",Dw="px ",Gp=" ",Lw="right",T2="rtl",kw="word",Nw="char",R2="none",rg="…",qx=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Bw=qx.length;function Mw(t){return t.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,s=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!s&&(e=`"${e}"`),e}).join(", ")}let Hp;function ag(){return Hp||(Hp=he.createCanvasElement().getContext(ww),Hp)}function Pw(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function zw(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Fw(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let _n=class extends Fe{constructor(e){super(Fw(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n<Bw;n++)this.on(qx[n]+Cw,this._setTextData);this._setTextData()}_sceneFunc(e){var n,s;const i=this.textArr,c=i.length;if(!this.text())return;let d=this.padding(),h=this.fontSize(),p=this.lineHeight()*h,u=this.verticalAlign(),A=this.direction(),y=0,x=this.align(),S=this.getWidth(),C=this.letterSpacing(),T=this.charRenderFunc(),R=this.fill(),D=this.textDecoration(),M=this.underlineOffset(),P=D.indexOf("underline")!==-1,O=D.indexOf("line-through")!==-1,I;A=A===Qx?e.direction:A;let Y=p/2,K=E2;if(!Qe.legacyTextRendering){const q=this.measureSize("M");K="alphabetic";const Q=(n=q.fontBoundingBoxAscent)!==null&&n!==void 0?n:q.actualBoundingBoxAscent,V=(s=q.fontBoundingBoxDescent)!==null&&s!==void 0?s:q.actualBoundingBoxDescent;Y=(Q-V)/2+p/2}for(A===T2&&e.setAttr("direction",A),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",K),e.setAttr("textAlign",Yx),u===E2?y=(this.getHeight()-c*p-d*2)/2:u===Rw&&(y=this.getHeight()-c*p-d*2),e.translate(d,y+d),I=0;I<c;I++){let q=0,Q=0;const V=i[I],ge=V.text,X=V.width,se=V.lastInParagraph;if(e.save(),x===Lw?q+=S-X-d*2:x===Sw&&(q+=(S-X-d*2)/2),P){e.save(),e.beginPath();const ne=M??(Qe.legacyTextRendering?Math.round(h/2):Math.round(h/4)),le=q,pe=Y+Q+ne;e.moveTo(le,pe);const J=x===cf&&!se?S-d*2:X;e.lineTo(le+Math.round(J),pe),e.lineWidth=h/15;const ae=this._getLinearGradient();e.strokeStyle=ae||R,e.stroke(),e.restore()}const L=q;if(A!==T2&&(C!==0||x===cf||T)){const ne=ge.split(" ").length-1,le=Fo(ge);for(let pe=0;pe<le.length;pe++){const J=le[pe];if(J===" "&&!se&&x===cf&&(q+=(S-d*2-X)/ne),this._partialTextX=q,this._partialTextY=Y+Q,this._partialText=J,T){e.save();const re=i.slice(0,I).reduce((ee,Ee)=>ee+Fo(Ee.text).length,0),U=pe+re;T({char:J,index:U,x:q,y:Y+Q,lineIndex:I,column:pe,isLastInLine:se,width:this.measureSize(J).width,context:e})}e.fillStrokeShape(this),T&&e.restore(),q+=this.measureSize(J).width+C}}else C!==0&&e.setAttr("letterSpacing",`${C}px`),this._partialTextX=q,this._partialTextY=Y+Q,this._partialText=ge,e.fillStrokeShape(this);if(O){e.save(),e.beginPath();const ne=Qe.legacyTextRendering?0:-Math.round(h/4),le=L;e.moveTo(le,Y+Q+ne);const pe=x===cf&&!se?S-d*2:X;e.lineTo(le+Math.round(pe),Y+Q+ne),e.lineWidth=h/15;const J=this._getLinearGradient();e.strokeStyle=J||R,e.stroke(),e.restore()}e.restore(),c>1&&(Y+=p)}}_hitFunc(e){const n=this.getWidth(),s=this.getHeight();e.beginPath(),e.rect(0,0,n,s),e.closePath(),e.fillStrokeShape(this)}setText(e){const n=he._isString(e)?e:e==null?"":e+"";return this._setAttr(_w,n),this}getWidth(){return this.attrs.width===gu||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===gu||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return he.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,s,i,c,d,h,p,u,A,y,x;let S=ag(),C=this.fontSize(),T;S.save(),S.font=this._getContextFont(),T=S.measureText(e),S.restore();const R=C/100;return{actualBoundingBoxAscent:(n=T.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*R,actualBoundingBoxDescent:(s=T.actualBoundingBoxDescent)!==null&&s!==void 0?s:0,actualBoundingBoxLeft:(i=T.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*R,actualBoundingBoxRight:(c=T.actualBoundingBoxRight)!==null&&c!==void 0?c:75.732421875*R,alphabeticBaseline:(d=T.alphabeticBaseline)!==null&&d!==void 0?d:0,emHeightAscent:(h=T.emHeightAscent)!==null&&h!==void 0?h:100*R,emHeightDescent:(p=T.emHeightDescent)!==null&&p!==void 0?p:-20*R,fontBoundingBoxAscent:(u=T.fontBoundingBoxAscent)!==null&&u!==void 0?u:91*R,fontBoundingBoxDescent:(A=T.fontBoundingBoxDescent)!==null&&A!==void 0?A:21*R,hangingBaseline:(y=T.hangingBaseline)!==null&&y!==void 0?y:72.80000305175781*R,ideographicBaseline:(x=T.ideographicBaseline)!==null&&x!==void 0?x:-21*R,width:T.width,height:C}}_getContextFont(){return this.fontStyle()+Gp+this.fontVariant()+Gp+(this.fontSize()+Dw)+Mw(this.fontFamily())}_addTextLine(e){this.align()===cf&&(e=e.trim());const s=this._getTextWidth(e);return this.textArr.push({text:e,width:s,lastInParagraph:!1})}_getTextWidth(e){const n=this.letterSpacing(),s=e.length;return ag().measureText(e).width+n*s}_setTextData(){let e=this.text().split(`
277
- `),n=+this.fontSize(),s=0,i=this.lineHeight()*n,c=this.attrs.width,d=this.attrs.height,h=c!==gu&&c!==void 0,p=d!==gu&&d!==void 0,u=this.padding(),A=c-u*2,y=d-u*2,x=0,S=this.wrap(),C=S!==R2,T=S!==Nw&&C,R=this.ellipsis();this.textArr=[],ag().font=this._getContextFont();const D=R?this._getTextWidth(rg):0;for(let M=0,P=e.length;M<P;++M){let O=e[M],I=this._getTextWidth(O);if(h&&I>A)for(;O.length>0;){let Y=0,K=Fo(O).length,q="",Q=0;for(;Y<K;){const V=Y+K>>>1,ge=Fo(O),X=ge.slice(0,V+1).join(""),se=this._getTextWidth(X);(R&&p&&x+i>y?se+D:se)<=A?(Y=V+1,q=X,Q=se):K=V}if(q){if(T){const X=Fo(O),se=Fo(q),L=X[se.length],ne=L===Gp||L===_2;let le;if(ne&&Q<=A)le=se.length;else{const pe=se.lastIndexOf(Gp),J=se.lastIndexOf(_2);le=Math.max(pe,J)+1}le>0&&(Y=le,q=X.slice(0,Y).join(""),Q=this._getTextWidth(q))}if(q=q.trimRight(),this._addTextLine(q),s=Math.max(s,Q),x+=i,this._shouldHandleEllipsis(x)){this._tryToAddEllipsisToLastLine();break}if(O=Fo(O).slice(Y).join("").trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=A)){this._addTextLine(O),x+=i,s=Math.max(s,I);break}}else break}else this._addTextLine(O),x+=i,s=Math.max(s,I),this._shouldHandleEllipsis(x)&&M<P-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),p&&x+i>y)break}this.textHeight=n,this.textWidth=s}_shouldHandleEllipsis(e){const n=+this.fontSize(),s=this.lineHeight()*n,i=this.attrs.height,c=i!==gu&&i!==void 0,d=this.padding(),h=i-d*2;return!(this.wrap()!==R2)||c&&e+s>h}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==gu&&e!==void 0,s=this.padding(),i=e-s*2,c=this.ellipsis(),d=this.textArr[this.textArr.length-1];!d||!c||(n&&(this._getTextWidth(d.text+rg)<i||(d.text=d.text.slice(0,d.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(d.text+rg))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,n=this.hasShadow();return e&&n?!0:super._useBufferCanvas()}};_n.prototype._fillFunc=Pw;_n.prototype._strokeFunc=zw;_n.prototype.className=Ew;_n.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];Pn(_n);te.overWriteSetter(_n,"width",Vg());te.overWriteSetter(_n,"height",Vg());te.addGetterSetter(_n,"direction",Qx);te.addGetterSetter(_n,"fontFamily","Arial");te.addGetterSetter(_n,"fontSize",12,Xe());te.addGetterSetter(_n,"fontStyle",Vx);te.addGetterSetter(_n,"fontVariant",Vx);te.addGetterSetter(_n,"padding",0,Xe());te.addGetterSetter(_n,"align",Yx);te.addGetterSetter(_n,"verticalAlign",Tw);te.addGetterSetter(_n,"lineHeight",1,Xe());te.addGetterSetter(_n,"wrap",kw);te.addGetterSetter(_n,"ellipsis",!1,zi());te.addGetterSetter(_n,"letterSpacing",0,Xe());te.addGetterSetter(_n,"text","",zl());te.addGetterSetter(_n,"textDecoration","");te.addGetterSetter(_n,"underlineOffset",void 0,Xe());te.addGetterSetter(_n,"charRenderFunc",void 0);const Iw="",Kx="normal";function Jx(t){t.fillText(this.partialText,0,0)}function Zx(t){t.strokeText(this.partialText,0,0)}class hr extends Fe{constructor(e){super(e),this.dummyCanvas=he.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return wn.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const n=this.pathLength;return e>n?null:wn.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=wn.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const n=this.textDecoration(),s=this.fill(),i=this.fontSize(),c=this.glyphInfo,d=n.indexOf("underline")!==-1,h=n.indexOf("line-through")!==-1;d&&e.beginPath();for(let p=0;p<c.length;p++){e.save();const u=c[p].p0;e.translate(u.x,u.y),e.rotate(c[p].rotation),this.partialText=c[p].text,e.fillStrokeShape(this),d&&(p===0&&e.moveTo(0,i/2+1),e.lineTo(c[p].width,i/2+1)),e.restore()}if(d&&(e.strokeStyle=s,e.lineWidth=i/20,e.stroke()),h){e.beginPath();for(let p=0;p<c.length;p++){e.save();const u=c[p].p0;e.translate(u.x,u.y),e.rotate(c[p].rotation),p===0&&e.moveTo(0,0),e.lineTo(c[p].width,0),e.restore()}e.strokeStyle=s,e.lineWidth=i/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const n=this.glyphInfo;if(n.length>=1){const s=n[0].p0;e.moveTo(s.x,s.y)}for(let s=0;s<n.length;s++){const i=n[s].p1;e.lineTo(i.x,i.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return he.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return _n.prototype.setText.call(this,e)}_getContextFont(){return _n.prototype._getContextFont.call(this)}_getTextSize(e){const s=this.dummyCanvas.getContext("2d");s.save(),s.font=this._getContextFont();const i=s.measureText(e);return s.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=Fo(this.text()),n=[];let s=0;for(let y=0;y<e.length;y++)n.push({char:e[y],width:this._getTextSize(e[y]).width}),s+=n[y].width;const{height:i}=this._getTextSize(this.attrs.text);if(this.textWidth=s,this.textHeight=i,this.glyphInfo=[],!this.attrs.data)return null;const c=this.letterSpacing(),d=this.align(),h=this.kerningFunc(),p=Math.max(this.textWidth+((this.attrs.text||"").length-1)*c,0);let u=0;d==="center"&&(u=Math.max(0,this.pathLength/2-p/2)),d==="right"&&(u=Math.max(0,this.pathLength-p));let A=u;for(let y=0;y<n.length;y++){const x=this._getPointAtLength(A);if(!x)return;const S=n[y].char;let C=n[y].width+c;if(S===" "&&d==="justify"){const O=this.text().split(" ").length-1;C+=(this.pathLength-p)/O}const T=this._getPointAtLength(A+C);if(!T)return;const R=wn.getLineLength(x.x,x.y,T.x,T.y);let D=0;if(h)try{D=h(n[y-1].char,S)*this.fontSize()}catch{D=0}x.x+=D,T.x+=D,this.textWidth+=D;const M=wn.getPointOnLine(D+R/2,x.x,x.y,T.x,T.y),P=Math.atan2(T.y-x.y,T.x-x.x);this.glyphInfo.push({transposeX:M.x,transposeY:M.y,text:e[y],rotation:P,p0:x,p1:T,width:R}),A+=C}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(u){e.push(u.p0.x),e.push(u.p0.y),e.push(u.p1.x),e.push(u.p1.y)});let n=e[0]||0,s=e[0]||0,i=e[1]||0,c=e[1]||0,d,h;for(let u=0;u<e.length/2;u++)d=e[u*2],h=e[u*2+1],n=Math.min(n,d),s=Math.max(s,d),i=Math.min(i,h),c=Math.max(c,h);const p=this.fontSize();return{x:n-p/2,y:i-p/2,width:s-n+p,height:c-i+p}}destroy(){return he.releaseCanvas(this.dummyCanvas),super.destroy()}}hr.prototype._fillFunc=Jx;hr.prototype._strokeFunc=Zx;hr.prototype._fillFuncHit=Jx;hr.prototype._strokeFuncHit=Zx;hr.prototype.className="TextPath";hr.prototype._attrsAffectingSize=["text","fontSize","data"];Pn(hr);te.addGetterSetter(hr,"data");te.addGetterSetter(hr,"fontFamily","Arial");te.addGetterSetter(hr,"fontSize",12,Xe());te.addGetterSetter(hr,"fontStyle",Kx);te.addGetterSetter(hr,"align","left");te.addGetterSetter(hr,"letterSpacing",0,Xe());te.addGetterSetter(hr,"textBaseline","middle");te.addGetterSetter(hr,"fontVariant",Kx);te.addGetterSetter(hr,"text",Iw);te.addGetterSetter(hr,"textDecoration","");te.addGetterSetter(hr,"kerningFunc",void 0);const $x="tr-konva",Ow=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${$x}`).join(" "),D2="nodesRect",Uw=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],jw={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},Gw="ontouchstart"in Qe._global;function Hw(t,e,n){if(t==="rotater")return n;e+=he.degToRad(jw[t]||0);const s=(he.radToDeg(e)%360+360)%360;return he._inRange(s,315+22.5,360)||he._inRange(s,0,22.5)?"ns-resize":he._inRange(s,45-22.5,45+22.5)?"nesw-resize":he._inRange(s,90-22.5,90+22.5)?"ew-resize":he._inRange(s,135-22.5,135+22.5)?"nwse-resize":he._inRange(s,180-22.5,180+22.5)?"ns-resize":he._inRange(s,225-22.5,225+22.5)?"nesw-resize":he._inRange(s,270-22.5,270+22.5)?"ew-resize":he._inRange(s,315-22.5,315+22.5)?"nwse-resize":(he.error("Transformer has unknown angle for cursor detection: "+s),"pointer")}const sA=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function Xw(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function e5(t,e,n){const s=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:s,y:i}}function Ww(t,e){const n=Xw(t);return e5(t,e,n)}function Qw(t,e,n){let s=e;for(let i=0;i<t.length;i++){const c=Qe.getAngle(t[i]),d=Math.abs(c-e)%(Math.PI*2);Math.min(d,Math.PI*2-d)<n&&(s=c)}return s}let zg=0,Kt=class extends Ru{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Ow,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return he.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return $x+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const n=e.filter(i=>i.isAncestorOf(this)?(he.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const c=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(i._attrsAffectingSize.length){const d=i._attrsAffectingSize.map(h=>h+"Change."+this._getEventNamespace()).join(" ");i.on(d,c)}i.on(Uw.map(d=>d+`.${this._getEventNamespace()}`).join(" "),c),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,c),this._proxyDrag(i)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,s=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(s,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,s=>{if(!n)return;const i=e.getAbsolutePosition(),c=i.x-n.x,d=i.y-n.y;this.nodes().forEach(h=>{if(h===e||h.isDragging())return;const p=h.getAbsolutePosition();h.setAbsolutePosition({x:p.x+c,y:p.y+d}),h.startDrag(s)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(D2),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(D2,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),s){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),c=e.getAbsoluteScale(s),d=e.getAbsolutePosition(s),h=i.x*c.x-e.offsetX()*c.x,p=i.y*c.y-e.offsetY()*c.y,u=(Qe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),A={x:d.x+h*Math.cos(u)+p*Math.sin(-u),y:d.y+p*Math.cos(u)+h*Math.sin(u),width:i.width*c.x,height:i.height*c.y,rotation:u};return e5(A,-Qe.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const A=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),y=[{x:A.x,y:A.y},{x:A.x+A.width,y:A.y},{x:A.x+A.width,y:A.y+A.height},{x:A.x,y:A.y+A.height}],x=u.getAbsoluteTransform();y.forEach(function(S){const C=x.point(S);n.push(C)})});const s=new Qa;s.rotate(-Qe.getAngle(this.rotation()));let i=1/0,c=1/0,d=-1/0,h=-1/0;n.forEach(function(u){const A=s.point(u);i===void 0&&(i=d=A.x,c=h=A.y),i=Math.min(i,A.x),c=Math.min(c,A.y),d=Math.max(d,A.x),h=Math.max(h,A.y)}),s.invert();const p=s.point({x:i,y:c});return{x:p.x,y:p.y,width:d-i,height:h-c,rotation:Qe.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),sA.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new kf({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Gw?10:"auto"}),s=this;n.on("mousedown touchstart",function(i){s._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{const i=Qe.getAngle(this.rotation()),c=this.rotateAnchorCursor(),d=Hw(e,i,c);n.getStage().content&&(n.getStage().content.style.cursor=d),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new Fe({name:"back",width:0,height:0,sceneFunc(n,s){const i=s.getParent(),c=i.padding(),d=s.width(),h=s.height();if(n.beginPath(),n.rect(-c,-c,d+c*2,h+c*2),i.rotateEnabled()&&i.rotateLineVisible()){const p=i.rotateAnchorAngle(),u=i.rotateAnchorOffset(),A=he.degToRad(p),y=Math.sin(A),x=-Math.cos(A),S=d/2,C=h/2;let T=1/0;x<0?T=Math.min(T,-C/x):x>0&&(T=Math.min(T,(h-C)/x)),y<0?T=Math.min(T,-S/y):y>0&&(T=Math.min(T,(d-S)/y));const R=S+y*T,D=C+x*T,M=he._sign(h),P=R+y*u*M,O=D+x*u*M;n.moveTo(R,D),n.lineTo(P,O)}n.fillStrokeShape(s)},hitFunc:(n,s)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();n.beginPath(),n.rect(-i,-i,s.width()+i*2,s.height()+i*2),n.fillStrokeShape(s)}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const n=this._getNodeRect(),s=n.width,i=n.height,c=Math.sqrt(Math.pow(s,2)+Math.pow(i,2));this.sin=Math.abs(i/c),this.cos=Math.abs(s/c),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const d=e.target.getAbsolutePosition(),h=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:h.x-d.x,y:h.y-d.y},zg++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(p=>{p._fire("transformstart",{evt:e.evt,target:p})})}_handleMouseMove(e){let n,s,i;const c=this.findOne("."+this._movingAnchorName),d=c.getStage();d.setPointersPositions(e);const h=d.getPointerPosition();let p={x:h.x-this._anchorDragOffset.x,y:h.y-this._anchorDragOffset.y};const u=c.getAbsolutePosition();this.anchorDragBoundFunc()&&(p=this.anchorDragBoundFunc()(u,p,e)),c.setAbsolutePosition(p);const A=c.getAbsolutePosition();if(u.x===A.x&&u.y===A.y)return;if(this._movingAnchorName==="rotater"){const M=this._getNodeRect();n=c.x()-M.width/2,s=-c.y()+M.height/2;const P=Qe.getAngle(this.rotateAnchorAngle());let O=Math.atan2(-s,n)+Math.PI/2-P;M.height<0&&(O-=Math.PI);const Y=Qe.getAngle(this.rotation())+O,K=Qe.getAngle(this.rotationSnapTolerance()),Q=Qw(this.rotationSnaps(),Y,K)-M.rotation,V=Ww(M,Q);this._fitNodesInto(V,e);return}const y=this.shiftBehavior();let x;y==="inverted"?x=this.keepRatio()&&!e.shiftKey:y==="none"?x=this.keepRatio():x=this.keepRatio()||e.shiftKey;let S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(M.x-c.x(),2)+Math.pow(M.y-c.y(),2));const P=this.findOne(".top-left").x()>M.x?-1:1,O=this.findOne(".top-left").y()>M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,this.findOne(".top-left").x(M.x-n),this.findOne(".top-left").y(M.y-s)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(c.y());else if(this._movingAnchorName==="top-right"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(c.x()-M.x,2)+Math.pow(M.y-c.y(),2));const P=this.findOne(".top-right").x()<M.x?-1:1,O=this.findOne(".top-right").y()>M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,this.findOne(".top-right").x(M.x+n),this.findOne(".top-right").y(M.y-s)}var C=c.position();this.findOne(".top-left").y(C.y),this.findOne(".bottom-right").x(C.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(c.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(c.x());else if(this._movingAnchorName==="bottom-left"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(M.x-c.x(),2)+Math.pow(c.y()-M.y,2));const P=M.x<c.x()?-1:1,O=c.y()<M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,c.x(M.x-n),c.y(M.y+s)}C=c.position(),this.findOne(".top-left").x(C.x),this.findOne(".bottom-right").y(C.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(c.y());else if(this._movingAnchorName==="bottom-right"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(c.x()-M.x,2)+Math.pow(c.y()-M.y,2));const P=this.findOne(".bottom-right").x()<M.x?-1:1,O=this.findOne(".bottom-right").y()<M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,this.findOne(".bottom-right").x(M.x+n),this.findOne(".bottom-right").y(M.y+s)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(S=this.centeredScaling()||e.altKey,S){const M=this.findOne(".top-left"),P=this.findOne(".bottom-right"),O=M.x(),I=M.y(),Y=this.getWidth()-P.x(),K=this.getHeight()-P.y();P.move({x:-O,y:-I}),M.move({x:Y,y:K})}const T=this.findOne(".top-left").getAbsolutePosition();n=T.x,s=T.y;const R=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),D=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:n,y:s,width:R,height:D,rotation:Qe.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var n;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const s=this.getNode();zg--,this._fire("transformend",{evt:e,target:s}),(n=this.getLayer())===null||n===void 0||n.batchDraw(),s&&this._nodes.forEach(i=>{var c;i._fire("transformend",{evt:e,target:i}),(c=i.getLayer())===null||c===void 0||c.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const s=this._getNodeRect(),i=1;if(he._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(he._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const c=new Qa;if(c.rotate(Qe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const x=c.point({x:-this.padding()*2,y:0});e.x+=x.x,e.y+=x.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const x=c.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const x=c.point({x:0,y:-this.padding()*2});e.x+=x.x,e.y+=x.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const x=c.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const x=this.boundBoxFunc()(s,e);x?e=x:he.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const d=1e7,h=new Qa;h.translate(s.x,s.y),h.rotate(s.rotation),h.scale(s.width/d,s.height/d);const p=new Qa,u=e.width/d,A=e.height/d;this.flipEnabled()===!1?(p.translate(e.x,e.y),p.rotate(e.rotation),p.translate(e.width<0?e.width:0,e.height<0?e.height:0),p.scale(Math.abs(u),Math.abs(A))):(p.translate(e.x,e.y),p.rotate(e.rotation),p.scale(u,A));const y=p.multiply(h.invert());this._nodes.forEach(x=>{var S;if(!x.getStage())return;const C=x.getParent().getAbsoluteTransform(),T=x.getTransform().copy();T.translate(x.offsetX(),x.offsetY());const R=new Qa;R.multiply(C.copy().invert()).multiply(y).multiply(C).multiply(T);const D=R.decompose();x.setAttrs(D),(S=x.getLayer())===null||S===void 0||S.batchDraw()}),this.rotation(he._getRotation(e.rotation)),this._nodes.forEach(x=>{this._fire("transform",{evt:n,target:x}),x._fire("transform",{evt:n,target:x})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;const n=this._getNodeRect();this.rotation(he._getRotation(n.rotation));const s=n.width,i=n.height,c=this.enabledAnchors(),d=this.resizeEnabled(),h=this.padding(),p=this.anchorSize(),u=this.find("._anchor");u.forEach(Y=>{Y.setAttrs({width:p,height:p,offsetX:p/2,offsetY:p/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:p/2+h,offsetY:p/2+h,visible:d&&c.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:s/2,y:0,offsetY:p/2+h,visible:d&&c.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:s,y:0,offsetX:p/2-h,offsetY:p/2+h,visible:d&&c.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:p/2+h,visible:d&&c.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:s,y:i/2,offsetX:p/2-h,visible:d&&c.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:p/2+h,offsetY:p/2-h,visible:d&&c.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:s/2,y:i,offsetY:p/2-h,visible:d&&c.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:s,y:i,offsetX:p/2-h,offsetY:p/2-h,visible:d&&c.indexOf("bottom-right")>=0});const A=this.rotateAnchorAngle(),y=this.rotateAnchorOffset(),x=he.degToRad(A),S=Math.sin(x),C=-Math.cos(x),T=s/2,R=i/2;let D=1/0;C<0?D=Math.min(D,-R/C):C>0&&(D=Math.min(D,(i-R)/C)),S<0?D=Math.min(D,-T/S):S>0&&(D=Math.min(D,(s-T)/S));const M=T+S*D,P=R+C*D,O=he._sign(i);this._batchChangeChild(".rotater",{x:M+S*y*O,y:P+C*y*O-h*C,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:s,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(Y=>Y.draggable()),x:0,y:0});const I=this.anchorStyleFunc();I&&u.forEach(Y=>{I(Y)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Ru.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Ge.prototype.toObject.call(this)}clone(e){return Ge.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Kt.isTransforming=()=>zg>0;function Yw(t){return t instanceof Array||he.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sA.indexOf(e)===-1&&he.warn("Unknown anchor name: "+e+". Available names are: "+sA.join(", "))}),t||[]}Kt.prototype.className="Transformer";Pn(Kt);te.addGetterSetter(Kt,"enabledAnchors",sA,Yw);te.addGetterSetter(Kt,"flipEnabled",!0,zi());te.addGetterSetter(Kt,"resizeEnabled",!0);te.addGetterSetter(Kt,"anchorSize",10,Xe());te.addGetterSetter(Kt,"rotateEnabled",!0);te.addGetterSetter(Kt,"rotateLineVisible",!0);te.addGetterSetter(Kt,"rotationSnaps",[]);te.addGetterSetter(Kt,"rotateAnchorOffset",50,Xe());te.addGetterSetter(Kt,"rotateAnchorAngle",0,Xe());te.addGetterSetter(Kt,"rotateAnchorCursor","crosshair");te.addGetterSetter(Kt,"rotationSnapTolerance",5,Xe());te.addGetterSetter(Kt,"borderEnabled",!0);te.addGetterSetter(Kt,"anchorStroke","rgb(0, 161, 255)");te.addGetterSetter(Kt,"anchorStrokeWidth",1,Xe());te.addGetterSetter(Kt,"anchorFill","white");te.addGetterSetter(Kt,"anchorCornerRadius",0,Xe());te.addGetterSetter(Kt,"borderStroke","rgb(0, 161, 255)");te.addGetterSetter(Kt,"borderStrokeWidth",1,Xe());te.addGetterSetter(Kt,"borderDash");te.addGetterSetter(Kt,"keepRatio",!0);te.addGetterSetter(Kt,"shiftBehavior","default");te.addGetterSetter(Kt,"centeredScaling",!1);te.addGetterSetter(Kt,"ignoreStroke",!1);te.addGetterSetter(Kt,"padding",0,Xe());te.addGetterSetter(Kt,"nodes");te.addGetterSetter(Kt,"node");te.addGetterSetter(Kt,"boundBoxFunc");te.addGetterSetter(Kt,"anchorDragBoundFunc");te.addGetterSetter(Kt,"anchorStyleFunc");te.addGetterSetter(Kt,"shouldOverdrawWholeArea",!1);te.addGetterSetter(Kt,"useSingleNodeRotation",!0);te.backCompat(Kt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class eo extends Fe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Qe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}eo.prototype.className="Wedge";eo.prototype._centroid=!0;eo.prototype._attrsAffectingSize=["radius"];Pn(eo);te.addGetterSetter(eo,"radius",0,Xe());te.addGetterSetter(eo,"angle",0,Xe());te.addGetterSetter(eo,"clockwise",!1);te.backCompat(eo,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function L2(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const Vw=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],qw=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Kw(t,e){const n=t.data,s=t.width,i=t.height;let c,d,h,p,u,A,y,x,S,C,T,R,D,M,P,O,I,Y,K,q;const Q=e+e+1,V=s-1,ge=i-1,X=e+1,se=X*(X+1)/2,L=new L2,ne=Vw[e],le=qw[e];let pe=null,J=L,ae=null,re=null;for(let U=1;U<Q;U++)J=J.next=new L2,U===X&&(pe=J);J.next=L,h=d=0;for(let U=0;U<i;U++){R=D=M=P=p=u=A=y=0,x=X*(O=n[d]),S=X*(I=n[d+1]),C=X*(Y=n[d+2]),T=X*(K=n[d+3]),p+=se*O,u+=se*I,A+=se*Y,y+=se*K,J=L;for(let ee=0;ee<X;ee++)J.r=O,J.g=I,J.b=Y,J.a=K,J=J.next;for(let ee=1;ee<X;ee++)c=d+((V<ee?V:ee)<<2),p+=(J.r=O=n[c])*(q=X-ee),u+=(J.g=I=n[c+1])*q,A+=(J.b=Y=n[c+2])*q,y+=(J.a=K=n[c+3])*q,R+=O,D+=I,M+=Y,P+=K,J=J.next;ae=L,re=pe;for(let ee=0;ee<s;ee++)n[d+3]=K=y*ne>>le,K!==0?(K=255/K,n[d]=(p*ne>>le)*K,n[d+1]=(u*ne>>le)*K,n[d+2]=(A*ne>>le)*K):n[d]=n[d+1]=n[d+2]=0,p-=x,u-=S,A-=C,y-=T,x-=ae.r,S-=ae.g,C-=ae.b,T-=ae.a,c=h+((c=ee+e+1)<V?c:V)<<2,R+=ae.r=n[c],D+=ae.g=n[c+1],M+=ae.b=n[c+2],P+=ae.a=n[c+3],p+=R,u+=D,A+=M,y+=P,ae=ae.next,x+=O=re.r,S+=I=re.g,C+=Y=re.b,T+=K=re.a,R-=O,D-=I,M-=Y,P-=K,re=re.next,d+=4;h+=s}for(let U=0;U<s;U++){D=M=P=R=u=A=y=p=0,d=U<<2,x=X*(O=n[d]),S=X*(I=n[d+1]),C=X*(Y=n[d+2]),T=X*(K=n[d+3]),p+=se*O,u+=se*I,A+=se*Y,y+=se*K,J=L;for(let Ee=0;Ee<X;Ee++)J.r=O,J.g=I,J.b=Y,J.a=K,J=J.next;let ee=s;for(let Ee=1;Ee<=e;Ee++)d=ee+U<<2,p+=(J.r=O=n[d])*(q=X-Ee),u+=(J.g=I=n[d+1])*q,A+=(J.b=Y=n[d+2])*q,y+=(J.a=K=n[d+3])*q,R+=O,D+=I,M+=Y,P+=K,J=J.next,Ee<ge&&(ee+=s);d=U,ae=L,re=pe;for(let Ee=0;Ee<i;Ee++)c=d<<2,n[c+3]=K=y*ne>>le,K>0?(K=255/K,n[c]=(p*ne>>le)*K,n[c+1]=(u*ne>>le)*K,n[c+2]=(A*ne>>le)*K):n[c]=n[c+1]=n[c+2]=0,p-=x,u-=S,A-=C,y-=T,x-=ae.r,S-=ae.g,C-=ae.b,T-=ae.a,c=U+((c=Ee+X)<ge?c:ge)*s<<2,p+=R+=ae.r=n[c],u+=D+=ae.g=n[c+1],A+=M+=ae.b=n[c+2],y+=P+=ae.a=n[c+3],ae=ae.next,x+=O=re.r,S+=I=re.g,C+=Y=re.b,T+=K=re.a,R-=O,D-=I,M-=Y,P-=K,re=re.next,d+=s}}const Jw=function(e){const n=Math.round(this.blurRadius());n>0&&Kw(e,n)};te.addGetterSetter(Ge,"blurRadius",0,Xe(),te.afterSetFilter);const Zw=function(t){const e=this.brightness()*255,n=t.data,s=n.length;for(let i=0;i<s;i+=4)n[i]+=e,n[i+1]+=e,n[i+2]+=e};te.addGetterSetter(Ge,"brightness",0,Xe(),te.afterSetFilter);const $w=function(t){const e=this.brightness(),n=t.data,s=n.length;for(let i=0;i<s;i+=4)n[i]=Math.min(255,n[i]*e),n[i+1]=Math.min(255,n[i+1]*e),n[i+2]=Math.min(255,n[i+2]*e)},e8=function(t){const e=Math.pow((this.contrast()+100)/100,2),n=t.data,s=n.length;let i=150,c=150,d=150;for(let h=0;h<s;h+=4)i=n[h],c=n[h+1],d=n[h+2],i/=255,i-=.5,i*=e,i+=.5,i*=255,c/=255,c-=.5,c*=e,c+=.5,c*=255,d/=255,d-=.5,d*=e,d+=.5,d*=255,i=i<0?0:i>255?255:i,c=c<0?0:c>255?255:c,d=d<0?0:d>255?255:d,n[h]=i,n[h+1]=c,n[h+2]=d};te.addGetterSetter(Ge,"contrast",0,Xe(),te.afterSetFilter);const t8=function(t){var e,n,s,i,c,d,h,p,u;const A=t.data,y=t.width,x=t.height,S=Math.min(1,Math.max(0,(n=(e=this.embossStrength)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:.5)),C=Math.min(1,Math.max(0,(i=(s=this.embossWhiteLevel)===null||s===void 0?void 0:s.call(this))!==null&&i!==void 0?i:.5)),R=(h={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(d=(c=this.embossDirection)===null||c===void 0?void 0:c.call(this))!==null&&d!==void 0?d:"top-left"])!==null&&h!==void 0?h:315,D=!!((u=(p=this.embossBlend)===null||p===void 0?void 0:p.call(this))!==null&&u!==void 0&&u),M=S*10,P=C*255,O=R*Math.PI/180,I=Math.cos(O),Y=Math.sin(O),K=128/1020*M,q=new Uint8ClampedArray(A),Q=new Float32Array(y*x);for(let L=0,ne=0;ne<A.length;ne+=4,L++)Q[L]=.2126*q[ne]+.7152*q[ne+1]+.0722*q[ne+2];const V=[-1,0,1,-2,0,2,-1,0,1],ge=[-1,-2,-1,0,0,0,1,2,1],X=[-y-1,-y,-y+1,-1,0,1,y-1,y,y+1],se=L=>L<0?0:L>255?255:L;for(let L=1;L<x-1;L++)for(let ne=1;ne<y-1;ne++){const le=L*y+ne;let pe=0,J=0;pe+=Q[le+X[0]]*V[0],J+=Q[le+X[0]]*ge[0],pe+=Q[le+X[1]]*V[1],J+=Q[le+X[1]]*ge[1],pe+=Q[le+X[2]]*V[2],J+=Q[le+X[2]]*ge[2],pe+=Q[le+X[3]]*V[3],J+=Q[le+X[3]]*ge[3],pe+=Q[le+X[5]]*V[5],J+=Q[le+X[5]]*ge[5],pe+=Q[le+X[6]]*V[6],J+=Q[le+X[6]]*ge[6],pe+=Q[le+X[7]]*V[7],J+=Q[le+X[7]]*ge[7],pe+=Q[le+X[8]]*V[8],J+=Q[le+X[8]]*ge[8];const ae=I*pe+Y*J,re=se(P+ae*K),U=le*4;if(D){const ee=re-P;A[U]=se(q[U]+ee),A[U+1]=se(q[U+1]+ee),A[U+2]=se(q[U+2]+ee),A[U+3]=q[U+3]}else A[U]=A[U+1]=A[U+2]=re,A[U+3]=q[U+3]}for(let L=0;L<y;L++){let ne=L*4,le=((x-1)*y+L)*4;A[ne]=q[ne],A[ne+1]=q[ne+1],A[ne+2]=q[ne+2],A[ne+3]=q[ne+3],A[le]=q[le],A[le+1]=q[le+1],A[le+2]=q[le+2],A[le+3]=q[le+3]}for(let L=1;L<x-1;L++){let ne=L*y*4,le=(L*y+(y-1))*4;A[ne]=q[ne],A[ne+1]=q[ne+1],A[ne+2]=q[ne+2],A[ne+3]=q[ne+3],A[le]=q[le],A[le+1]=q[le+1],A[le+2]=q[le+2],A[le+3]=q[le+3]}return t};te.addGetterSetter(Ge,"embossStrength",.5,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"embossWhiteLevel",.5,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"embossDirection","top-left",void 0,te.afterSetFilter);te.addGetterSetter(Ge,"embossBlend",!1,void 0,te.afterSetFilter);function ig(t,e,n,s,i){const c=n-e,d=i-s;if(c===0)return s+d/2;if(d===0)return s;let h=(t-e)/c;return h=d*h+s,h}const n8=function(t){const e=t.data,n=e.length;let s=e[0],i=s,c,d=e[1],h=d,p,u=e[2],A=u,y;const x=this.enhance();if(x===0)return;for(let P=0;P<n;P+=4)c=e[P+0],c<s?s=c:c>i&&(i=c),p=e[P+1],p<d?d=p:p>h&&(h=p),y=e[P+2],y<u?u=y:y>A&&(A=y);i===s&&(i=255,s=0),h===d&&(h=255,d=0),A===u&&(A=255,u=0);let S,C,T,R,D,M;if(x>0)S=i+x*(255-i),C=s-x*(s-0),T=h+x*(255-h),R=d-x*(d-0),D=A+x*(255-A),M=u-x*(u-0);else{const P=(i+s)*.5;S=i+x*(i-P),C=s+x*(s-P);const O=(h+d)*.5;T=h+x*(h-O),R=d+x*(d-O);const I=(A+u)*.5;D=A+x*(A-I),M=u+x*(u-I)}for(let P=0;P<n;P+=4)e[P+0]=ig(e[P+0],s,i,C,S),e[P+1]=ig(e[P+1],d,h,R,T),e[P+2]=ig(e[P+2],u,A,M,D)};te.addGetterSetter(Ge,"enhance",0,Xe(),te.afterSetFilter);const r8=function(t){const e=t.data,n=e.length;for(let s=0;s<n;s+=4){const i=.34*e[s]+.5*e[s+1]+.16*e[s+2];e[s]=i,e[s+1]=i,e[s+2]=i}};te.addGetterSetter(Ge,"hue",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"saturation",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"luminance",0,Xe(),te.afterSetFilter);const a8=function(t){const e=t.data,n=e.length,s=1,i=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,d=this.luminance()*127,h=s*i*Math.cos(c*Math.PI/180),p=s*i*Math.sin(c*Math.PI/180),u=.299*s+.701*h+.167*p,A=.587*s-.587*h+.33*p,y=.114*s-.114*h-.497*p,x=.299*s-.299*h-.328*p,S=.587*s+.413*h+.035*p,C=.114*s-.114*h+.293*p,T=.299*s-.3*h+1.25*p,R=.587*s-.586*h-1.05*p,D=.114*s+.886*h-.2*p;let M,P,O,I;for(let Y=0;Y<n;Y+=4)M=e[Y+0],P=e[Y+1],O=e[Y+2],I=e[Y+3],e[Y+0]=u*M+A*P+y*O+d,e[Y+1]=x*M+S*P+C*O+d,e[Y+2]=T*M+R*P+D*O+d,e[Y+3]=I},i8=function(t){const e=t.data,n=e.length,s=Math.pow(2,this.value()),i=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,d=s*i*Math.cos(c*Math.PI/180),h=s*i*Math.sin(c*Math.PI/180),p=.299*s+.701*d+.167*h,u=.587*s-.587*d+.33*h,A=.114*s-.114*d-.497*h,y=.299*s-.299*d-.328*h,x=.587*s+.413*d+.035*h,S=.114*s-.114*d+.293*h,C=.299*s-.3*d+1.25*h,T=.587*s-.586*d-1.05*h,R=.114*s+.886*d-.2*h;for(let D=0;D<n;D+=4){const M=e[D+0],P=e[D+1],O=e[D+2],I=e[D+3];e[D+0]=p*M+u*P+A*O,e[D+1]=y*M+x*P+S*O,e[D+2]=C*M+T*P+R*O,e[D+3]=I}};te.addGetterSetter(Ge,"hue",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"saturation",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"value",0,Xe(),te.afterSetFilter);const s8=function(t){const e=t.data,n=e.length;for(let s=0;s<n;s+=4)e[s]=255-e[s],e[s+1]=255-e[s+1],e[s+2]=255-e[s+2]},o8=function(t,e,n){const s=t.data,i=e.data,c=t.width,d=t.height,h=n.polarCenterX||c/2,p=n.polarCenterY||d/2;let u=Math.sqrt(h*h+p*p),A=c-h,y=d-p;const x=Math.sqrt(A*A+y*y);u=x>u?x:u;const S=d,C=c,T=360/C*Math.PI/180;for(let R=0;R<C;R+=1){const D=Math.sin(R*T),M=Math.cos(R*T);for(let P=0;P<S;P+=1){A=Math.floor(h+u*P/S*M),y=Math.floor(p+u*P/S*D);let O=(y*c+A)*4;const I=s[O+0],Y=s[O+1],K=s[O+2],q=s[O+3];O=(R+P*c)*4,i[O+0]=I,i[O+1]=Y,i[O+2]=K,i[O+3]=q}}},l8=function(t,e,n){const s=t.data,i=e.data,c=t.width,d=t.height,h=n.polarCenterX||c/2,p=n.polarCenterY||d/2;let u=Math.sqrt(h*h+p*p),A=c-h,y=d-p;const x=Math.sqrt(A*A+y*y);u=x>u?x:u;const S=d,C=c,T=0;let R,D;for(A=0;A<c;A+=1)for(y=0;y<d;y+=1){const M=A-h,P=y-p,O=Math.sqrt(M*M+P*P)*S/u;let I=(Math.atan2(P,M)*180/Math.PI+360+T)%360;I=I*C/360,R=Math.floor(I),D=Math.floor(O);let Y=(D*c+R)*4;const K=s[Y+0],q=s[Y+1],Q=s[Y+2],V=s[Y+3];Y=(y*c+A)*4,i[Y+0]=K,i[Y+1]=q,i[Y+2]=Q,i[Y+3]=V}},c8=function(t){const e=t.width,n=t.height;let s,i,c,d,h,p,u,A,y,x,S=Math.round(this.kaleidoscopePower());const C=Math.round(this.kaleidoscopeAngle()),T=Math.floor(e*(C%360)/360);if(S<1)return;const R=he.createCanvasElement();R.width=e,R.height=n;const D=R.getContext("2d").getImageData(0,0,e,n);he.releaseCanvas(R),o8(t,D,{polarCenterX:e/2,polarCenterY:n/2});let M=e/Math.pow(2,S);for(;M<=8;)M=M*2,S-=1;M=Math.ceil(M);let P=M,O=0,I=P,Y=1;for(T+M>e&&(O=P,I=0,Y=-1),i=0;i<n;i+=1)for(s=O;s!==I;s+=Y)c=Math.round(s+T)%e,y=(e*i+c)*4,h=D.data[y+0],p=D.data[y+1],u=D.data[y+2],A=D.data[y+3],x=(e*i+s)*4,D.data[x+0]=h,D.data[x+1]=p,D.data[x+2]=u,D.data[x+3]=A;for(i=0;i<n;i+=1)for(P=Math.floor(M),d=0;d<S;d+=1){for(s=0;s<P+1;s+=1)y=(e*i+s)*4,h=D.data[y+0],p=D.data[y+1],u=D.data[y+2],A=D.data[y+3],x=(e*i+P*2-s-1)*4,D.data[x+0]=h,D.data[x+1]=p,D.data[x+2]=u,D.data[x+3]=A;P*=2}l8(D,t,{})};te.addGetterSetter(Ge,"kaleidoscopePower",2,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"kaleidoscopeAngle",0,Xe(),te.afterSetFilter);function Xp(t,e,n){let s=(n*t.width+e)*4;const i=[];return i.push(t.data[s++],t.data[s++],t.data[s++],t.data[s++]),i}function uf(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}function u8(t){const e=[0,0,0];for(let n=0;n<t.length;n++)e[0]+=t[n][0],e[1]+=t[n][1],e[2]+=t[n][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}function d8(t,e){const n=Xp(t,0,0),s=Xp(t,t.width-1,0),i=Xp(t,0,t.height-1),c=Xp(t,t.width-1,t.height-1),d=e||10;if(uf(n,s)<d&&uf(s,c)<d&&uf(c,i)<d&&uf(i,n)<d){const h=u8([s,n,c,i]),p=[];for(let u=0;u<t.width*t.height;u++){const A=uf(h,[t.data[u*4],t.data[u*4+1],t.data[u*4+2]]);p[u]=A<d?0:255}return p}}function f8(t,e){for(let n=0;n<t.width*t.height;n++)t.data[4*n+3]=e[n]}function h8(t,e,n){const s=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(s.length)),c=Math.floor(i/2),d=[];for(let h=0;h<n;h++)for(let p=0;p<e;p++){const u=h*e+p;let A=0;for(let y=0;y<i;y++)for(let x=0;x<i;x++){const S=h+y-c,C=p+x-c;if(S>=0&&S<n&&C>=0&&C<e){const T=S*e+C,R=s[y*i+x];A+=t[T]*R}}d[u]=A===2040?255:0}return d}function p8(t,e,n){const s=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(s.length)),c=Math.floor(i/2),d=[];for(let h=0;h<n;h++)for(let p=0;p<e;p++){const u=h*e+p;let A=0;for(let y=0;y<i;y++)for(let x=0;x<i;x++){const S=h+y-c,C=p+x-c;if(S>=0&&S<n&&C>=0&&C<e){const T=S*e+C,R=s[y*i+x];A+=t[T]*R}}d[u]=A>=1020?255:0}return d}function A8(t,e,n){const s=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(s.length)),c=Math.floor(i/2),d=[];for(let h=0;h<n;h++)for(let p=0;p<e;p++){const u=h*e+p;let A=0;for(let y=0;y<i;y++)for(let x=0;x<i;x++){const S=h+y-c,C=p+x-c;if(S>=0&&S<n&&C>=0&&C<e){const T=S*e+C,R=s[y*i+x];A+=t[T]*R}}d[u]=A}return d}const m8=function(t){const e=this.threshold();let n=d8(t,e);return n&&(n=h8(n,t.width,t.height),n=p8(n,t.width,t.height),n=A8(n,t.width,t.height),f8(t,n)),t};te.addGetterSetter(Ge,"threshold",0,Xe(),te.afterSetFilter);const g8=function(t){const e=this.noise()*255,n=t.data,s=n.length,i=e/2;for(let c=0;c<s;c+=4)n[c+0]+=i-2*i*Math.random(),n[c+1]+=i-2*i*Math.random(),n[c+2]+=i-2*i*Math.random()};te.addGetterSetter(Ge,"noise",.2,Xe(),te.afterSetFilter);const v8=function(t){let e=Math.ceil(this.pixelSize()),n=t.width,s=t.height,i=Math.ceil(n/e),c=Math.ceil(s/e),d=t.data;if(e<=0){he.error("pixelSize value can not be <= 0");return}for(let h=0;h<i;h+=1)for(let p=0;p<c;p+=1){let u=0,A=0,y=0,x=0;const S=h*e,C=S+e,T=p*e,R=T+e;let D=0;for(let M=S;M<C;M+=1)if(!(M>=n))for(let P=T;P<R;P+=1){if(P>=s)continue;const O=(n*P+M)*4;u+=d[O+0],A+=d[O+1],y+=d[O+2],x+=d[O+3],D+=1}u=u/D,A=A/D,y=y/D,x=x/D;for(let M=S;M<C;M+=1)if(!(M>=n))for(let P=T;P<R;P+=1){if(P>=s)continue;const O=(n*P+M)*4;d[O+0]=u,d[O+1]=A,d[O+2]=y,d[O+3]=x}}};te.addGetterSetter(Ge,"pixelSize",8,Xe(),te.afterSetFilter);const y8=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,s=n.length,i=255/e;for(let c=0;c<s;c+=1)n[c]=Math.floor(n[c]/i)*i};te.addGetterSetter(Ge,"levels",.5,Xe(),te.afterSetFilter);const x8=function(t){const e=t.data,n=e.length,s=this.red(),i=this.green(),c=this.blue();for(let d=0;d<n;d+=4){const h=(.34*e[d]+.5*e[d+1]+.16*e[d+2])/255;e[d]=h*s,e[d+1]=h*i,e[d+2]=h*c,e[d+3]=e[d+3]}};te.addGetterSetter(Ge,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"blue",0,Cx,te.afterSetFilter);const b8=function(t){const e=t.data,n=e.length,s=this.red(),i=this.green(),c=this.blue(),d=this.alpha();for(let h=0;h<n;h+=4){const p=1-d;e[h]=s*d+e[h]*p,e[h+1]=i*d+e[h+1]*p,e[h+2]=c*d+e[h+2]*p}};te.addGetterSetter(Ge,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"blue",0,Cx,te.afterSetFilter);te.addGetterSetter(Ge,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const S8=function(t){const e=t.data,n=e.length;for(let s=0;s<n;s+=4){const i=e[s+0],c=e[s+1],d=e[s+2];e[s+0]=Math.min(255,i*.393+c*.769+d*.189),e[s+1]=Math.min(255,i*.349+c*.686+d*.168),e[s+2]=Math.min(255,i*.272+c*.534+d*.131)}},C8=function(t){const n=t.data;for(let s=0;s<n.length;s+=4){const i=n[s],c=n[s+1],d=n[s+2];.2126*i+.7152*c+.0722*d>=128&&(n[s]=255-i,n[s+1]=255-c,n[s+2]=255-d)}return t},w8=function(t){const e=this.threshold()*255,n=t.data,s=n.length;for(let i=0;i<s;i+=1)n[i]=n[i]<e?0:255};te.addGetterSetter(Ge,"threshold",.5,Xe(),te.afterSetFilter);Pl.Util._assign(Pl,{Arc:Zs,Arrow:Il,Circle:Du,Ellipse:Ho,Image:Fi,Label:Jg,Tag:Ol,Line:$s,Path:wn,Rect:kf,RegularPolygon:Xo,Ring:Ul,Sprite:hs,Star:Wo,Text:_n,TextPath:hr,Transformer:Kt,Wedge:eo,Filters:{Blur:Jw,Brightness:$w,Brighten:Zw,Contrast:e8,Emboss:t8,Enhance:n8,Grayscale:r8,HSL:a8,HSV:i8,Invert:s8,Kaleidoscope:c8,Mask:m8,Noise:g8,Pixelate:v8,Posterize:y8,RGB:x8,RGBA:b8,Sepia:S8,Solarize:C8,Threshold:w8}});var Wp={exports:{}},Qp={exports:{}},sg={};/**
276
+ `,i2=()=>{if(typeof document>"u")throw new Error(iC)};class Qa{constructor(e=[1,0,0,1,0,0]){this.dirty=!1,this.m=e&&e.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new Qa(this.m)}copyInto(e){e.m[0]=this.m[0],e.m[1]=this.m[1],e.m[2]=this.m[2],e.m[3]=this.m[3],e.m[4]=this.m[4],e.m[5]=this.m[5]}point(e){const n=this.m;return{x:n[0]*e.x+n[2]*e.y+n[4],y:n[1]*e.x+n[3]*e.y+n[5]}}translate(e,n){return this.m[4]+=this.m[0]*e+this.m[2]*n,this.m[5]+=this.m[1]*e+this.m[3]*n,this}scale(e,n){return this.m[0]*=e,this.m[1]*=e,this.m[2]*=n,this.m[3]*=n,this}rotate(e){const n=Math.cos(e),s=Math.sin(e),i=this.m[0]*n+this.m[2]*s,c=this.m[1]*n+this.m[3]*s,d=this.m[0]*-s+this.m[2]*n,h=this.m[1]*-s+this.m[3]*n;return this.m[0]=i,this.m[1]=c,this.m[2]=d,this.m[3]=h,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(e,n){const s=this.m[0]+this.m[2]*n,i=this.m[1]+this.m[3]*n,c=this.m[2]+this.m[0]*e,d=this.m[3]+this.m[1]*e;return this.m[0]=s,this.m[1]=i,this.m[2]=c,this.m[3]=d,this}multiply(e){const n=this.m[0]*e.m[0]+this.m[2]*e.m[1],s=this.m[1]*e.m[0]+this.m[3]*e.m[1],i=this.m[0]*e.m[2]+this.m[2]*e.m[3],c=this.m[1]*e.m[2]+this.m[3]*e.m[3],d=this.m[0]*e.m[4]+this.m[2]*e.m[5]+this.m[4],h=this.m[1]*e.m[4]+this.m[3]*e.m[5]+this.m[5];return this.m[0]=n,this.m[1]=s,this.m[2]=i,this.m[3]=c,this.m[4]=d,this.m[5]=h,this}invert(){const e=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*e,s=-this.m[1]*e,i=-this.m[2]*e,c=this.m[0]*e,d=e*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),h=e*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=s,this.m[2]=i,this.m[3]=c,this.m[4]=d,this.m[5]=h,this}getMatrix(){return this.m}decompose(){const e=this.m[0],n=this.m[1],s=this.m[2],i=this.m[3],c=this.m[4],d=this.m[5],h=e*i-n*s,p={x:c,y:d,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(e!=0||n!=0){const u=Math.sqrt(e*e+n*n);p.rotation=n>0?Math.acos(e/u):-Math.acos(e/u),p.scaleX=u,p.scaleY=h/u,p.skewX=(e*s+n*i)/h,p.skewY=0}else if(s!=0||i!=0){const u=Math.sqrt(s*s+i*i);p.rotation=Math.PI/2-(i>0?Math.acos(-s/u):-Math.acos(s/u)),p.scaleX=h/u,p.scaleY=u,p.skewX=0,p.skewY=(e*s+n*i)/h}return p.rotation=he._getRotation(p.rotation),p}}const sC="[object Array]",oC="[object Number]",lC="[object String]",cC="[object Boolean]",uC=Math.PI/180,dC=180/Math.PI,af="#",fC="",hC="0",pC="Konva warning: ",s2="Konva error: ",AC="rgb(",Zm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},mC=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/;let Pp=[],sf=null;const gC=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(t){setTimeout(t,16)},he={_isElement(t){return!!(t&&t.nodeType==1)},_isFunction(t){return!!(t&&t.constructor&&t.call&&t.apply)},_isPlainObject(t){return!!t&&t.constructor===Object},_isArray(t){return Object.prototype.toString.call(t)===sC},_isNumber(t){return Object.prototype.toString.call(t)===oC&&!isNaN(t)&&isFinite(t)},_isString(t){return Object.prototype.toString.call(t)===lC},_isBoolean(t){return Object.prototype.toString.call(t)===cC},isObject(t){return t instanceof Object},isValidSelector(t){if(typeof t!="string")return!1;const e=t[0];return e==="#"||e==="."||e===e.toUpperCase()},_sign(t){return t===0||t>0?1:-1},requestAnimFrame(t){Pp.push(t),Pp.length===1&&gC(function(){const e=Pp;Pp=[],e.forEach(function(n){n()})})},createCanvasElement(){i2();const t=document.createElement("canvas");try{t.style=t.style||{}}catch{}return t},createImageElement(){return i2(),document.createElement("img")},_isInDocument(t){for(;t=t.parentNode;)if(t==document)return!0;return!1},_urlToImage(t,e){const n=he.createImageElement();n.onload=function(){e(n)},n.src=t},_rgbToHex(t,e,n){return((1<<24)+(t<<16)+(e<<8)+n).toString(16).slice(1)},_hexToRgb(t){t=t.replace(af,fC);const e=parseInt(t,16);return{r:e>>16&255,g:e>>8&255,b:e&255}},getRandomColor(){let t=(Math.random()*16777215<<0).toString(16);for(;t.length<6;)t=hC+t;return af+t},isCanvasFarblingActive(){if(sf!==null)return sf;if(typeof document>"u")return sf=!1,!1;const t=this.createCanvasElement();t.width=10,t.height=10;const e=t.getContext("2d",{willReadFrequently:!0});e.clearRect(0,0,10,10),e.fillStyle="#282828",e.fillRect(0,0,10,10);const n=e.getImageData(0,0,10,10).data;let s=!1;for(let i=0;i<100;i++)if(n[i*4]!==40||n[i*4+1]!==40||n[i*4+2]!==40||n[i*4+3]!==255){s=!0;break}return sf=s,this.releaseCanvas(t),sf},getHitColor(){const t=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(t):t},getHitColorKey(t,e,n){return this.isCanvasFarblingActive()&&(t=Math.round(t/5)*5,e=Math.round(e/5)*5,n=Math.round(n/5)*5),af+this._rgbToHex(t,e,n)},getSnappedHexColor(t){const e=this._hexToRgb(t);return af+this._rgbToHex(Math.round(e.r/5)*5,Math.round(e.g/5)*5,Math.round(e.b/5)*5)},getRGB(t){let e;return t in Zm?(e=Zm[t],{r:e[0],g:e[1],b:e[2]}):t[0]===af?this._hexToRgb(t.substring(1)):t.substr(0,4)===AC?(e=mC.exec(t.replace(/ /g,"")),{r:parseInt(e[1],10),g:parseInt(e[2],10),b:parseInt(e[3],10)}):{r:0,g:0,b:0}},colorToRGBA(t){return t=t||"black",he._namedColorToRBA(t)||he._hex3ColorToRGBA(t)||he._hex4ColorToRGBA(t)||he._hex6ColorToRGBA(t)||he._hex8ColorToRGBA(t)||he._rgbColorToRGBA(t)||he._rgbaColorToRGBA(t)||he._hslColorToRGBA(t)},_namedColorToRBA(t){const e=Zm[t.toLowerCase()];return e?{r:e[0],g:e[1],b:e[2],a:1}:null},_rgbColorToRGBA(t){if(t.indexOf("rgb(")===0){t=t.match(/rgb\(([^)]+)\)/)[1];const e=t.split(/ *, */).map(Number);return{r:e[0],g:e[1],b:e[2],a:1}}},_rgbaColorToRGBA(t){if(t.indexOf("rgba(")===0){t=t.match(/rgba\(([^)]+)\)/)[1];const e=t.split(/ *, */).map((n,s)=>n.slice(-1)==="%"?s===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:e[0],g:e[1],b:e[2],a:e[3]}}},_hex8ColorToRGBA(t){if(t[0]==="#"&&t.length===9)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:parseInt(t.slice(7,9),16)/255}},_hex6ColorToRGBA(t){if(t[0]==="#"&&t.length===7)return{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16),a:1}},_hex4ColorToRGBA(t){if(t[0]==="#"&&t.length===5)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:parseInt(t[4]+t[4],16)/255}},_hex3ColorToRGBA(t){if(t[0]==="#"&&t.length===4)return{r:parseInt(t[1]+t[1],16),g:parseInt(t[2]+t[2],16),b:parseInt(t[3]+t[3],16),a:1}},_hslColorToRGBA(t){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(t)){const[e,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(t),s=Number(n[0])/360,i=Number(n[1])/100,c=Number(n[2])/100;let d,h,p;if(i===0)return p=c*255,{r:Math.round(p),g:Math.round(p),b:Math.round(p),a:1};c<.5?d=c*(1+i):d=c+i-c*i;const u=2*c-d,A=[0,0,0];for(let y=0;y<3;y++)h=s+1/3*-(y-1),h<0&&h++,h>1&&h--,6*h<1?p=u+(d-u)*6*h:2*h<1?p=d:3*h<2?p=u+(d-u)*(2/3-h)*6:p=u,A[y]=p*255;return{r:Math.round(A[0]),g:Math.round(A[1]),b:Math.round(A[2]),a:1}}},haveIntersection(t,e){return!(e.x>t.x+t.width||e.x+e.width<t.x||e.y>t.y+t.height||e.y+e.height<t.y)},cloneObject(t){const e={};for(const n in t)this._isPlainObject(t[n])?e[n]=this.cloneObject(t[n]):this._isArray(t[n])?e[n]=this.cloneArray(t[n]):e[n]=t[n];return e},cloneArray(t){return t.slice(0)},degToRad(t){return t*uC},radToDeg(t){return t*dC},_degToRad(t){return he.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),he.degToRad(t)},_radToDeg(t){return he.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),he.radToDeg(t)},_getRotation(t){return Qe.angleDeg?he.radToDeg(t):t},_capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)},throw(t){throw new Error(s2+t)},error(t){console.error(s2+t)},warn(t){Qe.showWarnings&&console.warn(pC+t)},each(t,e){for(const n in t)e(n,t[n])},_inRange(t,e,n){return e<=t&&t<n},_getProjectionToSegment(t,e,n,s,i,c){let d,h,p;const u=(t-n)*(t-n)+(e-s)*(e-s);if(u==0)d=t,h=e,p=(i-n)*(i-n)+(c-s)*(c-s);else{const A=((i-t)*(n-t)+(c-e)*(s-e))/u;A<0?(d=t,h=e,p=(t-i)*(t-i)+(e-c)*(e-c)):A>1?(d=n,h=s,p=(n-i)*(n-i)+(s-c)*(s-c)):(d=t+A*(n-t),h=e+A*(s-e),p=(d-i)*(d-i)+(h-c)*(h-c))}return[d,h,p]},_getProjectionToLine(t,e,n){const s=he.cloneObject(t);let i=Number.MAX_VALUE;return e.forEach(function(c,d){if(!n&&d===e.length-1)return;const h=e[(d+1)%e.length],p=he._getProjectionToSegment(c.x,c.y,h.x,h.y,t.x,t.y),u=p[0],A=p[1],y=p[2];y<i&&(s.x=u,s.y=A,i=y)}),s},_prepareArrayForTween(t,e,n){const s=[],i=[];if(t.length>e.length){const d=e;e=t,t=d}for(let d=0;d<t.length;d+=2)s.push({x:t[d],y:t[d+1]});for(let d=0;d<e.length;d+=2)i.push({x:e[d],y:e[d+1]});const c=[];return i.forEach(function(d){const h=he._getProjectionToLine(d,s,n);c.push(h.x),c.push(h.y)}),c},_prepareToStringify(t){let e;t.visitedByCircularReferenceRemoval=!0;for(const n in t)if(t.hasOwnProperty(n)&&t[n]&&typeof t[n]=="object"){if(e=Object.getOwnPropertyDescriptor(t,n),t[n].visitedByCircularReferenceRemoval||he._isElement(t[n]))if(e.configurable)delete t[n];else return null;else if(he._prepareToStringify(t[n])===null)if(e.configurable)delete t[n];else return null}return delete t.visitedByCircularReferenceRemoval,t},_assign(t,e){for(const n in e)t[n]=e[n];return t},_getFirstPointerId(t){return t.touches?t.changedTouches[0].identifier:t.pointerId||999},releaseCanvas(...t){Qe.releaseCanvasOnDestroy&&t.forEach(e=>{e.width=0,e.height=0})},drawRoundedRectPath(t,e,n,s){let i=e<0?e:0,c=n<0?n:0;e=Math.abs(e),n=Math.abs(n);let d=0,h=0,p=0,u=0;typeof s=="number"?d=h=p=u=Math.min(s,e/2,n/2):(d=Math.min(s[0]||0,e/2,n/2),h=Math.min(s[1]||0,e/2,n/2),u=Math.min(s[2]||0,e/2,n/2),p=Math.min(s[3]||0,e/2,n/2)),t.moveTo(i+d,c),t.lineTo(i+e-h,c),t.arc(i+e-h,c+h,h,Math.PI*3/2,0,!1),t.lineTo(i+e,c+n-u),t.arc(i+e-u,c+n-u,u,0,Math.PI/2,!1),t.lineTo(i+p,c+n),t.arc(i+p,c+n-p,p,Math.PI/2,Math.PI,!1),t.lineTo(i,c+d),t.arc(i+d,c+d,d,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(t,e,n,s,i){s=Math.abs(s);for(let c=0;c<n;c++){const d=e[(c-1+n)%n],h=e[c],p=e[(c+1)%n],u={x:h.x-d.x,y:h.y-d.y},A={x:p.x-h.x,y:p.y-h.y},y=Math.hypot(u.x,u.y),x=Math.hypot(A.x,A.y);let S;typeof i=="number"?S=i:S=c<i.length?i[c]:0,S=s*Math.cos(Math.PI/n)*Math.min(1,S/s*2);const T={x:u.x/y,y:u.y/y},R={x:A.x/x,y:A.y/x},D={x:h.x-T.x*S,y:h.y-T.y*S},M={x:h.x+R.x*S,y:h.y+R.y*S};c===0?t.moveTo(D.x,D.y):t.lineTo(D.x,D.y),t.arcTo(h.x,h.y,M.x,M.y,S)}}};function vC(t){const e=[],n=t.length,s=he;for(let i=0;i<n;i++){let c=t[i];s._isNumber(c)?c=Math.round(c*1e3)/1e3:s._isString(c)||(c=c+""),e.push(c)}return e}const o2=",",yC="(",xC=")",bC="([",SC="])",CC=";",wC="()",_C="=",l2=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],EC=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],TC=100;let zp=null;function c2(){if(zp!==null)return zp;try{const e=he.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(zp=!1,!1)}catch{return zp=!1,!1}}class fA{constructor(e){this.canvas=e,Qe.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,n){let s=this.traceArr,i=s.length,c="",d,h,p,u;for(d=0;d<i;d++)h=s[d],p=h.method,p?(u=h.args,c+=p,e?c+=wC:he._isArray(u[0])?c+=bC+u.join(o2)+SC:(n&&(u=u.map(A=>typeof A=="number"?Math.floor(A):A)),c+=yC+u.join(o2)+xC)):(c+=h.property,e||(c+=_C+h.val)),c+=CC;return c}clearTrace(){this.traceArr=[]}_trace(e){let n=this.traceArr,s;n.push(e),s=n.length,s>=TC&&n.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const n=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(e){const n=e.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(e){const n=e.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(e){const n=e.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}_applyMiterLimit(e){const n=e.attrs.miterLimit;n!=null&&this.setAttr("miterLimit",n)}setAttr(e,n){this._context[e]=n}arc(e,n,s,i,c,d){this._context.arc(e,n,s,i,c,d)}arcTo(e,n,s,i,c){this._context.arcTo(e,n,s,i,c)}beginPath(){this._context.beginPath()}bezierCurveTo(e,n,s,i,c,d){this._context.bezierCurveTo(e,n,s,i,c,d)}clearRect(e,n,s,i){this._context.clearRect(e,n,s,i)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,n){const s=arguments;if(s.length===2)return this._context.createImageData(e,n);if(s.length===1)return this._context.createImageData(e)}createLinearGradient(e,n,s,i){return this._context.createLinearGradient(e,n,s,i)}createPattern(e,n){return this._context.createPattern(e,n)}createRadialGradient(e,n,s,i,c,d){return this._context.createRadialGradient(e,n,s,i,c,d)}drawImage(e,n,s,i,c,d,h,p,u){const A=arguments,y=this._context;A.length===3?y.drawImage(e,n,s):A.length===5?y.drawImage(e,n,s,i,c):A.length===9&&y.drawImage(e,n,s,i,c,d,h,p,u)}ellipse(e,n,s,i,c,d,h,p){this._context.ellipse(e,n,s,i,c,d,h,p)}isPointInPath(e,n,s,i){return s?this._context.isPointInPath(s,e,n,i):this._context.isPointInPath(e,n,i)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,n,s,i){this._context.fillRect(e,n,s,i)}strokeRect(e,n,s,i){this._context.strokeRect(e,n,s,i)}fillText(e,n,s,i){i?this._context.fillText(e,n,s,i):this._context.fillText(e,n,s)}measureText(e){return this._context.measureText(e)}getImageData(e,n,s,i){return this._context.getImageData(e,n,s,i)}lineTo(e,n){this._context.lineTo(e,n)}moveTo(e,n){this._context.moveTo(e,n)}rect(e,n,s,i){this._context.rect(e,n,s,i)}roundRect(e,n,s,i,c){this._context.roundRect(e,n,s,i,c)}putImageData(e,n,s){this._context.putImageData(e,n,s)}quadraticCurveTo(e,n,s,i){this._context.quadraticCurveTo(e,n,s,i)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,n){this._context.scale(e,n)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,n,s,i,c,d){this._context.setTransform(e,n,s,i,c,d)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,n,s,i){this._context.strokeText(e,n,s,i)}transform(e,n,s,i,c,d){this._context.transform(e,n,s,i,c,d)}translate(e,n){this._context.translate(e,n)}_enableTrace(){let e=this,n=l2.length,s=this.setAttr,i,c;const d=function(h){let p=e[h],u;e[h]=function(){return c=vC(Array.prototype.slice.call(arguments,0)),u=p.apply(e,arguments),e._trace({method:h,args:c}),u}};for(i=0;i<n;i++)d(l2[i]);e.setAttr=function(){s.apply(e,arguments);const h=arguments[0];let p=arguments[1];(h==="shadowOffsetX"||h==="shadowOffsetY"||h==="shadowBlur")&&(p=p/this.canvas.getPixelRatio()),e._trace({property:h,val:p})}}_applyGlobalCompositeOperation(e){const n=e.attrs.globalCompositeOperation;!n||n==="source-over"||this.setAttr("globalCompositeOperation",n)}}EC.forEach(function(t){Object.defineProperty(fA.prototype,t,{get(){return this._context[t]},set(e){this._context[t]=e}})});class RC extends fA{constructor(e,{willReadFrequently:n=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:n})}_fillColor(e){const n=e.fill();this.setAttr("fillStyle",n),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const n=e._getLinearGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fillRadialGradient(e){const n=e._getRadialGradient();n&&(this.setAttr("fillStyle",n),e._fillFunc(this))}_fill(e){const n=e.fill(),s=e.getFillPriority();if(n&&s==="color"){this._fillColor(e);return}const i=e.getFillPatternImage();if(i&&s==="pattern"){this._fillPattern(e);return}const c=e.getFillLinearGradientColorStops();if(c&&s==="linear-gradient"){this._fillLinearGradient(e);return}const d=e.getFillRadialGradientColorStops();if(d&&s==="radial-gradient"){this._fillRadialGradient(e);return}n?this._fillColor(e):i?this._fillPattern(e):c?this._fillLinearGradient(e):d&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const n=e.getStrokeLinearGradientStartPoint(),s=e.getStrokeLinearGradientEndPoint(),i=e.getStrokeLinearGradientColorStops(),c=this.createLinearGradient(n.x,n.y,s.x,s.y);if(i){for(let d=0;d<i.length;d+=2)c.addColorStop(i[d],i[d+1]);this.setAttr("strokeStyle",c)}}_stroke(e){const n=e.dash(),s=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!s){this.save();const c=this.getCanvas().getPixelRatio();this.setTransform(c,0,0,c,0,0)}this._applyLineCap(e),n&&e.dashEnabled()&&(this.setLineDash(n),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),s||this.restore()}}_applyShadow(e){var n,s,i;const c=(n=e.getShadowRGBA())!==null&&n!==void 0?n:"black",d=(s=e.getShadowBlur())!==null&&s!==void 0?s:5,h=(i=e.getShadowOffset())!==null&&i!==void 0?i:{x:0,y:0},p=e.getAbsoluteScale(),u=this.canvas.getPixelRatio(),A=p.x*u,y=p.y*u;this.setAttr("shadowColor",c),this.setAttr("shadowBlur",d*Math.min(Math.abs(A),Math.abs(y))),this.setAttr("shadowOffsetX",h.x*A),this.setAttr("shadowOffsetY",h.y*y)}}class DC extends fA{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const n=e.getStrokeScaleEnabled();if(!n){this.save();const c=this.getCanvas().getPixelRatio();this.setTransform(c,0,0,c,0,0)}this._applyLineCap(e);const s=e.hitStrokeWidth(),i=s==="auto"?e.strokeWidth():s;this.setAttr("lineWidth",i),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),n||this.restore()}}}let Fp;function LC(){if(Fp)return Fp;const t=he.createCanvasElement(),e=t.getContext("2d");return Fp=(function(){const n=Qe._global.devicePixelRatio||1,s=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return n/s})(),he.releaseCanvas(t),Fp}class Qg{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const s=(e||{}).pixelRatio||Qe.pixelRatio||LC();this.pixelRatio=s,this._canvas=he.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const n=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/n,this.getHeight()/n)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const n=this.pixelRatio;this.getContext()._context.scale(n,n)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const n=this.pixelRatio;this.getContext()._context.scale(n,n)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,n){this.setWidth(e||0),this.setHeight(n||0)}toDataURL(e,n){try{return this._canvas.toDataURL(e,n)}catch{try{return this._canvas.toDataURL()}catch(i){return he.error("Unable to get data URL. "+i.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}}class Oo extends Qg{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new RC(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}}class Yg extends Qg{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new DC(this),this.setSize(e.width,e.height)}}const on={get isDragging(){let t=!1;return on._dragElements.forEach(e=>{e.dragStatus==="dragging"&&(t=!0)}),t},justDragged:!1,get node(){let t;return on._dragElements.forEach(e=>{t=e.node}),t},_dragElements:new Map,_drag(t){const e=[];on._dragElements.forEach((n,s)=>{const{node:i}=n,c=i.getStage();c.setPointersPositions(t),n.pointerId===void 0&&(n.pointerId=he._getFirstPointerId(t));const d=c._changedPointerPositions.find(h=>h.id===n.pointerId);if(d){if(n.dragStatus!=="dragging"){const h=i.dragDistance();if(Math.max(Math.abs(d.x-n.startPointerPos.x),Math.abs(d.y-n.startPointerPos.y))<h||(i.startDrag({evt:t}),!i.isDragging()))return}i._setDragPosition(t,n),e.push(i)}}),e.forEach(n=>{n.fire("dragmove",{type:"dragmove",target:n,evt:t},!0)})},_endDragBefore(t){const e=[];on._dragElements.forEach(n=>{const{node:s}=n,i=s.getStage();if(t&&i.setPointersPositions(t),!i._changedPointerPositions.find(h=>h.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(on.justDragged=!0,Qe._mouseListenClick=!1,Qe._touchListenClick=!1,Qe._pointerListenClick=!1,n.dragStatus="stopped");const d=n.node.getLayer()||n.node instanceof Qe.Stage&&n.node;d&&e.indexOf(d)===-1&&e.push(d)}),e.forEach(n=>{n.draw()})},_endDragAfter(t){on._dragElements.forEach((e,n)=>{e.dragStatus==="stopped"&&e.node.fire("dragend",{type:"dragend",target:e.node,evt:t},!0),e.dragStatus!=="dragging"&&on._dragElements.delete(n)})}};Qe.isBrowser&&(window.addEventListener("mouseup",on._endDragBefore,!0),window.addEventListener("touchend",on._endDragBefore,!0),window.addEventListener("touchcancel",on._endDragBefore,!0),window.addEventListener("mousemove",on._drag),window.addEventListener("touchmove",on._drag),window.addEventListener("mouseup",on._endDragAfter,!1),window.addEventListener("touchend",on._endDragAfter,!1),window.addEventListener("touchcancel",on._endDragAfter,!1));function Go(t){return he._isString(t)?'"'+t+'"':Object.prototype.toString.call(t)==="[object Number]"||he._isBoolean(t)?t:Object.prototype.toString.call(t)}function Cx(t){return t>255?255:t<0?0:Math.round(t)}function Xe(){if(Qe.isUnminified)return function(t,e){return he._isNumber(t)||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a number.'),t}}function hA(t){if(Qe.isUnminified)return function(e,n){let s=he._isNumber(e),i=he._isArray(e)&&e.length==t;return!s&&!i&&he.warn(Go(e)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+t+")"),e}}function Vg(){if(Qe.isUnminified)return function(t,e){return he._isNumber(t)||t==="auto"||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a number or "auto".'),t}}function zl(){if(Qe.isUnminified)return function(t,e){return he._isString(t)||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a string.'),t}}function wx(){if(Qe.isUnminified)return function(t,e){const n=he._isString(t),s=Object.prototype.toString.call(t)==="[object CanvasGradient]"||t&&t.addColorStop;return n||s||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a string or a native gradient.'),t}}function kC(){if(Qe.isUnminified)return function(t,e){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&t instanceof n||(he._isArray(t)?t.forEach(function(s){he._isNumber(s)||he.warn('"'+e+'" attribute has non numeric element '+s+". Make sure that all elements are numbers.")}):he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a array of numbers.')),t}}function zi(){if(Qe.isUnminified)return function(t,e){return t===!0||t===!1||he.warn(Go(t)+' is a not valid value for "'+e+'" attribute. The value should be a boolean.'),t}}function NC(t){if(Qe.isUnminified)return function(e,n){return e==null||he.isObject(e)||he.warn(Go(e)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+t),e}}const of="get",lf="set",te={addGetterSetter(t,e,n,s,i){te.addGetter(t,e,n),te.addSetter(t,e,s,i),te.addOverloadedGetterSetter(t,e)},addGetter(t,e,n){const s=of+he._capitalize(e);t.prototype[s]=t.prototype[s]||function(){const i=this.attrs[e];return i===void 0?n:i}},addSetter(t,e,n,s){const i=lf+he._capitalize(e);t.prototype[i]||te.overWriteSetter(t,e,n,s)},overWriteSetter(t,e,n,s){const i=lf+he._capitalize(e);t.prototype[i]=function(c){return n&&c!==void 0&&c!==null&&(c=n.call(this,c,e)),this._setAttr(e,c),s&&s.call(this),this}},addComponentsGetterSetter(t,e,n,s,i){const c=n.length,d=he._capitalize,h=of+d(e),p=lf+d(e);t.prototype[h]=function(){const A={};for(let y=0;y<c;y++){const x=n[y];A[x]=this.getAttr(e+d(x))}return A};const u=NC(n);t.prototype[p]=function(A){const y=this.attrs[e];s&&(A=s.call(this,A,e)),u&&u.call(this,A,e);for(const x in A)A.hasOwnProperty(x)&&this._setAttr(e+d(x),A[x]);return A||n.forEach(x=>{this._setAttr(e+d(x),void 0)}),this._fireChangeEvent(e,y,A),i&&i.call(this),this},te.addOverloadedGetterSetter(t,e)},addOverloadedGetterSetter(t,e){const n=he._capitalize(e),s=lf+n,i=of+n;t.prototype[e]=function(){return arguments.length?(this[s](arguments[0]),this):this[i]()}},addDeprecatedGetterSetter(t,e,n,s){he.error("Adding deprecated "+e);const i=of+he._capitalize(e),c=e+" property is deprecated and will be removed soon. Look at Konva change log for more information.";t.prototype[i]=function(){he.error(c);const d=this.attrs[e];return d===void 0?n:d},te.addSetter(t,e,s,function(){he.error(c)}),te.addOverloadedGetterSetter(t,e)},backCompat(t,e){he.each(e,function(n,s){const i=t.prototype[s],c=of+he._capitalize(n),d=lf+he._capitalize(n);function h(){i.apply(this,arguments),he.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+s+'" instead.')}t.prototype[n]=h,t.prototype[c]=h,t.prototype[d]=h})},afterSetFilter(){this._filterUpToDate=!1}};function BC(t){const e=/(\w+)\(([^)]+)\)/g;let n;for(;(n=e.exec(t))!==null;){const[,s,i]=n;switch(s){case"blur":{const c=parseFloat(i.replace("px",""));return function(d){this.blurRadius(c*.5);const h=Qe.Filters;h&&h.Blur&&h.Blur.call(this,d)}}case"brightness":{const c=i.includes("%")?parseFloat(i)/100:parseFloat(i);return function(d){this.brightness(c);const h=Qe.Filters;h&&h.Brightness&&h.Brightness.call(this,d)}}case"contrast":{const c=parseFloat(i);return function(d){const h=100*(Math.sqrt(c)-1);this.contrast(h);const p=Qe.Filters;p&&p.Contrast&&p.Contrast.call(this,d)}}case"grayscale":return function(c){const d=Qe.Filters;d&&d.Grayscale&&d.Grayscale.call(this,c)};case"sepia":return function(c){const d=Qe.Filters;d&&d.Sepia&&d.Sepia.call(this,c)};case"invert":return function(c){const d=Qe.Filters;d&&d.Invert&&d.Invert.call(this,c)};default:he.warn(`CSS filter "${s}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}const eA="absoluteOpacity",u2="allEventListeners",Vs="absoluteTransform",d2="absoluteScale",kl="canvas",MC="Change",PC="children",zC="konva",Eg="listening",FC="mouseenter",IC="mouseleave",OC="pointerenter",UC="pointerleave",jC="touchenter",GC="touchleave",f2="set",h2="Shape",tA=" ",p2="stage",zo="transform",HC="Stage",Tg="visible",XC=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(tA);let WC=1;class Ge{constructor(e){this._id=WC++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(e),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(e){(e===zo||e===Vs)&&this._cache.get(e)?this._cache.get(e).dirty=!0:e?this._cache.delete(e):this._cache.clear()}_getCache(e,n){let s=this._cache.get(e);return(s===void 0||(e===zo||e===Vs)&&s.dirty===!0)&&(s=n.call(this),this._cache.set(e,s)),s}_calculate(e,n,s){if(!this._attachedDepsListeners.get(e)){const i=n.map(c=>c+"Change.konva").join(tA);this.on(i,()=>{this._clearCache(e)}),this._attachedDepsListeners.set(e,!0)}return this._getCache(e,s)}_getCanvasCache(){return this._cache.get(kl)}_clearSelfAndDescendantCache(e){this._clearCache(e),e===Vs&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(kl)){const{scene:e,filter:n,hit:s}=this._cache.get(kl);he.releaseCanvas(e._canvas,n._canvas,s._canvas),this._cache.delete(kl)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(e){const n=e||{};let s={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(s=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let i=Math.ceil(n.width||s.width),c=Math.ceil(n.height||s.height),d=n.pixelRatio,h=n.x===void 0?Math.floor(s.x):n.x,p=n.y===void 0?Math.floor(s.y):n.y,u=n.offset||0,A=n.drawBorder||!1,y=n.hitCanvasPixelRatio||1;if(!i||!c){he.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const x=Math.abs(Math.round(s.x)-h)>.5?1:0,S=Math.abs(Math.round(s.y)-p)>.5?1:0;i+=u*2+x,c+=u*2+S,h-=u,p-=u;const C=new Oo({pixelRatio:d,width:i,height:c}),T=new Oo({pixelRatio:d,width:0,height:0,willReadFrequently:!0}),R=new Yg({pixelRatio:y,width:i,height:c}),D=C.getContext(),M=R.getContext(),P=new Oo({width:C.width/C.pixelRatio+Math.abs(h),height:C.height/C.pixelRatio+Math.abs(p),pixelRatio:C.pixelRatio}),O=P.getContext();return R.isCache=!0,C.isCache=!0,this._cache.delete(kl),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(C.getContext()._context.imageSmoothingEnabled=!1,T.getContext()._context.imageSmoothingEnabled=!1),D.save(),M.save(),O.save(),D.translate(-h,-p),M.translate(-h,-p),O.translate(-h,-p),P.x=h,P.y=p,this._isUnderCache=!0,this._clearSelfAndDescendantCache(eA),this._clearSelfAndDescendantCache(d2),this.drawScene(C,this,P),this.drawHit(R,this),this._isUnderCache=!1,D.restore(),M.restore(),A&&(D.save(),D.beginPath(),D.rect(0,0,i,c),D.closePath(),D.setAttr("strokeStyle","red"),D.setAttr("lineWidth",5),D.stroke(),D.restore()),he.releaseCanvas(P._canvas),this._cache.set(kl,{scene:C,filter:T,hit:R,x:h,y:p}),this._requestDraw(),this}isCached(){return this._cache.has(kl)}getClientRect(e){throw new Error('abstract "getClientRect" method call')}_transformedRect(e,n){const s=[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}];let i=1/0,c=1/0,d=-1/0,h=-1/0;const p=this.getAbsoluteTransform(n);return s.forEach(function(u){const A=p.point(u);i===void 0&&(i=d=A.x,c=h=A.y),i=Math.min(i,A.x),c=Math.min(c,A.y),d=Math.max(d,A.x),h=Math.max(h,A.y)}),{x:i,y:c,width:d-i,height:h-c}}_drawCachedSceneCanvas(e){e.save(),e._applyOpacity(this),e._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();e.translate(n.x,n.y);const s=this._getCachedSceneCanvas(),i=s.pixelRatio;e.drawImage(s._canvas,0,0,s.width/i,s.height/i),e.restore()}_drawCachedHitCanvas(e){const n=this._getCanvasCache(),s=n.hit;e.save(),e.translate(n.x,n.y),e.drawImage(s._canvas,0,0,s.width/s.pixelRatio,s.height/s.pixelRatio),e.restore()}_getCachedSceneCanvas(){let e=this.filters(),n=this._getCanvasCache(),s=n.scene,i=n.filter,c=i.getContext(),d,h,p,u;if(!e||e.length===0)return s;if(this._filterUpToDate)return i;let A=!0;for(let x=0;x<e.length;x++)if(typeof e[x]=="string"&&c2(),typeof e[x]!="string"||!c2()){A=!1;break}const y=s.pixelRatio;if(i.setSize(s.width/s.pixelRatio,s.height/s.pixelRatio),A){const x=e.join(" ");return c.save(),c.setAttr("filter",x),c.drawImage(s._canvas,0,0,s.getWidth()/y,s.getHeight()/y),c.restore(),this._filterUpToDate=!0,i}try{for(d=e.length,c.clear(),c.drawImage(s._canvas,0,0,s.getWidth()/y,s.getHeight()/y),h=c.getImageData(0,0,i.getWidth(),i.getHeight()),p=0;p<d;p++)u=e[p],typeof u=="string"&&(u=BC(u)),u.call(this,h),c.putImageData(h,0,0)}catch(x){he.error("Unable to apply filter. "+x.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,i}on(e,n){if(this._cache&&this._cache.delete(u2),arguments.length===3)return this._delegate.apply(this,arguments);const s=e.split(tA);for(let i=0;i<s.length;i++){const d=s[i].split("."),h=d[0],p=d[1]||"";this.eventListeners[h]||(this.eventListeners[h]=[]),this.eventListeners[h].push({name:p,handler:n})}return this}off(e,n){let s=(e||"").split(tA),i=s.length,c,d,h,p,u,A;if(this._cache&&this._cache.delete(u2),!e)for(d in this.eventListeners)this._off(d);for(c=0;c<i;c++)if(h=s[c],p=h.split("."),u=p[0],A=p[1],u)this.eventListeners[u]&&this._off(u,A,n);else for(d in this.eventListeners)this._off(d,A,n);return this}dispatchEvent(e){const n={target:this,type:e.type,evt:e};return this.fire(e.type,n),this}addEventListener(e,n){return this.on(e,function(s){n.call(this,s.evt)}),this}removeEventListener(e){return this.off(e),this}_delegate(e,n,s){const i=this;this.on(e,function(c){const d=c.target.findAncestors(n,!0,i);for(let h=0;h<d.length;h++)c=he.cloneObject(c),c.currentTarget=d[h],s.call(d[h],c)})}remove(){return this.isDragging()&&this.stopDrag(),on._dragElements.delete(this._id),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Vs),this._clearSelfAndDescendantCache(eA),this._clearSelfAndDescendantCache(d2),this._clearSelfAndDescendantCache(p2),this._clearSelfAndDescendantCache(Tg),this._clearSelfAndDescendantCache(Eg)}_remove(){this._clearCaches();const e=this.getParent();e&&e.children&&(e.children.splice(this.index,1),e._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(e){const n="get"+he._capitalize(e);return he._isFunction(this[n])?this[n]():this.attrs[e]}getAncestors(){let e=this.getParent(),n=[];for(;e;)n.push(e),e=e.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(e){return this._batchTransformChanges(()=>{let n,s;if(!e)return this;for(n in e)n!==PC&&(s=f2+he._capitalize(n),he._isFunction(this[s])?this[s](e[n]):this._setAttr(n,e[n]))}),this}isListening(){return this._getCache(Eg,this._isListening)}_isListening(e){if(!this.listening())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isListening(e):!0}isVisible(){return this._getCache(Tg,this._isVisible)}_isVisible(e){if(!this.visible())return!1;const s=this.getParent();return s&&s!==e&&this!==e?s._isVisible(e):!0}shouldDrawHit(e,n=!1){if(e)return this._isVisible(e)&&this._isListening(e);const s=this.getLayer();let i=!1;on._dragElements.forEach(d=>{d.dragStatus==="dragging"&&(d.node.nodeType==="Stage"||d.node.getLayer()===s)&&(i=!0)});const c=!n&&!Qe.hitOnDragEnabled&&(i||Qe.isTransforming());return this.isListening()&&this.isVisible()&&!c}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let e=this.getDepth(),n=this,s=0,i,c,d,h;function p(A){for(i=[],c=A.length,d=0;d<c;d++)h=A[d],s++,h.nodeType!==h2&&(i=i.concat(h.getChildren().slice())),h._id===n._id&&(d=c);i.length>0&&i[0].getDepth()<=e&&p(i)}const u=this.getStage();return n.nodeType!==HC&&u&&p(u.getChildren()),s}getDepth(){let e=0,n=this.parent;for(;n;)e++,n=n.parent;return e}_batchTransformChanges(e){this._batchingTransformChange=!0,e(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(zo),this._clearSelfAndDescendantCache(Vs)),this._needClearTransformCache=!1}setPosition(e){return this._batchTransformChanges(()=>{this.x(e.x),this.y(e.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const e=this.getStage();if(!e)return null;const n=e.getPointerPosition();if(!n)return null;const s=this.getAbsoluteTransform().copy();return s.invert(),s.point(n)}getAbsolutePosition(e){let n=!1,s=this.parent;for(;s;){if(s.isCached()){n=!0;break}s=s.parent}n&&!e&&(e=!0);const i=this.getAbsoluteTransform(e).getMatrix(),c=new Qa,d=this.offset();return c.m=i.slice(),c.translate(d.x,d.y),c.getTranslation()}setAbsolutePosition(e){const{x:n,y:s,...i}=this._clearTransform();this.attrs.x=n,this.attrs.y=s,this._clearCache(zo);const c=this._getAbsoluteTransform().copy();return c.invert(),c.translate(e.x,e.y),e={x:this.attrs.x+c.getTranslation().x,y:this.attrs.y+c.getTranslation().y},this._setTransform(i),this.setPosition({x:e.x,y:e.y}),this._clearCache(zo),this._clearSelfAndDescendantCache(Vs),this}_setTransform(e){let n;for(n in e)this.attrs[n]=e[n]}_clearTransform(){const e={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,e}move(e){let n=e.x,s=e.y,i=this.x(),c=this.y();return n!==void 0&&(i+=n),s!==void 0&&(c+=s),this.setPosition({x:i,y:c}),this}_eachAncestorReverse(e,n){let s=[],i=this.getParent(),c,d;if(!(n&&n._id===this._id)){for(s.unshift(this);i&&(!n||i._id!==n._id);)s.unshift(i),i=i.parent;for(c=s.length,d=0;d<c;d++)e(s[d])}}rotate(e){return this.rotation(this.rotation()+e),this}moveToTop(){if(!this.parent)return he.warn("Node has no parent. moveToTop function is ignored."),!1;const e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return he.warn("Node has no parent. moveUp function is ignored."),!1;const e=this.index,n=this.parent.getChildren().length;return e<n-1?(this.parent.children.splice(e,1),this.parent.children.splice(e+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return he.warn("Node has no parent. moveDown function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.splice(e-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return he.warn("Node has no parent. moveToBottom function is ignored."),!1;const e=this.index;return e>0?(this.parent.children.splice(e,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(e){if(!this.parent)return he.warn("Node has no parent. zIndex parameter is ignored."),this;(e<0||e>=this.parent.children.length)&&he.warn("Unexpected value "+e+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(e,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(eA,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let e=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(e*=n.getAbsoluteOpacity()),e}moveTo(e){return this.getParent()!==e&&(this._remove(),e.add(this)),this}toObject(){let e=this.getAttrs(),n,s,i,c,d;const h={attrs:{},className:this.getClassName()};for(n in e)s=e[n],d=he.isObject(s)&&!he._isPlainObject(s)&&!he._isArray(s),!d&&(i=typeof this[n]=="function"&&this[n],delete e[n],c=i?i.call(this):null,e[n]=s,c!==s&&(h.attrs[n]=s));return he._prepareToStringify(h)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(e,n,s){const i=[];n&&this._isMatch(e)&&i.push(this);let c=this.parent;for(;c;){if(c===s)return i;c._isMatch(e)&&i.push(c),c=c.parent}return i}isAncestorOf(e){return!1}findAncestor(e,n,s){return this.findAncestors(e,n,s)[0]}_isMatch(e){if(!e)return!1;if(typeof e=="function")return e(this);let n=e.replace(/ /g,"").split(","),s=n.length,i,c;for(i=0;i<s;i++)if(c=n[i],he.isValidSelector(c)||(he.warn('Selector "'+c+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),he.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),he.warn("Konva is awesome, right?")),c.charAt(0)==="#"){if(this.id()===c.slice(1))return!0}else if(c.charAt(0)==="."){if(this.hasName(c.slice(1)))return!0}else if(this.className===c||this.nodeType===c)return!0;return!1}getLayer(){const e=this.getParent();return e?e.getLayer():null}getStage(){return this._getCache(p2,this._getStage)}_getStage(){const e=this.getParent();return e?e.getStage():null}fire(e,n={},s){return n.target=n.target||this,s?this._fireAndBubble(e,n):this._fire(e,n),this}getAbsoluteTransform(e){return e?this._getAbsoluteTransform(e):this._getCache(Vs,this._getAbsoluteTransform)}_getAbsoluteTransform(e){let n;if(e)return n=new Qa,this._eachAncestorReverse(function(s){const i=s.transformsEnabled();i==="all"?n.multiply(s.getTransform()):i==="position"&&n.translate(s.x()-s.offsetX(),s.y()-s.offsetY())},e),n;{n=this._cache.get(Vs)||new Qa,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const s=this.transformsEnabled();if(s==="all")n.multiply(this.getTransform());else if(s==="position"){const i=this.attrs.x||0,c=this.attrs.y||0,d=this.attrs.offsetX||0,h=this.attrs.offsetY||0;n.translate(i-d,c-h)}return n.dirty=!1,n}}getAbsoluteScale(e){let n=this;for(;n;)n._isUnderCache&&(e=n),n=n.getParent();const i=this.getAbsoluteTransform(e).decompose();return{x:i.scaleX,y:i.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(zo,this._getTransform)}_getTransform(){var e,n;const s=this._cache.get(zo)||new Qa;s.reset();const i=this.x(),c=this.y(),d=Qe.getAngle(this.rotation()),h=(e=this.attrs.scaleX)!==null&&e!==void 0?e:1,p=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,A=this.attrs.skewY||0,y=this.attrs.offsetX||0,x=this.attrs.offsetY||0;return(i!==0||c!==0)&&s.translate(i,c),d!==0&&s.rotate(d),(u!==0||A!==0)&&s.skew(u,A),(h!==1||p!==1)&&s.scale(h,p),(y!==0||x!==0)&&s.translate(-1*y,-1*x),s.dirty=!1,s}clone(e){let n=he.cloneObject(this.attrs),s,i,c,d,h;for(s in e)n[s]=e[s];const p=new this.constructor(n);for(s in this.eventListeners)for(i=this.eventListeners[s],c=i.length,d=0;d<c;d++)h=i[d],h.name.indexOf(zC)<0&&(p.eventListeners[s]||(p.eventListeners[s]=[]),p.eventListeners[s].push(h));return p}_toKonvaCanvas(e){e=e||{};const n=this.getClientRect(),s=this.getStage(),i=e.x!==void 0?e.x:Math.floor(n.x),c=e.y!==void 0?e.y:Math.floor(n.y),d=e.pixelRatio||1,h=new Oo({width:e.width||Math.ceil(n.width)||(s?s.width():0),height:e.height||Math.ceil(n.height)||(s?s.height():0),pixelRatio:d}),p=h.getContext(),u=new Oo({width:h.width/h.pixelRatio+Math.abs(i),height:h.height/h.pixelRatio+Math.abs(c),pixelRatio:h.pixelRatio});return e.imageSmoothingEnabled===!1&&(p._context.imageSmoothingEnabled=!1),p.save(),(i||c)&&p.translate(-1*i,-1*c),this.drawScene(h,void 0,u),p.restore(),h}toCanvas(e){return this._toKonvaCanvas(e)._canvas}toDataURL(e){e=e||{};const n=e.mimeType||null,s=e.quality||null,i=this._toKonvaCanvas(e).toDataURL(n,s);return e.callback&&e.callback(i),i}toImage(e){return new Promise((n,s)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,he._urlToImage(this.toDataURL(e),function(c){n(c),i==null||i(c)})}catch(i){s(i)}})}toBlob(e){return new Promise((n,s)=>{try{const i=e==null?void 0:e.callback;i&&delete e.callback,this.toCanvas(e).toBlob(c=>{n(c),i==null||i(c)},e==null?void 0:e.mimeType,e==null?void 0:e.quality)}catch(i){s(i)}})}setSize(e){return this.width(e.width),this.height(e.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Qe.dragDistance}_off(e,n,s){let i=this.eventListeners[e],c,d,h;for(c=0;c<i.length;c++)if(d=i[c].name,h=i[c].handler,(d!=="konva"||n==="konva")&&(!n||d===n)&&(!s||s===h)){if(i.splice(c,1),i.length===0){delete this.eventListeners[e];break}c--}}_fireChangeEvent(e,n,s){this._fire(e+MC,{oldVal:n,newVal:s})}addName(e){if(!this.hasName(e)){const n=this.name(),s=n?n+" "+e:e;this.name(s)}return this}hasName(e){if(!e)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(e)!==-1:!1}removeName(e){const n=(this.name()||"").split(/\s/g),s=n.indexOf(e);return s!==-1&&(n.splice(s,1),this.name(n.join(" "))),this}setAttr(e,n){const s=this[f2+he._capitalize(e)];return he._isFunction(s)?s.call(this,n):this._setAttr(e,n),this}_requestDraw(){if(Qe.autoDrawEnabled){const e=this.getLayer()||this.getStage();e==null||e.batchDraw()}}_setAttr(e,n){const s=this.attrs[e];s===n&&!he.isObject(n)||(n==null?delete this.attrs[e]:this.attrs[e]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(e,s,n),this._requestDraw())}_setComponentAttr(e,n,s){let i;s!==void 0&&(i=this.attrs[e],i||(this.attrs[e]=this.getAttr(e)),this.attrs[e][n]=s,this._fireChangeEvent(e,i,s))}_fireAndBubble(e,n,s){n&&this.nodeType===h2&&(n.target=this);const i=[FC,IC,OC,UC,jC,GC];if(!(i.indexOf(e)!==-1&&(s&&(this===s||this.isAncestorOf&&this.isAncestorOf(s))||this.nodeType==="Stage"&&!s))){this._fire(e,n);const d=i.indexOf(e)!==-1&&s&&s.isAncestorOf&&s.isAncestorOf(this)&&!s.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!d&&(s&&s.parent?this._fireAndBubble.call(this.parent,e,n,s):this._fireAndBubble.call(this.parent,e,n))}}_getProtoListeners(e){var n,s;const{nodeType:i}=this,c=Ge.protoListenerMap.get(i)||{};let d=c==null?void 0:c[e];if(d===void 0){d=[];let h=Object.getPrototypeOf(this);for(;h;){const p=(s=(n=h.eventListeners)===null||n===void 0?void 0:n[e])!==null&&s!==void 0?s:[];d.push(...p),h=Object.getPrototypeOf(h)}c[e]=d,Ge.protoListenerMap.set(i,c)}return d}_fire(e,n){n=n||{},n.currentTarget=this,n.type=e;const s=this._getProtoListeners(e);if(s)for(let c=0;c<s.length;c++)s[c].handler.call(this,n);const i=this.eventListeners[e];if(i)for(let c=0;c<i.length;c++)i[c].handler.call(this,n)}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(e){const n=e?e.pointerId:void 0,s=this.getStage(),i=this.getAbsolutePosition();if(!s)return;const c=s._getPointerById(n)||s._changedPointerPositions[0]||i;on._dragElements.set(this._id,{node:this,startPointerPos:c,offset:{x:c.x-i.x,y:c.y-i.y},dragStatus:"ready",pointerId:n})}startDrag(e,n=!0){on._dragElements.has(this._id)||this._createDragElement(e);const s=on._dragElements.get(this._id);s.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:e&&e.evt},n)}_setDragPosition(e,n){const s=this.getStage()._getPointerById(n.pointerId);if(!s)return;let i={x:s.x-n.offset.x,y:s.y-n.offset.y};const c=this.dragBoundFunc();if(c!==void 0){const d=c.call(this,i,e);d?i=d:he.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==i.x||this._lastPos.y!==i.y)&&(this.setAbsolutePosition(i),this._requestDraw()),this._lastPos=i}stopDrag(e){const n=on._dragElements.get(this._id);n&&(n.dragStatus="stopped"),on._endDragBefore(e),on._endDragAfter(e)}setDraggable(e){this._setAttr("draggable",e),this._dragChange()}isDragging(){const e=on._dragElements.get(this._id);return e?e.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(e){if(!(!(e.evt.button!==void 0)||Qe.dragButtons.indexOf(e.evt.button)>=0)||this.isDragging())return;let i=!1;on._dragElements.forEach(c=>{this.isAncestorOf(c.node)&&(i=!0)}),i||this._createDragElement(e)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const n=on._dragElements.get(this._id),s=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";s?this.stopDrag():i&&on._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(e={x:0,y:0}){const n=this.getStage();if(!n)return!1;const s={x:-e.x,y:-e.y,width:n.width()+2*e.x,height:n.height()+2*e.y};return he.haveIntersection(s,this.getClientRect())}static create(e,n){return he._isString(e)&&(e=JSON.parse(e)),this._createNode(e,n)}static _createNode(e,n){let s=Ge.prototype.getClassName.call(e),i=e.children,c,d,h;n&&(e.attrs.container=n),Qe[s]||(he.warn('Can not find a node with class name "'+s+'". Fallback to "Shape".'),s="Shape");const p=Qe[s];if(c=new p(e.attrs),i)for(d=i.length,h=0;h<d;h++)c.add(Ge._createNode(i[h]));return c}}Ge.protoListenerMap=new Map;Ge.prototype.nodeType="Node";Ge.prototype._attrsAffectingSize=[];Ge.prototype.eventListeners={};Ge.prototype.on.call(Ge.prototype,XC,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(zo),this._clearSelfAndDescendantCache(Vs)});Ge.prototype.on.call(Ge.prototype,"visibleChange.konva",function(){this._clearSelfAndDescendantCache(Tg)});Ge.prototype.on.call(Ge.prototype,"listeningChange.konva",function(){this._clearSelfAndDescendantCache(Eg)});Ge.prototype.on.call(Ge.prototype,"opacityChange.konva",function(){this._clearSelfAndDescendantCache(eA)});const xn=te.addGetterSetter;xn(Ge,"zIndex");xn(Ge,"absolutePosition");xn(Ge,"position");xn(Ge,"x",0,Xe());xn(Ge,"y",0,Xe());xn(Ge,"globalCompositeOperation","source-over",zl());xn(Ge,"opacity",1,Xe());xn(Ge,"name","",zl());xn(Ge,"id","",zl());xn(Ge,"rotation",0,Xe());te.addComponentsGetterSetter(Ge,"scale",["x","y"]);xn(Ge,"scaleX",1,Xe());xn(Ge,"scaleY",1,Xe());te.addComponentsGetterSetter(Ge,"skew",["x","y"]);xn(Ge,"skewX",0,Xe());xn(Ge,"skewY",0,Xe());te.addComponentsGetterSetter(Ge,"offset",["x","y"]);xn(Ge,"offsetX",0,Xe());xn(Ge,"offsetY",0,Xe());xn(Ge,"dragDistance",void 0,Xe());xn(Ge,"width",0,Xe());xn(Ge,"height",0,Xe());xn(Ge,"listening",!0,zi());xn(Ge,"preventDefault",!0,zi());xn(Ge,"filters",void 0,function(t){return this._filterUpToDate=!1,t});xn(Ge,"visible",!0,zi());xn(Ge,"transformsEnabled","all",zl());xn(Ge,"size");xn(Ge,"dragBoundFunc");xn(Ge,"draggable",!1,zi());te.backCompat(Ge,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});class Ya extends Ge{constructor(){super(...arguments),this.children=[]}getChildren(e){const n=this.children||[];return e?n.filter(e):n}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let s=0;s<e.length;s++)this.add(e[s]);return this}const n=e[0];return n.getParent()?(n.moveTo(this),this):(this._validateAdd(n),n.index=this.getChildren().length,n.parent=this,n._clearCaches(),this.getChildren().push(n),this._fire("add",{child:n}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const n=this._generalFind(e,!0);return n.length>0?n[0]:void 0}_generalFind(e,n){const s=[];return this._descendants(i=>{const c=i._isMatch(e);return c&&s.push(i),!!(c&&n)}),s}_descendants(e){let n=!1;const s=this.getChildren();for(const i of s){if(n=e(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(e),n))return!0}return!1}toObject(){const e=Ge.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(n=>{e.children.push(n.toObject())}),e}isAncestorOf(e){let n=e.getParent();for(;n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(e){const n=Ge.prototype.clone.call(this,e);return this.getChildren().forEach(function(s){n.add(s.clone())}),n}getAllIntersections(e){const n=[];return this.find("Shape").forEach(s=>{s.isVisible()&&s.intersects(e)&&n.push(s)}),n}_clearSelfAndDescendantCache(e){var n;super._clearSelfAndDescendantCache(e),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(s){s._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(n,s){n.index=s}),this._requestDraw()}drawScene(e,n,s){const i=this.getLayer(),c=e||i&&i.getCanvas(),d=c&&c.getContext(),h=this._getCanvasCache(),p=h&&h.scene,u=c&&c.isCache;if(!this.isVisible()&&!u)return this;if(p){d.save();const A=this.getAbsoluteTransform(n).getMatrix();d.transform(A[0],A[1],A[2],A[3],A[4],A[5]),this._drawCachedSceneCanvas(d),d.restore()}else this._drawChildren("drawScene",c,n,s);return this}drawHit(e,n){if(!this.shouldDrawHit(n))return this;const s=this.getLayer(),i=e||s&&s.hitCanvas,c=i&&i.getContext(),d=this._getCanvasCache();if(d&&d.hit){c.save();const p=this.getAbsoluteTransform(n).getMatrix();c.transform(p[0],p[1],p[2],p[3],p[4],p[5]),this._drawCachedHitCanvas(c),c.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(e,n,s,i){var c;const d=n&&n.getContext(),h=this.clipWidth(),p=this.clipHeight(),u=this.clipFunc(),A=typeof h=="number"&&typeof p=="number"||u,y=s===this;if(A){d.save();const S=this.getAbsoluteTransform(s);let C=S.getMatrix();d.transform(C[0],C[1],C[2],C[3],C[4],C[5]),d.beginPath();let T;if(u)T=u.call(this,d,this);else{const R=this.clipX(),D=this.clipY();d.rect(R||0,D||0,h,p)}d.clip.apply(d,T),C=S.copy().invert().getMatrix(),d.transform(C[0],C[1],C[2],C[3],C[4],C[5])}const x=!y&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";x&&(d.save(),d._applyGlobalCompositeOperation(this)),(c=this.children)===null||c===void 0||c.forEach(function(S){S[e](n,s,i)}),x&&d.restore(),A&&d.restore()}getClientRect(e={}){var n;const s=e.skipTransform,i=e.relativeTo;let c,d,h,p,u={x:1/0,y:1/0,width:0,height:0};const A=this;(n=this.children)===null||n===void 0||n.forEach(function(S){if(!S.visible())return;const C=S.getClientRect({relativeTo:A,skipShadow:e.skipShadow,skipStroke:e.skipStroke});C.width===0&&C.height===0||(c===void 0?(c=C.x,d=C.y,h=C.x+C.width,p=C.y+C.height):(c=Math.min(c,C.x),d=Math.min(d,C.y),h=Math.max(h,C.x+C.width),p=Math.max(p,C.y+C.height)))});const y=this.find("Shape");let x=!1;for(let S=0;S<y.length;S++)if(y[S]._isVisible(this)){x=!0;break}return x&&c!==void 0?u={x:c,y:d,width:h-c,height:p-d}:u={x:0,y:0,width:0,height:0},s?u:this._transformedRect(u,i)}}te.addComponentsGetterSetter(Ya,"clip",["x","y","width","height"]);te.addGetterSetter(Ya,"clipX",void 0,Xe());te.addGetterSetter(Ya,"clipY",void 0,Xe());te.addGetterSetter(Ya,"clipWidth",void 0,Xe());te.addGetterSetter(Ya,"clipHeight",void 0,Xe());te.addGetterSetter(Ya,"clipFunc");const Df=new Map,_x=Qe._global.PointerEvent!==void 0;function $m(t){return Df.get(t)}function qg(t){return{evt:t,pointerId:t.pointerId}}function Ex(t,e){return Df.get(t)===e}function Tx(t,e){bf(t),e.getStage()&&(Df.set(t,e),_x&&e._fire("gotpointercapture",qg(new PointerEvent("gotpointercapture"))))}function bf(t,e){const n=Df.get(t);if(!n)return;const s=n.getStage();s&&s.content,Df.delete(t),_x&&n._fire("lostpointercapture",qg(new PointerEvent("lostpointercapture")))}const QC="Stage",YC="string",A2="px",VC="mouseout",Rx="mouseleave",Dx="mouseover",Lx="mouseenter",kx="mousemove",Nx="mousedown",Bx="mouseup",hf="pointermove",pf="pointerdown",_u="pointerup",Af="pointercancel",qC="lostpointercapture",Ip="pointerout",mf="pointerleave",Op="pointerover",Up="pointerenter",Rg="contextmenu",Mx="touchstart",Px="touchend",zx="touchmove",Fx="touchcancel",Dg="wheel",KC=5,JC=[[Lx,"_pointerenter"],[Nx,"_pointerdown"],[kx,"_pointermove"],[Bx,"_pointerup"],[Rx,"_pointerleave"],[Mx,"_pointerdown"],[zx,"_pointermove"],[Px,"_pointerup"],[Fx,"_pointercancel"],[Dx,"_pointerover"],[Dg,"_wheel"],[Rg,"_contextmenu"],[pf,"_pointerdown"],[hf,"_pointermove"],[_u,"_pointerup"],[Af,"_pointercancel"],[mf,"_pointerleave"],[qC,"_lostpointercapture"]],eg={mouse:{[Ip]:VC,[mf]:Rx,[Op]:Dx,[Up]:Lx,[hf]:kx,[pf]:Nx,[_u]:Bx,[Af]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Ip]:"touchout",[mf]:"touchleave",[Op]:"touchover",[Up]:"touchenter",[hf]:zx,[pf]:Mx,[_u]:Px,[Af]:Fx,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Ip]:Ip,[mf]:mf,[Op]:Op,[Up]:Up,[hf]:hf,[pf]:pf,[_u]:_u,[Af]:Af,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},gf=t=>t.indexOf("pointer")>=0?"pointer":t.indexOf("touch")>=0?"touch":"mouse",mu=t=>{const e=gf(t);if(e==="pointer")return Qe.pointerEventsEnabled&&eg.pointer;if(e==="touch")return eg.touch;if(e==="mouse")return eg.mouse};function m2(t={}){return(t.clipFunc||t.clipWidth||t.clipHeight)&&he.warn("Stage does not support clipping. Please use clip for Layers or Groups."),t}const ZC="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",Sf=[];let pA=class extends Ya{constructor(e){super(m2(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Sf.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{m2(this.attrs)}),this._checkVisibility()}_validateAdd(e){const n=e.getType()==="Layer",s=e.getType()==="FastLayer";n||s||he.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===YC){let n;if(e.charAt(0)==="."){const s=e.slice(1);e=document.getElementsByClassName(s)[0]}else e.charAt(0)!=="#"?n=e:n=e.slice(1),e=document.getElementById(n);if(!e)throw"Can not find container in document with id "+n}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,n=e.length;for(let s=0;s<n;s++)e[s].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),Ya.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&he._isInDocument(e)&&this.container().removeChild(e);const n=Sf.indexOf(this);return n>-1&&Sf.splice(n,1),he.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(he.warn(ZC),null)}_getPointerById(e){return this._pointerPositions.find(n=>n.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const n=new Oo({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),s=n.getContext()._context,i=this.children;return(e.x||e.y)&&s.translate(-1*e.x,-1*e.y),i.forEach(function(c){if(!c.isVisible())return;const d=c._toKonvaCanvas(e);s.drawImage(d._canvas,e.x,e.y,d.getWidth()/d.getPixelRatio(),d.getHeight()/d.getPixelRatio())}),n}getIntersection(e){if(!e)return null;const n=this.children,s=n.length,i=s-1;for(let c=i;c>=0;c--){const d=n[c].getIntersection(e);if(d)return d}return null}_resizeDOM(){const e=this.width(),n=this.height();this.content&&(this.content.style.width=e+A2,this.content.style.height=n+A2),this.bufferCanvas.setSize(e,n),this.bufferHitCanvas.setSize(e,n),this.children.forEach(s=>{s.setSize({width:e,height:n}),s.draw()})}add(e,...n){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.add(arguments[i]);return this}super.add(e);const s=this.children.length;return s>KC&&he.warn("The stage has "+s+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),Qe.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return Ex(e,this)}setPointerCapture(e){Tx(e,this)}releaseCapture(e){bf(e)}getLayers(){return this.children}_bindContentEvents(){Qe.isBrowser&&JC.forEach(([e,n])=>{this.content.addEventListener(e,s=>{this[n](s)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const n=mu(e.type);n&&this._fire(n.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const n=mu(e.type);n&&this._fire(n.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let n=this[e+"targetShape"];return n&&!n.getStage()&&(n=null),n}_pointerleave(e){const n=mu(e.type),s=gf(e.type);if(!n)return;this.setPointersPositions(e);const i=this._getTargetShape(s),c=!(Qe.isDragging()||Qe.isTransforming())||Qe.hitOnDragEnabled;i&&c?(i._fireAndBubble(n.pointerout,{evt:e}),i._fireAndBubble(n.pointerleave,{evt:e}),this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this[s+"targetShape"]=null):c&&(this._fire(n.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(n.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const n=mu(e.type),s=gf(e.type);if(!n)return;this.setPointersPositions(e);let i=!1;this._changedPointerPositions.forEach(c=>{const d=this.getIntersection(c);if(on.justDragged=!1,Qe["_"+s+"ListenClick"]=!0,!d||!d.isListening()){this[s+"ClickStartShape"]=void 0;return}Qe.capturePointerEventsEnabled&&d.setPointerCapture(c.id),this[s+"ClickStartShape"]=d,d._fireAndBubble(n.pointerdown,{evt:e,pointerId:c.id}),i=!0;const h=e.type.indexOf("touch")>=0;d.preventDefault()&&e.cancelable&&h&&e.preventDefault()}),i||this._fire(n.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const n=mu(e.type),s=gf(e.type);if(!n)return;const i=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Qe.isDragging()&&on.node.preventDefault()&&e.cancelable&&i&&e.preventDefault(),this.setPointersPositions(e),!(!(Qe.isDragging()||Qe.isTransforming())||Qe.hitOnDragEnabled))return;const d={};let h=!1;const p=this._getTargetShape(s);this._changedPointerPositions.forEach(u=>{const A=$m(u.id)||this.getIntersection(u),y=u.id,x={evt:e,pointerId:y},S=p!==A;if(S&&p&&(p._fireAndBubble(n.pointerout,{...x},A),p._fireAndBubble(n.pointerleave,{...x},A)),A){if(d[A._id])return;d[A._id]=!0}A&&A.isListening()?(h=!0,S&&(A._fireAndBubble(n.pointerover,{...x},p),A._fireAndBubble(n.pointerenter,{...x},p),this[s+"targetShape"]=A),A._fireAndBubble(n.pointermove,{...x})):p&&(this._fire(n.pointerover,{evt:e,target:this,currentTarget:this,pointerId:y}),this[s+"targetShape"]=null)}),h||this._fire(n.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const n=mu(e.type),s=gf(e.type);if(!n)return;this.setPointersPositions(e);const i=this[s+"ClickStartShape"],c=this[s+"ClickEndShape"],d={};let h=!1;this._changedPointerPositions.forEach(p=>{const u=$m(p.id)||this.getIntersection(p);if(u){if(u.releaseCapture(p.id),d[u._id])return;d[u._id]=!0}const A=p.id,y={evt:e,pointerId:A};let x=!1;Qe["_"+s+"InDblClickWindow"]?(x=!0,clearTimeout(this[s+"DblTimeout"])):on.justDragged||(Qe["_"+s+"InDblClickWindow"]=!0,clearTimeout(this[s+"DblTimeout"])),this[s+"DblTimeout"]=setTimeout(function(){Qe["_"+s+"InDblClickWindow"]=!1},Qe.dblClickWindow),u&&u.isListening()?(h=!0,this[s+"ClickEndShape"]=u,u._fireAndBubble(n.pointerup,{...y}),Qe["_"+s+"ListenClick"]&&i&&i===u&&(u._fireAndBubble(n.pointerclick,{...y}),x&&c&&c===u&&u._fireAndBubble(n.pointerdblclick,{...y}))):(this[s+"ClickEndShape"]=null,h||(this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),h=!0),Qe["_"+s+"ListenClick"]&&this._fire(n.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:A}),x&&this._fire(n.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:A}))}),h||this._fire(n.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Qe["_"+s+"ListenClick"]=!1,e.cancelable&&s!=="touch"&&s!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(Rg,{evt:e}):this._fire(Rg,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const n=this.getIntersection(this.getPointerPosition());n&&n.isListening()?n._fireAndBubble(Dg,{evt:e}):this._fire(Dg,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const n=$m(e.pointerId)||this.getIntersection(this.getPointerPosition());n&&n._fireAndBubble(_u,qg(e)),bf(e.pointerId)}_lostpointercapture(e){bf(e.pointerId)}setPointersPositions(e){const n=this._getContentPosition();let s=null,i=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,c=>{this._pointerPositions.push({id:c.identifier,x:(c.clientX-n.left)/n.scaleX,y:(c.clientY-n.top)/n.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,c=>{this._changedPointerPositions.push({id:c.identifier,x:(c.clientX-n.left)/n.scaleX,y:(c.clientY-n.top)/n.scaleY})})):(s=(e.clientX-n.left)/n.scaleX,i=(e.clientY-n.top)/n.scaleY,this.pointerPos={x:s,y:i},this._pointerPositions=[{x:s,y:i,id:he._getFirstPointerId(e)}],this._changedPointerPositions=[{x:s,y:i,id:he._getFirstPointerId(e)}])}_setPointerPosition(e){he.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Oo({width:this.width(),height:this.height()}),this.bufferHitCanvas=new Yg({pixelRatio:1,width:this.width(),height:this.height()}),!Qe.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return he.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};pA.prototype.nodeType=QC;Pn(pA);te.addGetterSetter(pA,"container");Qe.isBrowser&&document.addEventListener("visibilitychange",()=>{Sf.forEach(t=>{t.batchDraw()})});const Ix="hasShadow",Ox="shadowRGBA",Ux="patternImage",jx="linearGradient",Gx="radialGradient";let jp;function tg(){return jp||(jp=he.createCanvasElement().getContext("2d"),jp)}const Cf={};function $C(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function ew(t){t.stroke()}function tw(t){const e=this.attrs.fillRule;e?t.fill(e):t.fill()}function nw(t){t.stroke()}function rw(){this._clearCache(Ix)}function aw(){this._clearCache(Ox)}function iw(){this._clearCache(Ux)}function sw(){this._clearCache(jx)}function ow(){this._clearCache(Gx)}class Fe extends Ge{constructor(e){super(e);let n,s=0;for(;n=he.getHitColor(),!(n&&!(n in Cf));)if(s++,s>=1e4){he.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),n=he.getRandomColor();break}this.colorKey=n,Cf[n]=this}getContext(){return he.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return he.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(Ix,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(Ux,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const n=tg().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(n&&n.setTransform){const s=new Qa;s.translate(this.fillPatternX(),this.fillPatternY()),s.rotate(Qe.getAngle(this.fillPatternRotation())),s.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),s.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const i=s.getMatrix(),c=typeof DOMMatrix>"u"?{a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]}:new DOMMatrix(i);n.setTransform(c)}return n}}_getLinearGradient(){return this._getCache(jx,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const n=tg(),s=this.fillLinearGradientStartPoint(),i=this.fillLinearGradientEndPoint(),c=n.createLinearGradient(s.x,s.y,i.x,i.y);for(let d=0;d<e.length;d+=2)c.addColorStop(e[d],e[d+1]);return c}}_getRadialGradient(){return this._getCache(Gx,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const n=tg(),s=this.fillRadialGradientStartPoint(),i=this.fillRadialGradientEndPoint(),c=n.createRadialGradient(s.x,s.y,this.fillRadialGradientStartRadius(),i.x,i.y,this.fillRadialGradientEndRadius());for(let d=0;d<e.length;d+=2)c.addColorStop(e[d],e[d+1]);return c}}getShadowRGBA(){return this._getCache(Ox,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=he.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const n=this.getStage();if(!n)return!1;const s=n.bufferHitCanvas;return s.getContext().clear(),this.drawHit(s,void 0,!0),s.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return Ge.prototype.destroy.call(this),delete Cf[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var n;if(!((n=this.attrs.perfectDrawEnabled)!==null&&n!==void 0?n:!0))return!1;const i=e||this.hasFill(),c=this.hasStroke(),d=this.getAbsoluteOpacity()!==1;if(i&&c&&d)return!0;const h=this.hasShadow(),p=this.shadowForStrokeEnabled();return!!(i&&c&&h&&p)}setStrokeHitEnabled(e){he.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let n=!1,s=this.getParent();for(;s;){if(s.isCached()){n=!0;break}s=s.getParent()}const i=e.skipTransform,c=e.relativeTo||n&&this.getStage()||void 0,d=this.getSelfRect(),p=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,u=d.width+p,A=d.height+p,y=!e.skipShadow&&this.hasShadow(),x=y?this.shadowOffsetX():0,S=y?this.shadowOffsetY():0,C=u+Math.abs(x),T=A+Math.abs(S),R=y&&this.shadowBlur()||0,D=C+R*2,M=T+R*2,P={width:D,height:M,x:-(p/2+R)+Math.min(x,0)+d.x,y:-(p/2+R)+Math.min(S,0)+d.y};return i?P:this._transformedRect(P,c)}drawScene(e,n,s){const i=this.getLayer(),c=e||i.getCanvas(),d=c.getContext(),h=this._getCanvasCache(),p=this.getSceneFunc(),u=this.hasShadow();let A;const y=n===this;if(!this.isVisible()&&!y)return this;if(h){d.save();const x=this.getAbsoluteTransform(n).getMatrix();return d.transform(x[0],x[1],x[2],x[3],x[4],x[5]),this._drawCachedSceneCanvas(d),d.restore(),this}if(!p)return this;if(d.save(),this._useBufferCanvas()){A=this.getStage();const x=s||A.bufferCanvas,S=x.getContext();s?(S.save(),S.setTransform(1,0,0,1,0,0),S.clearRect(0,0,x.width,x.height),S.restore()):S.clear(),S.save(),S._applyLineJoin(this),S._applyMiterLimit(this);const C=this.getAbsoluteTransform(n).getMatrix();S.transform(C[0],C[1],C[2],C[3],C[4],C[5]),p.call(this,S,this),S.restore();const T=x.pixelRatio;u&&d._applyShadow(this),y||(d._applyOpacity(this),d._applyGlobalCompositeOperation(this)),d.drawImage(x._canvas,x.x||0,x.y||0,x.width/T,x.height/T)}else{if(d._applyLineJoin(this),d._applyMiterLimit(this),!y){const x=this.getAbsoluteTransform(n).getMatrix();d.transform(x[0],x[1],x[2],x[3],x[4],x[5]),d._applyOpacity(this),d._applyGlobalCompositeOperation(this)}u&&d._applyShadow(this),p.call(this,d,this)}return d.restore(),this}drawHit(e,n,s=!1){if(!this.shouldDrawHit(n,s))return this;const i=this.getLayer(),c=e||i.hitCanvas,d=c&&c.getContext(),h=this.hitFunc()||this.sceneFunc(),p=this._getCanvasCache(),u=p&&p.hit;if(this.colorKey||he.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),u){d.save();const y=this.getAbsoluteTransform(n).getMatrix();return d.transform(y[0],y[1],y[2],y[3],y[4],y[5]),this._drawCachedHitCanvas(d),d.restore(),this}if(!h)return this;if(d.save(),d._applyLineJoin(this),d._applyMiterLimit(this),!(this===n)){const y=this.getAbsoluteTransform(n).getMatrix();d.transform(y[0],y[1],y[2],y[3],y[4],y[5])}return h.call(this,d,this),d.restore(),this}drawHitFromCache(e=0){const n=this._getCanvasCache(),s=this._getCachedSceneCanvas(),i=n.hit,c=i.getContext(),d=i.getWidth(),h=i.getHeight();c.clear(),c.drawImage(s._canvas,0,0,d,h);try{const p=c.getImageData(0,0,d,h),u=p.data,A=u.length,y=he._hexToRgb(this.colorKey);for(let x=0;x<A;x+=4)u[x+3]>e?(u[x]=y.r,u[x+1]=y.g,u[x+2]=y.b,u[x+3]=255):u[x+3]=0;c.putImageData(p,0,0)}catch(p){he.error("Unable to draw hit graph from cached scene canvas. "+p.message)}return this}hasPointerCapture(e){return Ex(e,this)}setPointerCapture(e){Tx(e,this)}releaseCapture(e){bf(e)}}Fe.prototype._fillFunc=$C;Fe.prototype._strokeFunc=ew;Fe.prototype._fillFuncHit=tw;Fe.prototype._strokeFuncHit=nw;Fe.prototype._centroid=!1;Fe.prototype.nodeType="Shape";Pn(Fe);Fe.prototype.eventListeners={};Fe.prototype.on.call(Fe.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",rw);Fe.prototype.on.call(Fe.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",aw);Fe.prototype.on.call(Fe.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",iw);Fe.prototype.on.call(Fe.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",sw);Fe.prototype.on.call(Fe.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",ow);te.addGetterSetter(Fe,"stroke",void 0,wx());te.addGetterSetter(Fe,"strokeWidth",2,Xe());te.addGetterSetter(Fe,"fillAfterStrokeEnabled",!1);te.addGetterSetter(Fe,"hitStrokeWidth","auto",Vg());te.addGetterSetter(Fe,"strokeHitEnabled",!0,zi());te.addGetterSetter(Fe,"perfectDrawEnabled",!0,zi());te.addGetterSetter(Fe,"shadowForStrokeEnabled",!0,zi());te.addGetterSetter(Fe,"lineJoin");te.addGetterSetter(Fe,"lineCap");te.addGetterSetter(Fe,"miterLimit");te.addGetterSetter(Fe,"sceneFunc");te.addGetterSetter(Fe,"hitFunc");te.addGetterSetter(Fe,"dash");te.addGetterSetter(Fe,"dashOffset",0,Xe());te.addGetterSetter(Fe,"shadowColor",void 0,zl());te.addGetterSetter(Fe,"shadowBlur",0,Xe());te.addGetterSetter(Fe,"shadowOpacity",1,Xe());te.addComponentsGetterSetter(Fe,"shadowOffset",["x","y"]);te.addGetterSetter(Fe,"shadowOffsetX",0,Xe());te.addGetterSetter(Fe,"shadowOffsetY",0,Xe());te.addGetterSetter(Fe,"fillPatternImage");te.addGetterSetter(Fe,"fill",void 0,wx());te.addGetterSetter(Fe,"fillPatternX",0,Xe());te.addGetterSetter(Fe,"fillPatternY",0,Xe());te.addGetterSetter(Fe,"fillLinearGradientColorStops");te.addGetterSetter(Fe,"strokeLinearGradientColorStops");te.addGetterSetter(Fe,"fillRadialGradientStartRadius",0);te.addGetterSetter(Fe,"fillRadialGradientEndRadius",0);te.addGetterSetter(Fe,"fillRadialGradientColorStops");te.addGetterSetter(Fe,"fillPatternRepeat","repeat");te.addGetterSetter(Fe,"fillEnabled",!0);te.addGetterSetter(Fe,"strokeEnabled",!0);te.addGetterSetter(Fe,"shadowEnabled",!0);te.addGetterSetter(Fe,"dashEnabled",!0);te.addGetterSetter(Fe,"strokeScaleEnabled",!0);te.addGetterSetter(Fe,"fillPriority","color");te.addComponentsGetterSetter(Fe,"fillPatternOffset",["x","y"]);te.addGetterSetter(Fe,"fillPatternOffsetX",0,Xe());te.addGetterSetter(Fe,"fillPatternOffsetY",0,Xe());te.addComponentsGetterSetter(Fe,"fillPatternScale",["x","y"]);te.addGetterSetter(Fe,"fillPatternScaleX",1,Xe());te.addGetterSetter(Fe,"fillPatternScaleY",1,Xe());te.addComponentsGetterSetter(Fe,"fillLinearGradientStartPoint",["x","y"]);te.addComponentsGetterSetter(Fe,"strokeLinearGradientStartPoint",["x","y"]);te.addGetterSetter(Fe,"fillLinearGradientStartPointX",0);te.addGetterSetter(Fe,"strokeLinearGradientStartPointX",0);te.addGetterSetter(Fe,"fillLinearGradientStartPointY",0);te.addGetterSetter(Fe,"strokeLinearGradientStartPointY",0);te.addComponentsGetterSetter(Fe,"fillLinearGradientEndPoint",["x","y"]);te.addComponentsGetterSetter(Fe,"strokeLinearGradientEndPoint",["x","y"]);te.addGetterSetter(Fe,"fillLinearGradientEndPointX",0);te.addGetterSetter(Fe,"strokeLinearGradientEndPointX",0);te.addGetterSetter(Fe,"fillLinearGradientEndPointY",0);te.addGetterSetter(Fe,"strokeLinearGradientEndPointY",0);te.addComponentsGetterSetter(Fe,"fillRadialGradientStartPoint",["x","y"]);te.addGetterSetter(Fe,"fillRadialGradientStartPointX",0);te.addGetterSetter(Fe,"fillRadialGradientStartPointY",0);te.addComponentsGetterSetter(Fe,"fillRadialGradientEndPoint",["x","y"]);te.addGetterSetter(Fe,"fillRadialGradientEndPointX",0);te.addGetterSetter(Fe,"fillRadialGradientEndPointY",0);te.addGetterSetter(Fe,"fillPatternRotation",0);te.addGetterSetter(Fe,"fillRule",void 0,zl());te.backCompat(Fe,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});const lw="beforeDraw",cw="draw",Hx=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],uw=Hx.length;let Fl=class extends Ya{constructor(e){super(e),this.canvas=new Oo,this.hitCanvas=new Yg({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),e<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[e+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){Ge.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!Ge.prototype.moveUp.call(this))return!1;const n=this.getStage();return!n||!n.content?!1:(n.content.removeChild(this.getNativeCanvasElement()),this.index<n.children.length-1?n.content.insertBefore(this.getNativeCanvasElement(),n.children[this.index+1].getCanvas()._canvas):n.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(Ge.prototype.moveDown.call(this)){const e=this.getStage();if(e){const n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(Ge.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const n=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),n[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return Ge.prototype.remove.call(this),e&&e.parentNode&&he._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:n}){return this.canvas.setSize(e,n),this.hitCanvas.setSize(e,n),this._setSmoothEnabled(),this}_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&he.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),Ge.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){he.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){he.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,he.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let n=1,s=!1;for(;;){for(let i=0;i<uw;i++){const c=Hx[i],d=this._getIntersection({x:e.x+c.x*n,y:e.y+c.y*n}),h=d.shape;if(h)return h;if(s=!!d.antialiased,!d.antialiased)break}if(s)n+=1;else return null}}_getIntersection(e){const n=this.hitCanvas.pixelRatio,s=this.hitCanvas.context.getImageData(Math.round(e.x*n),Math.round(e.y*n),1,1).data,i=s[3];if(i===255){const c=he.getHitColorKey(s[0],s[1],s[2]),d=Cf[c];return d?{shape:d}:{antialiased:!0}}else if(i>0)return{antialiased:!0};return{}}drawScene(e,n,s){const i=this.getLayer(),c=e||i&&i.getCanvas();return this._fire(lw,{node:this}),this.clearBeforeDraw()&&c.getContext().clear(),Ya.prototype.drawScene.call(this,c,n,s),this._fire(cw,{node:this}),this}drawHit(e,n){const s=this.getLayer(),i=e||s&&s.hitCanvas;return s&&s.clearBeforeDraw()&&s.getHitCanvas().getContext().clear(),Ya.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){he.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return he.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;!!this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return he.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Fl.prototype.nodeType="Layer";Pn(Fl);te.addGetterSetter(Fl,"imageSmoothingEnabled",!0);te.addGetterSetter(Fl,"clearBeforeDraw",!0);te.addGetterSetter(Fl,"hitGraphEnabled",!0,zi());class Kg extends Fl{constructor(e){super(e),this.listening(!1),he.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}Kg.prototype.nodeType="FastLayer";Pn(Kg);let Ru=class extends Ya{_validateAdd(e){const n=e.getType();n!=="Group"&&n!=="Shape"&&he.throw("You may only add groups and shapes to groups.")}};Ru.prototype.nodeType="Group";Pn(Ru);const ng=(function(){return Ml.performance&&Ml.performance.now?function(){return Ml.performance.now()}:function(){return new Date().getTime()}})();class pi{constructor(e,n){this.id=pi.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:ng(),frameRate:0},this.func=e,this.setLayers(n)}setLayers(e){let n=[];return e&&(n=Array.isArray(e)?e:[e]),this.layers=n,this}getLayers(){return this.layers}addLayer(e){const n=this.layers,s=n.length;for(let i=0;i<s;i++)if(n[i]._id===e._id)return!1;return this.layers.push(e),!0}isRunning(){const n=pi.animations,s=n.length;for(let i=0;i<s;i++)if(n[i].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=ng(),pi._addAnimation(this),this}stop(){return pi._removeAnimation(this),this}_updateFrameObject(e){this.frame.timeDiff=e-this.frame.lastTime,this.frame.lastTime=e,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(e){this.animations.push(e),this._handleAnimation()}static _removeAnimation(e){const n=e.id,s=this.animations,i=s.length;for(let c=0;c<i;c++)if(s[c].id===n){this.animations.splice(c,1);break}}static _runFrames(){const e={},n=this.animations;for(let s=0;s<n.length;s++){const i=n[s],c=i.layers,d=i.func;i._updateFrameObject(ng());const h=c.length;let p;if(d?p=d.call(i,i.frame)!==!1:p=!0,!!p)for(let u=0;u<h;u++){const A=c[u];A._id!==void 0&&(e[A._id]=A)}}for(const s in e)e.hasOwnProperty(s)&&e[s].batchDraw()}static _animationLoop(){const e=pi;e.animations.length?(e._runFrames(),he.requestAnimFrame(e._animationLoop)):e.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,he.requestAnimFrame(this._animationLoop))}}pi.animations=[];pi.animIdCounter=0;pi.animRunning=!1;const dw={node:1,duration:1,easing:1,onFinish:1,yoyo:1},fw=1,g2=2,v2=3,y2=["fill","stroke","shadowColor"];let hw=0;class pw{constructor(e,n,s,i,c,d,h){this.prop=e,this.propFunc=n,this.begin=i,this._pos=i,this.duration=d,this._change=0,this.prevPos=0,this.yoyo=h,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=s,this._change=c-this.begin,this.pause()}fire(e){const n=this[e];n&&n()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=g2,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=v2,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===g2?this.setTime(e):this.state===v2&&this.setTime(this.duration-e)}pause(){this.state=fw,this.fire("onPause")}getTimer(){return new Date().getTime()}}class Cn{constructor(e){const n=this,s=e.node,i=s._id,c=e.easing||wf.Linear,d=!!e.yoyo;let h,p;typeof e.duration>"u"?h=.3:e.duration===0?h=.001:h=e.duration,this.node=s,this._id=hw++;const u=s.getLayer()||(s instanceof Qe.Stage?s.getLayers():null);u||he.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new pi(function(){n.tween.onEnterFrame()},u),this.tween=new pw(p,function(A){n._tweenFunc(A)},c,0,1,h*1e3,d),this._addListeners(),Cn.attrs[i]||(Cn.attrs[i]={}),Cn.attrs[i][this._id]||(Cn.attrs[i][this._id]={}),Cn.tweens[i]||(Cn.tweens[i]={});for(p in e)dw[p]===void 0&&this._addAttr(p,e[p]);this.reset(),this.onFinish=e.onFinish,this.onReset=e.onReset,this.onUpdate=e.onUpdate}_addAttr(e,n){const s=this.node,i=s._id;let c,d,h,p,u;const A=Cn.tweens[i][e];A&&delete Cn.attrs[i][A][e];let y=s.getAttr(e);if(he._isArray(n))if(c=[],d=Math.max(n.length,y.length),e==="points"&&n.length!==y.length&&(n.length>y.length?(p=y,y=he._prepareArrayForTween(y,n,s.closed())):(h=n,n=he._prepareArrayForTween(n,y,s.closed()))),e.indexOf("fill")===0)for(let x=0;x<d;x++)if(x%2===0)c.push(n[x]-y[x]);else{const S=he.colorToRGBA(y[x]);u=he.colorToRGBA(n[x]),y[x]=S,c.push({r:u.r-S.r,g:u.g-S.g,b:u.b-S.b,a:u.a-S.a})}else for(let x=0;x<d;x++)c.push(n[x]-y[x]);else y2.indexOf(e)!==-1?(y=he.colorToRGBA(y),u=he.colorToRGBA(n),c={r:u.r-y.r,g:u.g-y.g,b:u.b-y.b,a:u.a-y.a}):c=n-y;Cn.attrs[i][this._id][e]={start:y,diff:c,end:n,trueEnd:h,trueStart:p},Cn.tweens[i][e]=this._id}_tweenFunc(e){const n=this.node,s=Cn.attrs[n._id][this._id];let i,c,d,h,p,u,A,y;for(i in s){if(c=s[i],d=c.start,h=c.diff,y=c.end,he._isArray(d))if(p=[],A=Math.max(d.length,y.length),i.indexOf("fill")===0)for(u=0;u<A;u++)u%2===0?p.push((d[u]||0)+h[u]*e):p.push("rgba("+Math.round(d[u].r+h[u].r*e)+","+Math.round(d[u].g+h[u].g*e)+","+Math.round(d[u].b+h[u].b*e)+","+(d[u].a+h[u].a*e)+")");else for(u=0;u<A;u++)p.push((d[u]||0)+h[u]*e);else y2.indexOf(i)!==-1?p="rgba("+Math.round(d.r+h.r*e)+","+Math.round(d.g+h.g*e)+","+Math.round(d.b+h.b*e)+","+(d.a+h.a*e)+")":p=d+h*e;n.setAttr(i,p)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const e=this.node,n=Cn.attrs[e._id][this._id];n.points&&n.points.trueEnd&&e.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const e=this.node,n=Cn.attrs[e._id][this._id];n.points&&n.points.trueStart&&e.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(e){return this.tween.seek(e*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const e=this.node._id,n=this._id,s=Cn.tweens[e];this.pause(),this.anim&&this.anim.stop();for(const i in s)delete Cn.tweens[e][i];delete Cn.attrs[e][n],Cn.tweens[e]&&(Object.keys(Cn.tweens[e]).length===0&&delete Cn.tweens[e],Object.keys(Cn.attrs[e]).length===0&&delete Cn.attrs[e])}}Cn.attrs={};Cn.tweens={};Ge.prototype.to=function(t){const e=t.onFinish;t.node=this,t.onFinish=function(){this.destroy(),e&&e()},new Cn(t).play()};const wf={BackEaseIn(t,e,n,s){return n*(t/=s)*t*((1.70158+1)*t-1.70158)+e},BackEaseOut(t,e,n,s){return n*((t=t/s-1)*t*((1.70158+1)*t+1.70158)+1)+e},BackEaseInOut(t,e,n,s){let i=1.70158;return(t/=s/2)<1?n/2*(t*t*(((i*=1.525)+1)*t-i))+e:n/2*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)+e},ElasticEaseIn(t,e,n,s,i,c){let d=0;return t===0?e:(t/=s)===1?e+n:(c||(c=s*.3),!i||i<Math.abs(n)?(i=n,d=c/4):d=c/(2*Math.PI)*Math.asin(n/i),-(i*Math.pow(2,10*(t-=1))*Math.sin((t*s-d)*(2*Math.PI)/c))+e)},ElasticEaseOut(t,e,n,s,i,c){let d=0;return t===0?e:(t/=s)===1?e+n:(c||(c=s*.3),!i||i<Math.abs(n)?(i=n,d=c/4):d=c/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*t)*Math.sin((t*s-d)*(2*Math.PI)/c)+n+e)},ElasticEaseInOut(t,e,n,s,i,c){let d=0;return t===0?e:(t/=s/2)===2?e+n:(c||(c=s*(.3*1.5)),!i||i<Math.abs(n)?(i=n,d=c/4):d=c/(2*Math.PI)*Math.asin(n/i),t<1?-.5*(i*Math.pow(2,10*(t-=1))*Math.sin((t*s-d)*(2*Math.PI)/c))+e:i*Math.pow(2,-10*(t-=1))*Math.sin((t*s-d)*(2*Math.PI)/c)*.5+n+e)},BounceEaseOut(t,e,n,s){return(t/=s)<1/2.75?n*(7.5625*t*t)+e:t<2/2.75?n*(7.5625*(t-=1.5/2.75)*t+.75)+e:t<2.5/2.75?n*(7.5625*(t-=2.25/2.75)*t+.9375)+e:n*(7.5625*(t-=2.625/2.75)*t+.984375)+e},BounceEaseIn(t,e,n,s){return n-wf.BounceEaseOut(s-t,0,n,s)+e},BounceEaseInOut(t,e,n,s){return t<s/2?wf.BounceEaseIn(t*2,0,n,s)*.5+e:wf.BounceEaseOut(t*2-s,0,n,s)*.5+n*.5+e},EaseIn(t,e,n,s){return n*(t/=s)*t+e},EaseOut(t,e,n,s){return-n*(t/=s)*(t-2)+e},EaseInOut(t,e,n,s){return(t/=s/2)<1?n/2*t*t+e:-n/2*(--t*(t-2)-1)+e},StrongEaseIn(t,e,n,s){return n*(t/=s)*t*t*t*t+e},StrongEaseOut(t,e,n,s){return n*((t=t/s-1)*t*t*t*t+1)+e},StrongEaseInOut(t,e,n,s){return(t/=s/2)<1?n/2*t*t*t*t*t+e:n/2*((t-=2)*t*t*t*t+2)+e},Linear(t,e,n,s){return n*t/s+e}},Pl=he._assign(Qe,{Util:he,Transform:Qa,Node:Ge,Container:Ya,Stage:pA,stages:Sf,Layer:Fl,FastLayer:Kg,Group:Ru,DD:on,Shape:Fe,shapes:Cf,Animation:pi,Tween:Cn,Easings:wf,Context:fA,Canvas:Qg});class Zs extends Fe{_sceneFunc(e){const n=Qe.getAngle(this.angle()),s=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,n,s),e.arc(0,0,this.innerRadius(),n,0,!s),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),n=this.outerRadius(),s=this.clockwise(),i=Qe.getAngle(s?360-this.angle():this.angle()),c=Math.cos(Math.min(i,Math.PI)),d=1,h=Math.sin(Math.min(Math.max(Math.PI,i),3*Math.PI/2)),p=Math.sin(Math.min(i,Math.PI/2)),u=c*(c>0?e:n),A=d*n,y=h*(h>0?e:n),x=p*(p>0?n:e);return{x:u,y:s?-1*x:y,width:A-u,height:x-y}}}Zs.prototype._centroid=!0;Zs.prototype.className="Arc";Zs.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"];Pn(Zs);te.addGetterSetter(Zs,"innerRadius",0,Xe());te.addGetterSetter(Zs,"outerRadius",0,Xe());te.addGetterSetter(Zs,"angle",0,Xe());te.addGetterSetter(Zs,"clockwise",!1,zi());function Lg(t,e,n,s,i,c,d){const h=Math.sqrt(Math.pow(n-t,2)+Math.pow(s-e,2)),p=Math.sqrt(Math.pow(i-n,2)+Math.pow(c-s,2)),u=d*h/(h+p),A=d*p/(h+p),y=n-u*(i-t),x=s-u*(c-e),S=n+A*(i-t),C=s+A*(c-e);return[y,x,S,C]}function x2(t,e){const n=t.length,s=[];for(let i=2;i<n-2;i+=2){const c=Lg(t[i-2],t[i-1],t[i],t[i+1],t[i+2],t[i+3],e);isNaN(c[0])||(s.push(c[0]),s.push(c[1]),s.push(t[i]),s.push(t[i+1]),s.push(c[2]),s.push(c[3]))}return s}function Aw(t){const e=[[t[0],t[2],t[4],t[6]],[t[1],t[3],t[5],t[7]]],n=[];for(const s of e){const i=-3*s[0]+9*s[1]-9*s[2]+3*s[3];if(i!==0){const c=6*s[0]-12*s[1]+6*s[2],d=-3*s[0]+3*s[1],h=c*c-4*i*d;if(h>=0){const p=Math.sqrt(h);n.push((-c+p)/(2*i)),n.push((-c-p)/(2*i))}}}return n.filter(s=>s>0&&s<1).flatMap(s=>e.map(i=>{const c=1-s;return c*c*c*i[0]+3*c*c*s*i[1]+3*c*s*s*i[2]+s*s*s*i[3]}))}let $s=class extends Fe{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const n=this.points(),s=n.length,i=this.tension(),c=this.closed(),d=this.bezier();if(!s)return;let h=0;if(e.beginPath(),e.moveTo(n[0],n[1]),i!==0&&s>4){const p=this.getTensionPoints(),u=p.length;for(h=c?0:4,c||e.quadraticCurveTo(p[0],p[1],p[2],p[3]);h<u-2;)e.bezierCurveTo(p[h++],p[h++],p[h++],p[h++],p[h++],p[h++]);c||e.quadraticCurveTo(p[u-2],p[u-1],n[s-2],n[s-1])}else if(d)for(h=2;h<s;)e.bezierCurveTo(n[h++],n[h++],n[h++],n[h++],n[h++],n[h++]);else for(h=2;h<s;h+=2)e.lineTo(n[h],n[h+1]);c?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():x2(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),n=e.length,s=this.tension(),i=Lg(e[n-2],e[n-1],e[0],e[1],e[2],e[3],s),c=Lg(e[n-4],e[n-3],e[n-2],e[n-1],e[0],e[1],s),d=x2(e,s);return[i[2],i[3]].concat(d).concat([c[0],c[1],e[n-2],e[n-1],c[2],c[3],i[0],i[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...Aw(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let n=e[0],s=e[0],i=e[1],c=e[1],d,h;for(let p=0;p<e.length/2;p++)d=e[p*2],h=e[p*2+1],n=Math.min(n,d),s=Math.max(s,d),i=Math.min(i,h),c=Math.max(c,h);return{x:n,y:i,width:s-n,height:c-i}}};$s.prototype.className="Line";$s.prototype._attrsAffectingSize=["points","bezier","tension"];Pn($s);te.addGetterSetter($s,"closed",!1);te.addGetterSetter($s,"bezier",!1);te.addGetterSetter($s,"tension",0,Xe());te.addGetterSetter($s,"points",[],kC());const mw=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],gw=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],vw=[[1],[1,1],[1,2,1],[1,3,3,1]],b2=(t,e,n)=>{let s,i;const d=n/2;s=0;for(let h=0;h<20;h++)i=d*mw[20][h]+d,s+=gw[20][h]*yw(t,e,i);return d*s},S2=(t,e,n)=>{n===void 0&&(n=1);const s=t[0]-2*t[1]+t[2],i=e[0]-2*e[1]+e[2],c=2*t[1]-2*t[0],d=2*e[1]-2*e[0],h=4*(s*s+i*i),p=4*(s*c+i*d),u=c*c+d*d;if(h===0)return n*Math.sqrt(Math.pow(t[2]-t[0],2)+Math.pow(e[2]-e[0],2));const A=p/(2*h),y=u/h,x=n+A,S=y-A*A,C=x*x+S>0?Math.sqrt(x*x+S):0,T=A*A+S>0?Math.sqrt(A*A+S):0,R=A+Math.sqrt(A*A+S)!==0?S*Math.log(Math.abs((x+C)/(A+T))):0;return Math.sqrt(h)/2*(x*C-A*T+R)};function yw(t,e,n){const s=kg(1,n,t),i=kg(1,n,e),c=s*s+i*i;return Math.sqrt(c)}const kg=(t,e,n)=>{const s=n.length-1;let i,c;if(s===0)return 0;if(t===0){c=0;for(let d=0;d<=s;d++)c+=vw[s][d]*Math.pow(1-e,s-d)*Math.pow(e,d)*n[d];return c}else{i=new Array(s);for(let d=0;d<s;d++)i[d]=s*(n[d+1]-n[d]);return kg(t-1,e,i)}},C2=(t,e,n)=>{let s=1,i=t/e,c=(t-n(i))/e,d=0;for(;s>.001;){const h=n(i+c),p=Math.abs(t-h)/e;if(p<s)s=p,i+=c;else{const u=n(i-c),A=Math.abs(t-u)/e;A<s?(s=A,i-=c):c/=2}if(d++,d>500)break}return i};class wn extends Fe{constructor(e){super(e),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=wn.parsePathData(this.data()),this.pathLength=wn.getPathLength(this.dataArray)}_sceneFunc(e){const n=this.dataArray;e.beginPath();let s=!1;for(let i=0;i<n.length;i++){const c=n[i].command,d=n[i].points;switch(c){case"L":e.lineTo(d[0],d[1]);break;case"M":e.moveTo(d[0],d[1]);break;case"C":e.bezierCurveTo(d[0],d[1],d[2],d[3],d[4],d[5]);break;case"Q":e.quadraticCurveTo(d[0],d[1],d[2],d[3]);break;case"A":const h=d[0],p=d[1],u=d[2],A=d[3],y=d[4],x=d[5],S=d[6],C=d[7],T=u>A?u:A,R=u>A?1:u/A,D=u>A?A/u:1;e.translate(h,p),e.rotate(S),e.scale(R,D),e.arc(0,0,T,y,y+x,1-C),e.scale(1/R,1/D),e.rotate(-S),e.translate(-h,-p);break;case"z":s=!0,e.closePath();break}}!s&&!this.hasFill()?e.strokeShape(this):e.fillStrokeShape(this)}getSelfRect(){let e=[];this.dataArray.forEach(function(p){if(p.command==="A"){const u=p.points[4],A=p.points[5],y=p.points[4]+A;let x=Math.PI/180;if(Math.abs(u-y)<x&&(x=Math.abs(u-y)),A<0)for(let S=u-x;S>y;S-=x){const C=wn.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],S,0);e.push(C.x,C.y)}else for(let S=u+x;S<y;S+=x){const C=wn.getPointOnEllipticalArc(p.points[0],p.points[1],p.points[2],p.points[3],S,0);e.push(C.x,C.y)}}else if(p.command==="C")for(let u=0;u<=1;u+=.01){const A=wn.getPointOnCubicBezier(u,p.start.x,p.start.y,p.points[0],p.points[1],p.points[2],p.points[3],p.points[4],p.points[5]);e.push(A.x,A.y)}else e=e.concat(p.points)});let n=e[0],s=e[0],i=e[1],c=e[1],d,h;for(let p=0;p<e.length/2;p++)d=e[p*2],h=e[p*2+1],isNaN(d)||(n=Math.min(n,d),s=Math.max(s,d)),isNaN(h)||(i=Math.min(i,h),c=Math.max(c,h));return{x:n,y:i,width:s-n,height:c-i}}getLength(){return this.pathLength}getPointAtLength(e){return wn.getPointAtLengthOfDataArray(e,this.dataArray)}static getLineLength(e,n,s,i){return Math.sqrt((s-e)*(s-e)+(i-n)*(i-n))}static getPathLength(e){let n=0;for(let s=0;s<e.length;++s)n+=e[s].pathLength;return n}static getPointAtLengthOfDataArray(e,n){let s,i=0,c=n.length;if(!c)return null;for(;i<c&&e>n[i].pathLength;)e-=n[i].pathLength,++i;if(i===c)return s=n[i-1].points.slice(-2),{x:s[0],y:s[1]};if(e<.01)return n[i].command==="M"?(s=n[i].points.slice(0,2),{x:s[0],y:s[1]}):{x:n[i].start.x,y:n[i].start.y};const d=n[i],h=d.points;switch(d.command){case"L":return wn.getPointOnLine(e,d.start.x,d.start.y,h[0],h[1]);case"C":return wn.getPointOnCubicBezier(C2(e,wn.getPathLength(n),T=>b2([d.start.x,h[0],h[2],h[4]],[d.start.y,h[1],h[3],h[5]],T)),d.start.x,d.start.y,h[0],h[1],h[2],h[3],h[4],h[5]);case"Q":return wn.getPointOnQuadraticBezier(C2(e,wn.getPathLength(n),T=>S2([d.start.x,h[0],h[2]],[d.start.y,h[1],h[3]],T)),d.start.x,d.start.y,h[0],h[1],h[2],h[3]);case"A":const p=h[0],u=h[1],A=h[2],y=h[3],x=h[5],S=h[6];let C=h[4];return C+=x*e/d.pathLength,wn.getPointOnEllipticalArc(p,u,A,y,C,S)}return null}static getPointOnLine(e,n,s,i,c,d,h){d=d??n,h=h??s;const p=this.getLineLength(n,s,i,c);if(p<1e-10)return{x:n,y:s};if(i===n)return{x:d,y:h+(c>s?e:-e)};const u=(c-s)/(i-n),A=Math.sqrt(e*e/(1+u*u))*(i<n?-1:1),y=u*A;if(Math.abs(h-s-u*(d-n))<1e-10)return{x:d+A,y:h+y};const x=((d-n)*(i-n)+(h-s)*(c-s))/(p*p),S=n+x*(i-n),C=s+x*(c-s),T=this.getLineLength(d,h,S,C),R=Math.sqrt(e*e-T*T),D=Math.sqrt(R*R/(1+u*u))*(i<n?-1:1),M=u*D;return{x:S+D,y:C+M}}static getPointOnCubicBezier(e,n,s,i,c,d,h,p,u){function A(R){return R*R*R}function y(R){return 3*R*R*(1-R)}function x(R){return 3*R*(1-R)*(1-R)}function S(R){return(1-R)*(1-R)*(1-R)}const C=p*A(e)+d*y(e)+i*x(e)+n*S(e),T=u*A(e)+h*y(e)+c*x(e)+s*S(e);return{x:C,y:T}}static getPointOnQuadraticBezier(e,n,s,i,c,d,h){function p(S){return S*S}function u(S){return 2*S*(1-S)}function A(S){return(1-S)*(1-S)}const y=d*p(e)+i*u(e)+n*A(e),x=h*p(e)+c*u(e)+s*A(e);return{x:y,y:x}}static getPointOnEllipticalArc(e,n,s,i,c,d){const h=Math.cos(d),p=Math.sin(d),u={x:s*Math.cos(c),y:i*Math.sin(c)};return{x:e+(u.x*h-u.y*p),y:n+(u.x*p+u.y*h)}}static parsePathData(e){if(!e)return[];let n=e;const s=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let y=0;y<s.length;y++)n=n.replace(new RegExp(s[y],"g"),"|"+s[y]);const i=n.split("|"),c=[],d=[];let h=0,p=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let A;for(let y=1;y<i.length;y++){let x=i[y],S=x.charAt(0);for(x=x.slice(1),d.length=0;A=u.exec(x);)d.push(A[0]);let C=[],T=S==="A"||S==="a"?0:-1;for(let R=0,D=d.length;R<D;R++){const M=d[R];if(M==="00"){C.push(0,0),T>=0&&(T+=2,T>=7&&(T-=7));continue}if(T>=0){if(T===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(M)){C.push(parseInt(M[0],10)),C.push(parseInt(M[1],10)),C.push(parseFloat(M.slice(2))),T+=3,T>=7&&(T-=7);continue}if(M==="11"||M==="10"||M==="01"){C.push(parseInt(M[0],10)),C.push(parseInt(M[1],10)),T+=2,T>=7&&(T-=7);continue}if(M==="0"||M==="1"){C.push(parseInt(M,10)),T+=1,T>=7&&(T-=7);continue}}else if(T===4){if(/^[01]\d+(?:\.\d+)?$/.test(M)){C.push(parseInt(M[0],10)),C.push(parseFloat(M.slice(1))),T+=2,T>=7&&(T-=7);continue}if(M==="0"||M==="1"){C.push(parseInt(M,10)),T+=1,T>=7&&(T-=7);continue}}const P=parseFloat(M);isNaN(P)?C.push(0):C.push(P),T+=1,T>=7&&(T-=7)}else{const P=parseFloat(M);isNaN(P)?C.push(0):C.push(P)}}for(;C.length>0&&!isNaN(C[0]);){let R="",D=[];const M=h,P=p;let O,I,Y,K,q,Q,V,ge,X,se;switch(S){case"l":h+=C.shift(),p+=C.shift(),R="L",D.push(h,p);break;case"L":h=C.shift(),p=C.shift(),D.push(h,p);break;case"m":const L=C.shift(),ne=C.shift();if(h+=L,p+=ne,R="M",c.length>2&&c[c.length-1].command==="z"){for(let le=c.length-2;le>=0;le--)if(c[le].command==="M"){h=c[le].points[0]+L,p=c[le].points[1]+ne;break}}D.push(h,p),S="l";break;case"M":h=C.shift(),p=C.shift(),R="M",D.push(h,p),S="L";break;case"h":h+=C.shift(),R="L",D.push(h,p);break;case"H":h=C.shift(),R="L",D.push(h,p);break;case"v":p+=C.shift(),R="L",D.push(h,p);break;case"V":p=C.shift(),R="L",D.push(h,p);break;case"C":D.push(C.shift(),C.shift(),C.shift(),C.shift()),h=C.shift(),p=C.shift(),D.push(h,p);break;case"c":D.push(h+C.shift(),p+C.shift(),h+C.shift(),p+C.shift()),h+=C.shift(),p+=C.shift(),R="C",D.push(h,p);break;case"S":I=h,Y=p,O=c[c.length-1],O.command==="C"&&(I=h+(h-O.points[2]),Y=p+(p-O.points[3])),D.push(I,Y,C.shift(),C.shift()),h=C.shift(),p=C.shift(),R="C",D.push(h,p);break;case"s":I=h,Y=p,O=c[c.length-1],O.command==="C"&&(I=h+(h-O.points[2]),Y=p+(p-O.points[3])),D.push(I,Y,h+C.shift(),p+C.shift()),h+=C.shift(),p+=C.shift(),R="C",D.push(h,p);break;case"Q":D.push(C.shift(),C.shift()),h=C.shift(),p=C.shift(),D.push(h,p);break;case"q":D.push(h+C.shift(),p+C.shift()),h+=C.shift(),p+=C.shift(),R="Q",D.push(h,p);break;case"T":I=h,Y=p,O=c[c.length-1],O.command==="Q"&&(I=h+(h-O.points[0]),Y=p+(p-O.points[1])),h=C.shift(),p=C.shift(),R="Q",D.push(I,Y,h,p);break;case"t":I=h,Y=p,O=c[c.length-1],O.command==="Q"&&(I=h+(h-O.points[0]),Y=p+(p-O.points[1])),h+=C.shift(),p+=C.shift(),R="Q",D.push(I,Y,h,p);break;case"A":K=C.shift(),q=C.shift(),Q=C.shift(),V=C.shift(),ge=C.shift(),X=h,se=p,h=C.shift(),p=C.shift(),R="A",D=this.convertEndpointToCenterParameterization(X,se,h,p,V,ge,K,q,Q);break;case"a":K=C.shift(),q=C.shift(),Q=C.shift(),V=C.shift(),ge=C.shift(),X=h,se=p,h+=C.shift(),p+=C.shift(),R="A",D=this.convertEndpointToCenterParameterization(X,se,h,p,V,ge,K,q,Q);break}c.push({command:R||S,points:D,start:{x:M,y:P},pathLength:this.calcLength(M,P,R||S,D)})}(S==="z"||S==="Z")&&c.push({command:"z",points:[],start:void 0,pathLength:0})}return c}static calcLength(e,n,s,i){let c,d,h,p;const u=wn;switch(s){case"L":return u.getLineLength(e,n,i[0],i[1]);case"C":return b2([e,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return S2([e,i[0],i[2]],[n,i[1],i[3]],1);case"A":c=0;const A=i[4],y=i[5],x=i[4]+y;let S=Math.PI/180;if(Math.abs(A-x)<S&&(S=Math.abs(A-x)),d=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],A,0),y<0)for(p=A-S;p>x;p-=S)h=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],p,0),c+=u.getLineLength(d.x,d.y,h.x,h.y),d=h;else for(p=A+S;p<x;p+=S)h=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],p,0),c+=u.getLineLength(d.x,d.y,h.x,h.y),d=h;return h=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],x,0),c+=u.getLineLength(d.x,d.y,h.x,h.y),c}return 0}static convertEndpointToCenterParameterization(e,n,s,i,c,d,h,p,u){const A=u*(Math.PI/180),y=Math.cos(A)*(e-s)/2+Math.sin(A)*(n-i)/2,x=-1*Math.sin(A)*(e-s)/2+Math.cos(A)*(n-i)/2,S=y*y/(h*h)+x*x/(p*p);S>1&&(h*=Math.sqrt(S),p*=Math.sqrt(S));let C=Math.sqrt((h*h*(p*p)-h*h*(x*x)-p*p*(y*y))/(h*h*(x*x)+p*p*(y*y)));c===d&&(C*=-1),isNaN(C)&&(C=0);const T=C*h*x/p,R=C*-p*y/h,D=(e+s)/2+Math.cos(A)*T-Math.sin(A)*R,M=(n+i)/2+Math.sin(A)*T+Math.cos(A)*R,P=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},O=function(V,ge){return(V[0]*ge[0]+V[1]*ge[1])/(P(V)*P(ge))},I=function(V,ge){return(V[0]*ge[1]<V[1]*ge[0]?-1:1)*Math.acos(O(V,ge))},Y=I([1,0],[(y-T)/h,(x-R)/p]),K=[(y-T)/h,(x-R)/p],q=[(-1*y-T)/h,(-1*x-R)/p];let Q=I(K,q);return O(K,q)<=-1&&(Q=Math.PI),O(K,q)>=1&&(Q=0),d===0&&Q>0&&(Q=Q-2*Math.PI),d===1&&Q<0&&(Q=Q+2*Math.PI),[D,M,h,p,Y,Q,A,d]}}wn.prototype.className="Path";wn.prototype._attrsAffectingSize=["data"];Pn(wn);te.addGetterSetter(wn,"data");let Il=class extends $s{_sceneFunc(e){super._sceneFunc(e);const n=Math.PI*2,s=this.points();let i=s;const c=this.tension()!==0&&s.length>4;c&&(i=this.getTensionPoints());const d=this.pointerLength(),h=s.length;let p,u;if(c){const x=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],s[h-2],s[h-1]],S=wn.calcLength(i[i.length-4],i[i.length-3],"C",x),C=wn.getPointOnQuadraticBezier(Math.min(1,1-d/S),x[0],x[1],x[2],x[3],x[4],x[5]);p=s[h-2]-C.x,u=s[h-1]-C.y}else p=s[h-2]-s[h-4],u=s[h-1]-s[h-3];const A=(Math.atan2(u,p)+n)%n,y=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(s[h-2],s[h-1]),e.rotate(A),e.moveTo(0,0),e.lineTo(-d,y/2),e.lineTo(-d,-y/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(s[0],s[1]),c?(p=(i[0]+i[2])/2-s[0],u=(i[1]+i[3])/2-s[1]):(p=s[2]-s[0],u=s[3]-s[1]),e.rotate((Math.atan2(-u,-p)+n)%n),e.moveTo(0,0),e.lineTo(-d,y/2),e.lineTo(-d,-y/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),n=this.pointerWidth()/2;return{x:e.x,y:e.y-n,width:e.width,height:e.height+n*2}}};Il.prototype.className="Arrow";Pn(Il);te.addGetterSetter(Il,"pointerLength",10,Xe());te.addGetterSetter(Il,"pointerWidth",10,Xe());te.addGetterSetter(Il,"pointerAtBeginning",!1);te.addGetterSetter(Il,"pointerAtEnding",!0);class Du extends Fe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}}Du.prototype._centroid=!0;Du.prototype.className="Circle";Du.prototype._attrsAffectingSize=["radius"];Pn(Du);te.addGetterSetter(Du,"radius",0,Xe());let Ho=class extends Fe{_sceneFunc(e){const n=this.radiusX(),s=this.radiusY();e.beginPath(),e.save(),n!==s&&e.scale(1,s/n),e.arc(0,0,n,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};Ho.prototype.className="Ellipse";Ho.prototype._centroid=!0;Ho.prototype._attrsAffectingSize=["radiusX","radiusY"];Pn(Ho);te.addComponentsGetterSetter(Ho,"radius",["x","y"]);te.addGetterSetter(Ho,"radiusX",0,Xe());te.addGetterSetter(Ho,"radiusY",0,Xe());let Fi=class Xx extends Fe{constructor(e){super(e),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const e=this.image();e&&e.complete||e&&e.readyState===4||e&&e.addEventListener&&e.addEventListener("load",this._loadListener)}_removeImageLoad(e){e&&e.removeEventListener&&e.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const e=!!this.cornerRadius(),n=this.hasShadow();return e&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(e){const n=this.getWidth(),s=this.getHeight(),i=this.cornerRadius(),c=this.attrs.image;let d;if(c){const h=this.attrs.cropWidth,p=this.attrs.cropHeight;h&&p?d=[c,this.cropX(),this.cropY(),h,p,0,0,n,s]:d=[c,0,0,n,s]}(this.hasFill()||this.hasStroke()||i)&&(e.beginPath(),i?he.drawRoundedRectPath(e,n,s,i):e.rect(0,0,n,s),e.closePath(),e.fillStrokeShape(this)),c&&(i&&e.clip(),e.drawImage.apply(e,d))}_hitFunc(e){const n=this.width(),s=this.height(),i=this.cornerRadius();e.beginPath(),i?he.drawRoundedRectPath(e,n,s,i):e.rect(0,0,n,s),e.closePath(),e.fillStrokeShape(this)}getWidth(){var e,n,s;return(s=(e=this.attrs.width)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&s!==void 0?s:0}getHeight(){var e,n,s;return(s=(e=this.attrs.height)!==null&&e!==void 0?e:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&s!==void 0?s:0}static fromURL(e,n,s=null){const i=he.createImageElement();i.onload=function(){const c=new Xx({image:i});n(c)},i.onerror=s,i.crossOrigin="Anonymous",i.src=e}};Fi.prototype.className="Image";Fi.prototype._attrsAffectingSize=["image"];Pn(Fi);te.addGetterSetter(Fi,"cornerRadius",0,hA(4));te.addGetterSetter(Fi,"image");te.addComponentsGetterSetter(Fi,"crop",["x","y","width","height"]);te.addGetterSetter(Fi,"cropX",0,Xe());te.addGetterSetter(Fi,"cropY",0,Xe());te.addGetterSetter(Fi,"cropWidth",0,Xe());te.addGetterSetter(Fi,"cropHeight",0,Xe());const Wx=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],xw="Change.konva",bw="none",Ng="up",Bg="right",Mg="down",Pg="left",Sw=Wx.length;class Jg extends Ru{constructor(e){super(e),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let n=this,s;const i=function(){n._sync()};for(s=0;s<Sw;s++)e.on(Wx[s]+xw,i)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),n=this.getTag(),s,i,c,d,h,p,u;if(e&&n){switch(s=e.width(),i=e.height(),c=n.pointerDirection(),d=n.pointerWidth(),u=n.pointerHeight(),h=0,p=0,c){case Ng:h=s/2,p=-1*u;break;case Bg:h=s+d,p=i/2;break;case Mg:h=s/2,p=i+u;break;case Pg:h=-1*d,p=i/2;break}n.setAttrs({x:-1*h,y:-1*p,width:s,height:i}),e.setAttrs({x:-1*h,y:-1*p})}}}Jg.prototype.className="Label";Pn(Jg);class Ol extends Fe{_sceneFunc(e){const n=this.width(),s=this.height(),i=this.pointerDirection(),c=this.pointerWidth(),d=this.pointerHeight(),h=this.cornerRadius();let p=0,u=0,A=0,y=0;typeof h=="number"?p=u=A=y=Math.min(h,n/2,s/2):(p=Math.min(h[0]||0,n/2,s/2),u=Math.min(h[1]||0,n/2,s/2),y=Math.min(h[2]||0,n/2,s/2),A=Math.min(h[3]||0,n/2,s/2)),e.beginPath(),e.moveTo(p,0),i===Ng&&(e.lineTo((n-c)/2,0),e.lineTo(n/2,-1*d),e.lineTo((n+c)/2,0)),e.lineTo(n-u,0),e.arc(n-u,u,u,Math.PI*3/2,0,!1),i===Bg&&(e.lineTo(n,(s-d)/2),e.lineTo(n+c,s/2),e.lineTo(n,(s+d)/2)),e.lineTo(n,s-y),e.arc(n-y,s-y,y,0,Math.PI/2,!1),i===Mg&&(e.lineTo((n+c)/2,s),e.lineTo(n/2,s+d),e.lineTo((n-c)/2,s)),e.lineTo(A,s),e.arc(A,s-A,A,Math.PI/2,Math.PI,!1),i===Pg&&(e.lineTo(0,(s+d)/2),e.lineTo(-1*c,s/2),e.lineTo(0,(s-d)/2)),e.lineTo(0,p),e.arc(p,p,p,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,n=0,s=this.pointerWidth(),i=this.pointerHeight(),c=this.pointerDirection(),d=this.width(),h=this.height();return c===Ng?(n-=i,h+=i):c===Mg?h+=i:c===Pg?(e-=s*1.5,d+=s):c===Bg&&(d+=s*1.5),{x:e,y:n,width:d,height:h}}}Ol.prototype.className="Tag";Pn(Ol);te.addGetterSetter(Ol,"pointerDirection",bw);te.addGetterSetter(Ol,"pointerWidth",0,Xe());te.addGetterSetter(Ol,"pointerHeight",0,Xe());te.addGetterSetter(Ol,"cornerRadius",0,hA(4));let kf=class extends Fe{_sceneFunc(e){const n=this.cornerRadius(),s=this.width(),i=this.height();e.beginPath(),n?he.drawRoundedRectPath(e,s,i,n):e.rect(0,0,s,i),e.closePath(),e.fillStrokeShape(this)}};kf.prototype.className="Rect";Pn(kf);te.addGetterSetter(kf,"cornerRadius",0,hA(4));class Xo extends Fe{_sceneFunc(e){const n=this._getPoints(),s=this.radius(),i=this.sides(),c=this.cornerRadius();if(e.beginPath(),c)he.drawRoundedPolygonPath(e,n,i,s,c);else{e.moveTo(n[0].x,n[0].y);for(let d=1;d<n.length;d++)e.lineTo(n[d].x,n[d].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,n=this.attrs.radius||0,s=[];for(let i=0;i<e;i++)s.push({x:n*Math.sin(i*2*Math.PI/e),y:-1*n*Math.cos(i*2*Math.PI/e)});return s}getSelfRect(){const e=this._getPoints();let n=e[0].x,s=e[0].x,i=e[0].y,c=e[0].y;return e.forEach(d=>{n=Math.min(n,d.x),s=Math.max(s,d.x),i=Math.min(i,d.y),c=Math.max(c,d.y)}),{x:n,y:i,width:s-n,height:c-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}Xo.prototype.className="RegularPolygon";Xo.prototype._centroid=!0;Xo.prototype._attrsAffectingSize=["radius"];Pn(Xo);te.addGetterSetter(Xo,"radius",0,Xe());te.addGetterSetter(Xo,"sides",0,Xe());te.addGetterSetter(Xo,"cornerRadius",0,hA(4));const w2=Math.PI*2;class Ul extends Fe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,w2,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),w2,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Ul.prototype.className="Ring";Ul.prototype._centroid=!0;Ul.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Pn(Ul);te.addGetterSetter(Ul,"innerRadius",0,Xe());te.addGetterSetter(Ul,"outerRadius",0,Xe());class hs extends Fe{constructor(e){super(e),this._updated=!0,this.anim=new pi(()=>{const n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const n=this.animation(),s=this.frameIndex(),i=s*4,c=this.animations()[n],d=this.frameOffsets(),h=c[i+0],p=c[i+1],u=c[i+2],A=c[i+3],y=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,u,A),e.closePath(),e.fillStrokeShape(this)),y)if(d){const x=d[n],S=s*2;e.drawImage(y,h,p,u,A,x[S+0],x[S+1],u,A)}else e.drawImage(y,h,p,u,A,0,0,u,A)}_hitFunc(e){const n=this.animation(),s=this.frameIndex(),i=s*4,c=this.animations()[n],d=this.frameOffsets(),h=c[i+2],p=c[i+3];if(e.beginPath(),d){const u=d[n],A=s*2;e.rect(u[A+0],u[A+1],h,p)}else e.rect(0,0,h,p);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),n=this.animation(),s=this.animations(),i=s[n],c=i.length/4;e<c-1?this.frameIndex(e+1):this.frameIndex(0)}}hs.prototype.className="Sprite";Pn(hs);te.addGetterSetter(hs,"animation");te.addGetterSetter(hs,"animations");te.addGetterSetter(hs,"frameOffsets");te.addGetterSetter(hs,"image");te.addGetterSetter(hs,"frameIndex",0,Xe());te.addGetterSetter(hs,"frameRate",17,Xe());te.backCompat(hs,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});class Wo extends Fe{_sceneFunc(e){const n=this.innerRadius(),s=this.outerRadius(),i=this.numPoints();e.beginPath(),e.moveTo(0,0-s);for(let c=1;c<i*2;c++){const d=c%2===0?s:n,h=d*Math.sin(c*Math.PI/i),p=-1*d*Math.cos(c*Math.PI/i);e.lineTo(h,p)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}}Wo.prototype.className="Star";Wo.prototype._centroid=!0;Wo.prototype._attrsAffectingSize=["innerRadius","outerRadius"];Pn(Wo);te.addGetterSetter(Wo,"numPoints",5,Xe());te.addGetterSetter(Wo,"innerRadius",0,Xe());te.addGetterSetter(Wo,"outerRadius",0,Xe());function Fo(t){return[...t].reduce((e,n,s,i)=>{if(new RegExp("\\p{Emoji}","u").test(n)){const c=i[s+1];c&&new RegExp("\\p{Emoji_Modifier}|\\u200D","u").test(c)?(e.push(n+c),i[s+1]=""):e.push(n)}else new RegExp("\\p{Regional_Indicator}{2}","u").test(n+(i[s+1]||""))?e.push(n+i[s+1]):s>0&&new RegExp("\\p{Mn}|\\p{Me}|\\p{Mc}","u").test(n)?e[e.length-1]+=n:n&&e.push(n);return e},[])}const gu="auto",Cw="center",Qx="inherit",cf="justify",ww="Change.konva",_w="2d",_2="-",Yx="left",Ew="text",Tw="Text",Rw="top",Dw="bottom",E2="middle",Vx="normal",Lw="px ",Gp=" ",kw="right",T2="rtl",Nw="word",Bw="char",R2="none",rg="…",qx=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],Mw=qx.length;function Pw(t){return t.split(",").map(e=>{e=e.trim();const n=e.indexOf(" ")>=0,s=e.indexOf('"')>=0||e.indexOf("'")>=0;return n&&!s&&(e=`"${e}"`),e}).join(", ")}let Hp;function ag(){return Hp||(Hp=he.createCanvasElement().getContext(_w),Hp)}function zw(t){t.fillText(this._partialText,this._partialTextX,this._partialTextY)}function Fw(t){t.setAttr("miterLimit",2),t.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function Iw(t){return t=t||{},!t.fillLinearGradientColorStops&&!t.fillRadialGradientColorStops&&!t.fillPatternImage&&(t.fill=t.fill||"black"),t}let _n=class extends Fe{constructor(e){super(Iw(e)),this._partialTextX=0,this._partialTextY=0;for(let n=0;n<Mw;n++)this.on(qx[n]+ww,this._setTextData);this._setTextData()}_sceneFunc(e){var n,s;const i=this.textArr,c=i.length;if(!this.text())return;let d=this.padding(),h=this.fontSize(),p=this.lineHeight()*h,u=this.verticalAlign(),A=this.direction(),y=0,x=this.align(),S=this.getWidth(),C=this.letterSpacing(),T=this.charRenderFunc(),R=this.fill(),D=this.textDecoration(),M=this.underlineOffset(),P=D.indexOf("underline")!==-1,O=D.indexOf("line-through")!==-1,I;A=A===Qx?e.direction:A;let Y=p/2,K=E2;if(!Qe.legacyTextRendering){const q=this.measureSize("M");K="alphabetic";const Q=(n=q.fontBoundingBoxAscent)!==null&&n!==void 0?n:q.actualBoundingBoxAscent,V=(s=q.fontBoundingBoxDescent)!==null&&s!==void 0?s:q.actualBoundingBoxDescent;Y=(Q-V)/2+p/2}for(A===T2&&e.setAttr("direction",A),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",K),e.setAttr("textAlign",Yx),u===E2?y=(this.getHeight()-c*p-d*2)/2:u===Dw&&(y=this.getHeight()-c*p-d*2),e.translate(d,y+d),I=0;I<c;I++){let q=0,Q=0;const V=i[I],ge=V.text,X=V.width,se=V.lastInParagraph;if(e.save(),x===kw?q+=S-X-d*2:x===Cw&&(q+=(S-X-d*2)/2),P){e.save(),e.beginPath();const ne=M??(Qe.legacyTextRendering?Math.round(h/2):Math.round(h/4)),le=q,pe=Y+Q+ne;e.moveTo(le,pe);const J=x===cf&&!se?S-d*2:X;e.lineTo(le+Math.round(J),pe),e.lineWidth=h/15;const ae=this._getLinearGradient();e.strokeStyle=ae||R,e.stroke(),e.restore()}const L=q;if(A!==T2&&(C!==0||x===cf||T)){const ne=ge.split(" ").length-1,le=Fo(ge);for(let pe=0;pe<le.length;pe++){const J=le[pe];if(J===" "&&!se&&x===cf&&(q+=(S-d*2-X)/ne),this._partialTextX=q,this._partialTextY=Y+Q,this._partialText=J,T){e.save();const re=i.slice(0,I).reduce((ee,Ee)=>ee+Fo(Ee.text).length,0),U=pe+re;T({char:J,index:U,x:q,y:Y+Q,lineIndex:I,column:pe,isLastInLine:se,width:this.measureSize(J).width,context:e})}e.fillStrokeShape(this),T&&e.restore(),q+=this.measureSize(J).width+C}}else C!==0&&e.setAttr("letterSpacing",`${C}px`),this._partialTextX=q,this._partialTextY=Y+Q,this._partialText=ge,e.fillStrokeShape(this);if(O){e.save(),e.beginPath();const ne=Qe.legacyTextRendering?0:-Math.round(h/4),le=L;e.moveTo(le,Y+Q+ne);const pe=x===cf&&!se?S-d*2:X;e.lineTo(le+Math.round(pe),Y+Q+ne),e.lineWidth=h/15;const J=this._getLinearGradient();e.strokeStyle=J||R,e.stroke(),e.restore()}e.restore(),c>1&&(Y+=p)}}_hitFunc(e){const n=this.getWidth(),s=this.getHeight();e.beginPath(),e.rect(0,0,n,s),e.closePath(),e.fillStrokeShape(this)}setText(e){const n=he._isString(e)?e:e==null?"":e+"";return this._setAttr(Ew,n),this}getWidth(){return this.attrs.width===gu||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===gu||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return he.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var n,s,i,c,d,h,p,u,A,y,x;let S=ag(),C=this.fontSize(),T;S.save(),S.font=this._getContextFont(),T=S.measureText(e),S.restore();const R=C/100;return{actualBoundingBoxAscent:(n=T.actualBoundingBoxAscent)!==null&&n!==void 0?n:71.58203125*R,actualBoundingBoxDescent:(s=T.actualBoundingBoxDescent)!==null&&s!==void 0?s:0,actualBoundingBoxLeft:(i=T.actualBoundingBoxLeft)!==null&&i!==void 0?i:-7.421875*R,actualBoundingBoxRight:(c=T.actualBoundingBoxRight)!==null&&c!==void 0?c:75.732421875*R,alphabeticBaseline:(d=T.alphabeticBaseline)!==null&&d!==void 0?d:0,emHeightAscent:(h=T.emHeightAscent)!==null&&h!==void 0?h:100*R,emHeightDescent:(p=T.emHeightDescent)!==null&&p!==void 0?p:-20*R,fontBoundingBoxAscent:(u=T.fontBoundingBoxAscent)!==null&&u!==void 0?u:91*R,fontBoundingBoxDescent:(A=T.fontBoundingBoxDescent)!==null&&A!==void 0?A:21*R,hangingBaseline:(y=T.hangingBaseline)!==null&&y!==void 0?y:72.80000305175781*R,ideographicBaseline:(x=T.ideographicBaseline)!==null&&x!==void 0?x:-21*R,width:T.width,height:C}}_getContextFont(){return this.fontStyle()+Gp+this.fontVariant()+Gp+(this.fontSize()+Lw)+Pw(this.fontFamily())}_addTextLine(e){this.align()===cf&&(e=e.trim());const s=this._getTextWidth(e);return this.textArr.push({text:e,width:s,lastInParagraph:!1})}_getTextWidth(e){const n=this.letterSpacing(),s=e.length;return ag().measureText(e).width+n*s}_setTextData(){let e=this.text().split(`
277
+ `),n=+this.fontSize(),s=0,i=this.lineHeight()*n,c=this.attrs.width,d=this.attrs.height,h=c!==gu&&c!==void 0,p=d!==gu&&d!==void 0,u=this.padding(),A=c-u*2,y=d-u*2,x=0,S=this.wrap(),C=S!==R2,T=S!==Bw&&C,R=this.ellipsis();this.textArr=[],ag().font=this._getContextFont();const D=R?this._getTextWidth(rg):0;for(let M=0,P=e.length;M<P;++M){let O=e[M],I=this._getTextWidth(O);if(h&&I>A)for(;O.length>0;){let Y=0,K=Fo(O).length,q="",Q=0;for(;Y<K;){const V=Y+K>>>1,ge=Fo(O),X=ge.slice(0,V+1).join(""),se=this._getTextWidth(X);(R&&p&&x+i>y?se+D:se)<=A?(Y=V+1,q=X,Q=se):K=V}if(q){if(T){const X=Fo(O),se=Fo(q),L=X[se.length],ne=L===Gp||L===_2;let le;if(ne&&Q<=A)le=se.length;else{const pe=se.lastIndexOf(Gp),J=se.lastIndexOf(_2);le=Math.max(pe,J)+1}le>0&&(Y=le,q=X.slice(0,Y).join(""),Q=this._getTextWidth(q))}if(q=q.trimRight(),this._addTextLine(q),s=Math.max(s,Q),x+=i,this._shouldHandleEllipsis(x)){this._tryToAddEllipsisToLastLine();break}if(O=Fo(O).slice(Y).join("").trimLeft(),O.length>0&&(I=this._getTextWidth(O),I<=A)){this._addTextLine(O),x+=i,s=Math.max(s,I);break}}else break}else this._addTextLine(O),x+=i,s=Math.max(s,I),this._shouldHandleEllipsis(x)&&M<P-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),p&&x+i>y)break}this.textHeight=n,this.textWidth=s}_shouldHandleEllipsis(e){const n=+this.fontSize(),s=this.lineHeight()*n,i=this.attrs.height,c=i!==gu&&i!==void 0,d=this.padding(),h=i-d*2;return!(this.wrap()!==R2)||c&&e+s>h}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,n=e!==gu&&e!==void 0,s=this.padding(),i=e-s*2,c=this.ellipsis(),d=this.textArr[this.textArr.length-1];!d||!c||(n&&(this._getTextWidth(d.text+rg)<i||(d.text=d.text.slice(0,d.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(d.text+rg))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,n=this.hasShadow();return e&&n?!0:super._useBufferCanvas()}};_n.prototype._fillFunc=zw;_n.prototype._strokeFunc=Fw;_n.prototype.className=Tw;_n.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"];Pn(_n);te.overWriteSetter(_n,"width",Vg());te.overWriteSetter(_n,"height",Vg());te.addGetterSetter(_n,"direction",Qx);te.addGetterSetter(_n,"fontFamily","Arial");te.addGetterSetter(_n,"fontSize",12,Xe());te.addGetterSetter(_n,"fontStyle",Vx);te.addGetterSetter(_n,"fontVariant",Vx);te.addGetterSetter(_n,"padding",0,Xe());te.addGetterSetter(_n,"align",Yx);te.addGetterSetter(_n,"verticalAlign",Rw);te.addGetterSetter(_n,"lineHeight",1,Xe());te.addGetterSetter(_n,"wrap",Nw);te.addGetterSetter(_n,"ellipsis",!1,zi());te.addGetterSetter(_n,"letterSpacing",0,Xe());te.addGetterSetter(_n,"text","",zl());te.addGetterSetter(_n,"textDecoration","");te.addGetterSetter(_n,"underlineOffset",void 0,Xe());te.addGetterSetter(_n,"charRenderFunc",void 0);const Ow="",Kx="normal";function Jx(t){t.fillText(this.partialText,0,0)}function Zx(t){t.strokeText(this.partialText,0,0)}class hr extends Fe{constructor(e){super(e),this.dummyCanvas=he.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return wn.getPathLength(this.dataArray)}_getPointAtLength(e){if(!this.attrs.data)return null;const n=this.pathLength;return e>n?null:wn.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=wn.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const n=this.textDecoration(),s=this.fill(),i=this.fontSize(),c=this.glyphInfo,d=n.indexOf("underline")!==-1,h=n.indexOf("line-through")!==-1;d&&e.beginPath();for(let p=0;p<c.length;p++){e.save();const u=c[p].p0;e.translate(u.x,u.y),e.rotate(c[p].rotation),this.partialText=c[p].text,e.fillStrokeShape(this),d&&(p===0&&e.moveTo(0,i/2+1),e.lineTo(c[p].width,i/2+1)),e.restore()}if(d&&(e.strokeStyle=s,e.lineWidth=i/20,e.stroke()),h){e.beginPath();for(let p=0;p<c.length;p++){e.save();const u=c[p].p0;e.translate(u.x,u.y),e.rotate(c[p].rotation),p===0&&e.moveTo(0,0),e.lineTo(c[p].width,0),e.restore()}e.strokeStyle=s,e.lineWidth=i/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const n=this.glyphInfo;if(n.length>=1){const s=n[0].p0;e.moveTo(s.x,s.y)}for(let s=0;s<n.length;s++){const i=n[s].p1;e.lineTo(i.x,i.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return he.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return _n.prototype.setText.call(this,e)}_getContextFont(){return _n.prototype._getContextFont.call(this)}_getTextSize(e){const s=this.dummyCanvas.getContext("2d");s.save(),s.font=this._getContextFont();const i=s.measureText(e);return s.restore(),{width:i.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=Fo(this.text()),n=[];let s=0;for(let y=0;y<e.length;y++)n.push({char:e[y],width:this._getTextSize(e[y]).width}),s+=n[y].width;const{height:i}=this._getTextSize(this.attrs.text);if(this.textWidth=s,this.textHeight=i,this.glyphInfo=[],!this.attrs.data)return null;const c=this.letterSpacing(),d=this.align(),h=this.kerningFunc(),p=Math.max(this.textWidth+((this.attrs.text||"").length-1)*c,0);let u=0;d==="center"&&(u=Math.max(0,this.pathLength/2-p/2)),d==="right"&&(u=Math.max(0,this.pathLength-p));let A=u;for(let y=0;y<n.length;y++){const x=this._getPointAtLength(A);if(!x)return;const S=n[y].char;let C=n[y].width+c;if(S===" "&&d==="justify"){const O=this.text().split(" ").length-1;C+=(this.pathLength-p)/O}const T=this._getPointAtLength(A+C);if(!T)return;const R=wn.getLineLength(x.x,x.y,T.x,T.y);let D=0;if(h)try{D=h(n[y-1].char,S)*this.fontSize()}catch{D=0}x.x+=D,T.x+=D,this.textWidth+=D;const M=wn.getPointOnLine(D+R/2,x.x,x.y,T.x,T.y),P=Math.atan2(T.y-x.y,T.x-x.x);this.glyphInfo.push({transposeX:M.x,transposeY:M.y,text:e[y],rotation:P,p0:x,p1:T,width:R}),A+=C}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(u){e.push(u.p0.x),e.push(u.p0.y),e.push(u.p1.x),e.push(u.p1.y)});let n=e[0]||0,s=e[0]||0,i=e[1]||0,c=e[1]||0,d,h;for(let u=0;u<e.length/2;u++)d=e[u*2],h=e[u*2+1],n=Math.min(n,d),s=Math.max(s,d),i=Math.min(i,h),c=Math.max(c,h);const p=this.fontSize();return{x:n-p/2,y:i-p/2,width:s-n+p,height:c-i+p}}destroy(){return he.releaseCanvas(this.dummyCanvas),super.destroy()}}hr.prototype._fillFunc=Jx;hr.prototype._strokeFunc=Zx;hr.prototype._fillFuncHit=Jx;hr.prototype._strokeFuncHit=Zx;hr.prototype.className="TextPath";hr.prototype._attrsAffectingSize=["text","fontSize","data"];Pn(hr);te.addGetterSetter(hr,"data");te.addGetterSetter(hr,"fontFamily","Arial");te.addGetterSetter(hr,"fontSize",12,Xe());te.addGetterSetter(hr,"fontStyle",Kx);te.addGetterSetter(hr,"align","left");te.addGetterSetter(hr,"letterSpacing",0,Xe());te.addGetterSetter(hr,"textBaseline","middle");te.addGetterSetter(hr,"fontVariant",Kx);te.addGetterSetter(hr,"text",Ow);te.addGetterSetter(hr,"textDecoration","");te.addGetterSetter(hr,"kerningFunc",void 0);const $x="tr-konva",Uw=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(t=>t+`.${$x}`).join(" "),D2="nodesRect",jw=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],Gw={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},Hw="ontouchstart"in Qe._global;function Xw(t,e,n){if(t==="rotater")return n;e+=he.degToRad(Gw[t]||0);const s=(he.radToDeg(e)%360+360)%360;return he._inRange(s,315+22.5,360)||he._inRange(s,0,22.5)?"ns-resize":he._inRange(s,45-22.5,45+22.5)?"nesw-resize":he._inRange(s,90-22.5,90+22.5)?"ew-resize":he._inRange(s,135-22.5,135+22.5)?"nwse-resize":he._inRange(s,180-22.5,180+22.5)?"ns-resize":he._inRange(s,225-22.5,225+22.5)?"nesw-resize":he._inRange(s,270-22.5,270+22.5)?"ew-resize":he._inRange(s,315-22.5,315+22.5)?"nwse-resize":(he.error("Transformer has unknown angle for cursor detection: "+s),"pointer")}const sA=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function Ww(t){return{x:t.x+t.width/2*Math.cos(t.rotation)+t.height/2*Math.sin(-t.rotation),y:t.y+t.height/2*Math.cos(t.rotation)+t.width/2*Math.sin(t.rotation)}}function e5(t,e,n){const s=n.x+(t.x-n.x)*Math.cos(e)-(t.y-n.y)*Math.sin(e),i=n.y+(t.x-n.x)*Math.sin(e)+(t.y-n.y)*Math.cos(e);return{...t,rotation:t.rotation+e,x:s,y:i}}function Qw(t,e){const n=Ww(t);return e5(t,e,n)}function Yw(t,e,n){let s=e;for(let i=0;i<t.length;i++){const c=Qe.getAngle(t[i]),d=Math.abs(c-e)%(Math.PI*2);Math.min(d,Math.PI*2-d)<n&&(s=c)}return s}let zg=0,Kt=class extends Ru{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(Uw,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return he.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return $x+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const n=e.filter(i=>i.isAncestorOf(this)?(he.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=n,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const c=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(i._attrsAffectingSize.length){const d=i._attrsAffectingSize.map(h=>h+"Change."+this._getEventNamespace()).join(" ");i.on(d,c)}i.on(jw.map(d=>d+`.${this._getEventNamespace()}`).join(" "),c),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,c),this._proxyDrag(i)}),this._resetTransformCache(),!!this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let n;e.on(`dragstart.${this._getEventNamespace()}`,s=>{n=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(s,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,s=>{if(!n)return;const i=e.getAbsolutePosition(),c=i.x-n.x,d=i.y-n.y;this.nodes().forEach(h=>{if(h===e||h.isDragging())return;const p=h.getAbsolutePosition();h.setAbsolutePosition({x:p.x+c,y:p.y+d}),h.startDrag(s)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(D2),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(D2,this.__getNodeRect)}__getNodeShape(e,n=this.rotation(),s){const i=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),c=e.getAbsoluteScale(s),d=e.getAbsolutePosition(s),h=i.x*c.x-e.offsetX()*c.x,p=i.y*c.y-e.offsetY()*c.y,u=(Qe.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),A={x:d.x+h*Math.cos(u)+p*Math.sin(-u),y:d.y+p*Math.cos(u)+h*Math.sin(u),width:i.width*c.x,height:i.height*c.y,rotation:u};return e5(A,-Qe.getAngle(n),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const A=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),y=[{x:A.x,y:A.y},{x:A.x+A.width,y:A.y},{x:A.x+A.width,y:A.y+A.height},{x:A.x,y:A.y+A.height}],x=u.getAbsoluteTransform();y.forEach(function(S){const C=x.point(S);n.push(C)})});const s=new Qa;s.rotate(-Qe.getAngle(this.rotation()));let i=1/0,c=1/0,d=-1/0,h=-1/0;n.forEach(function(u){const A=s.point(u);i===void 0&&(i=d=A.x,c=h=A.y),i=Math.min(i,A.x),c=Math.min(c,A.y),d=Math.max(d,A.x),h=Math.max(h,A.y)}),s.invert();const p=s.point({x:i,y:c});return{x:p.x,y:p.y,width:d-i,height:h-c,rotation:Qe.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),sA.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater")}_createAnchor(e){const n=new kf({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:Hw?10:"auto"}),s=this;n.on("mousedown touchstart",function(i){s._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{const i=Qe.getAngle(this.rotation()),c=this.rotateAnchorCursor(),d=Xw(e,i,c);n.getStage().content&&(n.getStage().content.style.cursor=d),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){const e=new Fe({name:"back",width:0,height:0,sceneFunc(n,s){const i=s.getParent(),c=i.padding(),d=s.width(),h=s.height();if(n.beginPath(),n.rect(-c,-c,d+c*2,h+c*2),i.rotateEnabled()&&i.rotateLineVisible()){const p=i.rotateAnchorAngle(),u=i.rotateAnchorOffset(),A=he.degToRad(p),y=Math.sin(A),x=-Math.cos(A),S=d/2,C=h/2;let T=1/0;x<0?T=Math.min(T,-C/x):x>0&&(T=Math.min(T,(h-C)/x)),y<0?T=Math.min(T,-S/y):y>0&&(T=Math.min(T,(d-S)/y));const R=S+y*T,D=C+x*T,M=he._sign(h),P=R+y*u*M,O=D+x*u*M;n.moveTo(R,D),n.lineTo(P,O)}n.fillStrokeShape(s)},hitFunc:(n,s)=>{if(!this.shouldOverdrawWholeArea())return;const i=this.padding();n.beginPath(),n.rect(-i,-i,s.width()+i*2,s.height()+i*2),n.fillStrokeShape(s)}});this.add(e),this._proxyDrag(e),e.on("dragstart",n=>{n.cancelBubble=!0}),e.on("dragmove",n=>{n.cancelBubble=!0}),e.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const n=this._getNodeRect(),s=n.width,i=n.height,c=Math.sqrt(Math.pow(s,2)+Math.pow(i,2));this.sin=Math.abs(i/c),this.cos=Math.abs(s/c),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const d=e.target.getAbsolutePosition(),h=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:h.x-d.x,y:h.y-d.y},zg++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(p=>{p._fire("transformstart",{evt:e.evt,target:p})})}_handleMouseMove(e){let n,s,i;const c=this.findOne("."+this._movingAnchorName),d=c.getStage();d.setPointersPositions(e);const h=d.getPointerPosition();let p={x:h.x-this._anchorDragOffset.x,y:h.y-this._anchorDragOffset.y};const u=c.getAbsolutePosition();this.anchorDragBoundFunc()&&(p=this.anchorDragBoundFunc()(u,p,e)),c.setAbsolutePosition(p);const A=c.getAbsolutePosition();if(u.x===A.x&&u.y===A.y)return;if(this._movingAnchorName==="rotater"){const M=this._getNodeRect();n=c.x()-M.width/2,s=-c.y()+M.height/2;const P=Qe.getAngle(this.rotateAnchorAngle());let O=Math.atan2(-s,n)+Math.PI/2-P;M.height<0&&(O-=Math.PI);const Y=Qe.getAngle(this.rotation())+O,K=Qe.getAngle(this.rotationSnapTolerance()),Q=Yw(this.rotationSnaps(),Y,K)-M.rotation,V=Qw(M,Q);this._fitNodesInto(V,e);return}const y=this.shiftBehavior();let x;y==="inverted"?x=this.keepRatio()&&!e.shiftKey:y==="none"?x=this.keepRatio():x=this.keepRatio()||e.shiftKey;let S=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(M.x-c.x(),2)+Math.pow(M.y-c.y(),2));const P=this.findOne(".top-left").x()>M.x?-1:1,O=this.findOne(".top-left").y()>M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,this.findOne(".top-left").x(M.x-n),this.findOne(".top-left").y(M.y-s)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(c.y());else if(this._movingAnchorName==="top-right"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(c.x()-M.x,2)+Math.pow(M.y-c.y(),2));const P=this.findOne(".top-right").x()<M.x?-1:1,O=this.findOne(".top-right").y()>M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,this.findOne(".top-right").x(M.x+n),this.findOne(".top-right").y(M.y-s)}var C=c.position();this.findOne(".top-left").y(C.y),this.findOne(".bottom-right").x(C.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(c.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(c.x());else if(this._movingAnchorName==="bottom-left"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(M.x-c.x(),2)+Math.pow(c.y()-M.y,2));const P=M.x<c.x()?-1:1,O=c.y()<M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,c.x(M.x-n),c.y(M.y+s)}C=c.position(),this.findOne(".top-left").x(C.x),this.findOne(".bottom-right").y(C.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(c.y());else if(this._movingAnchorName==="bottom-right"){if(x){const M=S?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};i=Math.sqrt(Math.pow(c.x()-M.x,2)+Math.pow(c.y()-M.y,2));const P=this.findOne(".bottom-right").x()<M.x?-1:1,O=this.findOne(".bottom-right").y()<M.y?-1:1;n=i*this.cos*P,s=i*this.sin*O,this.findOne(".bottom-right").x(M.x+n),this.findOne(".bottom-right").y(M.y+s)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(S=this.centeredScaling()||e.altKey,S){const M=this.findOne(".top-left"),P=this.findOne(".bottom-right"),O=M.x(),I=M.y(),Y=this.getWidth()-P.x(),K=this.getHeight()-P.y();P.move({x:-O,y:-I}),M.move({x:Y,y:K})}const T=this.findOne(".top-left").getAbsolutePosition();n=T.x,s=T.y;const R=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),D=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:n,y:s,width:R,height:D,rotation:Qe.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var n;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const s=this.getNode();zg--,this._fire("transformend",{evt:e,target:s}),(n=this.getLayer())===null||n===void 0||n.batchDraw(),s&&this._nodes.forEach(i=>{var c;i._fire("transformend",{evt:e,target:i}),(c=i.getLayer())===null||c===void 0||c.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,n){const s=this._getNodeRect(),i=1;if(he._inRange(e.width,-this.padding()*2-i,i)){this.update();return}if(he._inRange(e.height,-this.padding()*2-i,i)){this.update();return}const c=new Qa;if(c.rotate(Qe.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const x=c.point({x:-this.padding()*2,y:0});e.x+=x.x,e.y+=x.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const x=c.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const x=c.point({x:0,y:-this.padding()*2});e.x+=x.x,e.y+=x.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const x=c.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=x.x,this._anchorDragOffset.y-=x.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const x=this.boundBoxFunc()(s,e);x?e=x:he.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const d=1e7,h=new Qa;h.translate(s.x,s.y),h.rotate(s.rotation),h.scale(s.width/d,s.height/d);const p=new Qa,u=e.width/d,A=e.height/d;this.flipEnabled()===!1?(p.translate(e.x,e.y),p.rotate(e.rotation),p.translate(e.width<0?e.width:0,e.height<0?e.height:0),p.scale(Math.abs(u),Math.abs(A))):(p.translate(e.x,e.y),p.rotate(e.rotation),p.scale(u,A));const y=p.multiply(h.invert());this._nodes.forEach(x=>{var S;if(!x.getStage())return;const C=x.getParent().getAbsoluteTransform(),T=x.getTransform().copy();T.translate(x.offsetX(),x.offsetY());const R=new Qa;R.multiply(C.copy().invert()).multiply(y).multiply(C).multiply(T);const D=R.decompose();x.setAttrs(D),(S=x.getLayer())===null||S===void 0||S.batchDraw()}),this.rotation(he._getRotation(e.rotation)),this._nodes.forEach(x=>{this._fire("transform",{evt:n,target:x}),x._fire("transform",{evt:n,target:x})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,n){this.findOne(e).setAttrs(n)}update(){var e;const n=this._getNodeRect();this.rotation(he._getRotation(n.rotation));const s=n.width,i=n.height,c=this.enabledAnchors(),d=this.resizeEnabled(),h=this.padding(),p=this.anchorSize(),u=this.find("._anchor");u.forEach(Y=>{Y.setAttrs({width:p,height:p,offsetX:p/2,offsetY:p/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:p/2+h,offsetY:p/2+h,visible:d&&c.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:s/2,y:0,offsetY:p/2+h,visible:d&&c.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:s,y:0,offsetX:p/2-h,offsetY:p/2+h,visible:d&&c.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:p/2+h,visible:d&&c.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:s,y:i/2,offsetX:p/2-h,visible:d&&c.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:p/2+h,offsetY:p/2-h,visible:d&&c.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:s/2,y:i,offsetY:p/2-h,visible:d&&c.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:s,y:i,offsetX:p/2-h,offsetY:p/2-h,visible:d&&c.indexOf("bottom-right")>=0});const A=this.rotateAnchorAngle(),y=this.rotateAnchorOffset(),x=he.degToRad(A),S=Math.sin(x),C=-Math.cos(x),T=s/2,R=i/2;let D=1/0;C<0?D=Math.min(D,-R/C):C>0&&(D=Math.min(D,(i-R)/C)),S<0?D=Math.min(D,-T/S):S>0&&(D=Math.min(D,(s-T)/S));const M=T+S*D,P=R+C*D,O=he._sign(i);this._batchChangeChild(".rotater",{x:M+S*y*O,y:P+C*y*O-h*C,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:s,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(Y=>Y.draggable()),x:0,y:0});const I=this.anchorStyleFunc();I&&u.forEach(Y=>{I(Y)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Ru.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return Ge.prototype.toObject.call(this)}clone(e){return Ge.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Kt.isTransforming=()=>zg>0;function Vw(t){return t instanceof Array||he.warn("enabledAnchors value should be an array"),t instanceof Array&&t.forEach(function(e){sA.indexOf(e)===-1&&he.warn("Unknown anchor name: "+e+". Available names are: "+sA.join(", "))}),t||[]}Kt.prototype.className="Transformer";Pn(Kt);te.addGetterSetter(Kt,"enabledAnchors",sA,Vw);te.addGetterSetter(Kt,"flipEnabled",!0,zi());te.addGetterSetter(Kt,"resizeEnabled",!0);te.addGetterSetter(Kt,"anchorSize",10,Xe());te.addGetterSetter(Kt,"rotateEnabled",!0);te.addGetterSetter(Kt,"rotateLineVisible",!0);te.addGetterSetter(Kt,"rotationSnaps",[]);te.addGetterSetter(Kt,"rotateAnchorOffset",50,Xe());te.addGetterSetter(Kt,"rotateAnchorAngle",0,Xe());te.addGetterSetter(Kt,"rotateAnchorCursor","crosshair");te.addGetterSetter(Kt,"rotationSnapTolerance",5,Xe());te.addGetterSetter(Kt,"borderEnabled",!0);te.addGetterSetter(Kt,"anchorStroke","rgb(0, 161, 255)");te.addGetterSetter(Kt,"anchorStrokeWidth",1,Xe());te.addGetterSetter(Kt,"anchorFill","white");te.addGetterSetter(Kt,"anchorCornerRadius",0,Xe());te.addGetterSetter(Kt,"borderStroke","rgb(0, 161, 255)");te.addGetterSetter(Kt,"borderStrokeWidth",1,Xe());te.addGetterSetter(Kt,"borderDash");te.addGetterSetter(Kt,"keepRatio",!0);te.addGetterSetter(Kt,"shiftBehavior","default");te.addGetterSetter(Kt,"centeredScaling",!1);te.addGetterSetter(Kt,"ignoreStroke",!1);te.addGetterSetter(Kt,"padding",0,Xe());te.addGetterSetter(Kt,"nodes");te.addGetterSetter(Kt,"node");te.addGetterSetter(Kt,"boundBoxFunc");te.addGetterSetter(Kt,"anchorDragBoundFunc");te.addGetterSetter(Kt,"anchorStyleFunc");te.addGetterSetter(Kt,"shouldOverdrawWholeArea",!1);te.addGetterSetter(Kt,"useSingleNodeRotation",!0);te.backCompat(Kt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});class eo extends Fe{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Qe.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}}eo.prototype.className="Wedge";eo.prototype._centroid=!0;eo.prototype._attrsAffectingSize=["radius"];Pn(eo);te.addGetterSetter(eo,"radius",0,Xe());te.addGetterSetter(eo,"angle",0,Xe());te.addGetterSetter(eo,"clockwise",!1);te.backCompat(eo,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function L2(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}const qw=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],Kw=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function Jw(t,e){const n=t.data,s=t.width,i=t.height;let c,d,h,p,u,A,y,x,S,C,T,R,D,M,P,O,I,Y,K,q;const Q=e+e+1,V=s-1,ge=i-1,X=e+1,se=X*(X+1)/2,L=new L2,ne=qw[e],le=Kw[e];let pe=null,J=L,ae=null,re=null;for(let U=1;U<Q;U++)J=J.next=new L2,U===X&&(pe=J);J.next=L,h=d=0;for(let U=0;U<i;U++){R=D=M=P=p=u=A=y=0,x=X*(O=n[d]),S=X*(I=n[d+1]),C=X*(Y=n[d+2]),T=X*(K=n[d+3]),p+=se*O,u+=se*I,A+=se*Y,y+=se*K,J=L;for(let ee=0;ee<X;ee++)J.r=O,J.g=I,J.b=Y,J.a=K,J=J.next;for(let ee=1;ee<X;ee++)c=d+((V<ee?V:ee)<<2),p+=(J.r=O=n[c])*(q=X-ee),u+=(J.g=I=n[c+1])*q,A+=(J.b=Y=n[c+2])*q,y+=(J.a=K=n[c+3])*q,R+=O,D+=I,M+=Y,P+=K,J=J.next;ae=L,re=pe;for(let ee=0;ee<s;ee++)n[d+3]=K=y*ne>>le,K!==0?(K=255/K,n[d]=(p*ne>>le)*K,n[d+1]=(u*ne>>le)*K,n[d+2]=(A*ne>>le)*K):n[d]=n[d+1]=n[d+2]=0,p-=x,u-=S,A-=C,y-=T,x-=ae.r,S-=ae.g,C-=ae.b,T-=ae.a,c=h+((c=ee+e+1)<V?c:V)<<2,R+=ae.r=n[c],D+=ae.g=n[c+1],M+=ae.b=n[c+2],P+=ae.a=n[c+3],p+=R,u+=D,A+=M,y+=P,ae=ae.next,x+=O=re.r,S+=I=re.g,C+=Y=re.b,T+=K=re.a,R-=O,D-=I,M-=Y,P-=K,re=re.next,d+=4;h+=s}for(let U=0;U<s;U++){D=M=P=R=u=A=y=p=0,d=U<<2,x=X*(O=n[d]),S=X*(I=n[d+1]),C=X*(Y=n[d+2]),T=X*(K=n[d+3]),p+=se*O,u+=se*I,A+=se*Y,y+=se*K,J=L;for(let Ee=0;Ee<X;Ee++)J.r=O,J.g=I,J.b=Y,J.a=K,J=J.next;let ee=s;for(let Ee=1;Ee<=e;Ee++)d=ee+U<<2,p+=(J.r=O=n[d])*(q=X-Ee),u+=(J.g=I=n[d+1])*q,A+=(J.b=Y=n[d+2])*q,y+=(J.a=K=n[d+3])*q,R+=O,D+=I,M+=Y,P+=K,J=J.next,Ee<ge&&(ee+=s);d=U,ae=L,re=pe;for(let Ee=0;Ee<i;Ee++)c=d<<2,n[c+3]=K=y*ne>>le,K>0?(K=255/K,n[c]=(p*ne>>le)*K,n[c+1]=(u*ne>>le)*K,n[c+2]=(A*ne>>le)*K):n[c]=n[c+1]=n[c+2]=0,p-=x,u-=S,A-=C,y-=T,x-=ae.r,S-=ae.g,C-=ae.b,T-=ae.a,c=U+((c=Ee+X)<ge?c:ge)*s<<2,p+=R+=ae.r=n[c],u+=D+=ae.g=n[c+1],A+=M+=ae.b=n[c+2],y+=P+=ae.a=n[c+3],ae=ae.next,x+=O=re.r,S+=I=re.g,C+=Y=re.b,T+=K=re.a,R-=O,D-=I,M-=Y,P-=K,re=re.next,d+=s}}const Zw=function(e){const n=Math.round(this.blurRadius());n>0&&Jw(e,n)};te.addGetterSetter(Ge,"blurRadius",0,Xe(),te.afterSetFilter);const $w=function(t){const e=this.brightness()*255,n=t.data,s=n.length;for(let i=0;i<s;i+=4)n[i]+=e,n[i+1]+=e,n[i+2]+=e};te.addGetterSetter(Ge,"brightness",0,Xe(),te.afterSetFilter);const e8=function(t){const e=this.brightness(),n=t.data,s=n.length;for(let i=0;i<s;i+=4)n[i]=Math.min(255,n[i]*e),n[i+1]=Math.min(255,n[i+1]*e),n[i+2]=Math.min(255,n[i+2]*e)},t8=function(t){const e=Math.pow((this.contrast()+100)/100,2),n=t.data,s=n.length;let i=150,c=150,d=150;for(let h=0;h<s;h+=4)i=n[h],c=n[h+1],d=n[h+2],i/=255,i-=.5,i*=e,i+=.5,i*=255,c/=255,c-=.5,c*=e,c+=.5,c*=255,d/=255,d-=.5,d*=e,d+=.5,d*=255,i=i<0?0:i>255?255:i,c=c<0?0:c>255?255:c,d=d<0?0:d>255?255:d,n[h]=i,n[h+1]=c,n[h+2]=d};te.addGetterSetter(Ge,"contrast",0,Xe(),te.afterSetFilter);const n8=function(t){var e,n,s,i,c,d,h,p,u;const A=t.data,y=t.width,x=t.height,S=Math.min(1,Math.max(0,(n=(e=this.embossStrength)===null||e===void 0?void 0:e.call(this))!==null&&n!==void 0?n:.5)),C=Math.min(1,Math.max(0,(i=(s=this.embossWhiteLevel)===null||s===void 0?void 0:s.call(this))!==null&&i!==void 0?i:.5)),R=(h={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(d=(c=this.embossDirection)===null||c===void 0?void 0:c.call(this))!==null&&d!==void 0?d:"top-left"])!==null&&h!==void 0?h:315,D=!!((u=(p=this.embossBlend)===null||p===void 0?void 0:p.call(this))!==null&&u!==void 0&&u),M=S*10,P=C*255,O=R*Math.PI/180,I=Math.cos(O),Y=Math.sin(O),K=128/1020*M,q=new Uint8ClampedArray(A),Q=new Float32Array(y*x);for(let L=0,ne=0;ne<A.length;ne+=4,L++)Q[L]=.2126*q[ne]+.7152*q[ne+1]+.0722*q[ne+2];const V=[-1,0,1,-2,0,2,-1,0,1],ge=[-1,-2,-1,0,0,0,1,2,1],X=[-y-1,-y,-y+1,-1,0,1,y-1,y,y+1],se=L=>L<0?0:L>255?255:L;for(let L=1;L<x-1;L++)for(let ne=1;ne<y-1;ne++){const le=L*y+ne;let pe=0,J=0;pe+=Q[le+X[0]]*V[0],J+=Q[le+X[0]]*ge[0],pe+=Q[le+X[1]]*V[1],J+=Q[le+X[1]]*ge[1],pe+=Q[le+X[2]]*V[2],J+=Q[le+X[2]]*ge[2],pe+=Q[le+X[3]]*V[3],J+=Q[le+X[3]]*ge[3],pe+=Q[le+X[5]]*V[5],J+=Q[le+X[5]]*ge[5],pe+=Q[le+X[6]]*V[6],J+=Q[le+X[6]]*ge[6],pe+=Q[le+X[7]]*V[7],J+=Q[le+X[7]]*ge[7],pe+=Q[le+X[8]]*V[8],J+=Q[le+X[8]]*ge[8];const ae=I*pe+Y*J,re=se(P+ae*K),U=le*4;if(D){const ee=re-P;A[U]=se(q[U]+ee),A[U+1]=se(q[U+1]+ee),A[U+2]=se(q[U+2]+ee),A[U+3]=q[U+3]}else A[U]=A[U+1]=A[U+2]=re,A[U+3]=q[U+3]}for(let L=0;L<y;L++){let ne=L*4,le=((x-1)*y+L)*4;A[ne]=q[ne],A[ne+1]=q[ne+1],A[ne+2]=q[ne+2],A[ne+3]=q[ne+3],A[le]=q[le],A[le+1]=q[le+1],A[le+2]=q[le+2],A[le+3]=q[le+3]}for(let L=1;L<x-1;L++){let ne=L*y*4,le=(L*y+(y-1))*4;A[ne]=q[ne],A[ne+1]=q[ne+1],A[ne+2]=q[ne+2],A[ne+3]=q[ne+3],A[le]=q[le],A[le+1]=q[le+1],A[le+2]=q[le+2],A[le+3]=q[le+3]}return t};te.addGetterSetter(Ge,"embossStrength",.5,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"embossWhiteLevel",.5,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"embossDirection","top-left",void 0,te.afterSetFilter);te.addGetterSetter(Ge,"embossBlend",!1,void 0,te.afterSetFilter);function ig(t,e,n,s,i){const c=n-e,d=i-s;if(c===0)return s+d/2;if(d===0)return s;let h=(t-e)/c;return h=d*h+s,h}const r8=function(t){const e=t.data,n=e.length;let s=e[0],i=s,c,d=e[1],h=d,p,u=e[2],A=u,y;const x=this.enhance();if(x===0)return;for(let P=0;P<n;P+=4)c=e[P+0],c<s?s=c:c>i&&(i=c),p=e[P+1],p<d?d=p:p>h&&(h=p),y=e[P+2],y<u?u=y:y>A&&(A=y);i===s&&(i=255,s=0),h===d&&(h=255,d=0),A===u&&(A=255,u=0);let S,C,T,R,D,M;if(x>0)S=i+x*(255-i),C=s-x*(s-0),T=h+x*(255-h),R=d-x*(d-0),D=A+x*(255-A),M=u-x*(u-0);else{const P=(i+s)*.5;S=i+x*(i-P),C=s+x*(s-P);const O=(h+d)*.5;T=h+x*(h-O),R=d+x*(d-O);const I=(A+u)*.5;D=A+x*(A-I),M=u+x*(u-I)}for(let P=0;P<n;P+=4)e[P+0]=ig(e[P+0],s,i,C,S),e[P+1]=ig(e[P+1],d,h,R,T),e[P+2]=ig(e[P+2],u,A,M,D)};te.addGetterSetter(Ge,"enhance",0,Xe(),te.afterSetFilter);const a8=function(t){const e=t.data,n=e.length;for(let s=0;s<n;s+=4){const i=.34*e[s]+.5*e[s+1]+.16*e[s+2];e[s]=i,e[s+1]=i,e[s+2]=i}};te.addGetterSetter(Ge,"hue",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"saturation",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"luminance",0,Xe(),te.afterSetFilter);const i8=function(t){const e=t.data,n=e.length,s=1,i=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,d=this.luminance()*127,h=s*i*Math.cos(c*Math.PI/180),p=s*i*Math.sin(c*Math.PI/180),u=.299*s+.701*h+.167*p,A=.587*s-.587*h+.33*p,y=.114*s-.114*h-.497*p,x=.299*s-.299*h-.328*p,S=.587*s+.413*h+.035*p,C=.114*s-.114*h+.293*p,T=.299*s-.3*h+1.25*p,R=.587*s-.586*h-1.05*p,D=.114*s+.886*h-.2*p;let M,P,O,I;for(let Y=0;Y<n;Y+=4)M=e[Y+0],P=e[Y+1],O=e[Y+2],I=e[Y+3],e[Y+0]=u*M+A*P+y*O+d,e[Y+1]=x*M+S*P+C*O+d,e[Y+2]=T*M+R*P+D*O+d,e[Y+3]=I},s8=function(t){const e=t.data,n=e.length,s=Math.pow(2,this.value()),i=Math.pow(2,this.saturation()),c=Math.abs(this.hue()+360)%360,d=s*i*Math.cos(c*Math.PI/180),h=s*i*Math.sin(c*Math.PI/180),p=.299*s+.701*d+.167*h,u=.587*s-.587*d+.33*h,A=.114*s-.114*d-.497*h,y=.299*s-.299*d-.328*h,x=.587*s+.413*d+.035*h,S=.114*s-.114*d+.293*h,C=.299*s-.3*d+1.25*h,T=.587*s-.586*d-1.05*h,R=.114*s+.886*d-.2*h;for(let D=0;D<n;D+=4){const M=e[D+0],P=e[D+1],O=e[D+2],I=e[D+3];e[D+0]=p*M+u*P+A*O,e[D+1]=y*M+x*P+S*O,e[D+2]=C*M+T*P+R*O,e[D+3]=I}};te.addGetterSetter(Ge,"hue",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"saturation",0,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"value",0,Xe(),te.afterSetFilter);const o8=function(t){const e=t.data,n=e.length;for(let s=0;s<n;s+=4)e[s]=255-e[s],e[s+1]=255-e[s+1],e[s+2]=255-e[s+2]},l8=function(t,e,n){const s=t.data,i=e.data,c=t.width,d=t.height,h=n.polarCenterX||c/2,p=n.polarCenterY||d/2;let u=Math.sqrt(h*h+p*p),A=c-h,y=d-p;const x=Math.sqrt(A*A+y*y);u=x>u?x:u;const S=d,C=c,T=360/C*Math.PI/180;for(let R=0;R<C;R+=1){const D=Math.sin(R*T),M=Math.cos(R*T);for(let P=0;P<S;P+=1){A=Math.floor(h+u*P/S*M),y=Math.floor(p+u*P/S*D);let O=(y*c+A)*4;const I=s[O+0],Y=s[O+1],K=s[O+2],q=s[O+3];O=(R+P*c)*4,i[O+0]=I,i[O+1]=Y,i[O+2]=K,i[O+3]=q}}},c8=function(t,e,n){const s=t.data,i=e.data,c=t.width,d=t.height,h=n.polarCenterX||c/2,p=n.polarCenterY||d/2;let u=Math.sqrt(h*h+p*p),A=c-h,y=d-p;const x=Math.sqrt(A*A+y*y);u=x>u?x:u;const S=d,C=c,T=0;let R,D;for(A=0;A<c;A+=1)for(y=0;y<d;y+=1){const M=A-h,P=y-p,O=Math.sqrt(M*M+P*P)*S/u;let I=(Math.atan2(P,M)*180/Math.PI+360+T)%360;I=I*C/360,R=Math.floor(I),D=Math.floor(O);let Y=(D*c+R)*4;const K=s[Y+0],q=s[Y+1],Q=s[Y+2],V=s[Y+3];Y=(y*c+A)*4,i[Y+0]=K,i[Y+1]=q,i[Y+2]=Q,i[Y+3]=V}},u8=function(t){const e=t.width,n=t.height;let s,i,c,d,h,p,u,A,y,x,S=Math.round(this.kaleidoscopePower());const C=Math.round(this.kaleidoscopeAngle()),T=Math.floor(e*(C%360)/360);if(S<1)return;const R=he.createCanvasElement();R.width=e,R.height=n;const D=R.getContext("2d").getImageData(0,0,e,n);he.releaseCanvas(R),l8(t,D,{polarCenterX:e/2,polarCenterY:n/2});let M=e/Math.pow(2,S);for(;M<=8;)M=M*2,S-=1;M=Math.ceil(M);let P=M,O=0,I=P,Y=1;for(T+M>e&&(O=P,I=0,Y=-1),i=0;i<n;i+=1)for(s=O;s!==I;s+=Y)c=Math.round(s+T)%e,y=(e*i+c)*4,h=D.data[y+0],p=D.data[y+1],u=D.data[y+2],A=D.data[y+3],x=(e*i+s)*4,D.data[x+0]=h,D.data[x+1]=p,D.data[x+2]=u,D.data[x+3]=A;for(i=0;i<n;i+=1)for(P=Math.floor(M),d=0;d<S;d+=1){for(s=0;s<P+1;s+=1)y=(e*i+s)*4,h=D.data[y+0],p=D.data[y+1],u=D.data[y+2],A=D.data[y+3],x=(e*i+P*2-s-1)*4,D.data[x+0]=h,D.data[x+1]=p,D.data[x+2]=u,D.data[x+3]=A;P*=2}c8(D,t,{})};te.addGetterSetter(Ge,"kaleidoscopePower",2,Xe(),te.afterSetFilter);te.addGetterSetter(Ge,"kaleidoscopeAngle",0,Xe(),te.afterSetFilter);function Xp(t,e,n){let s=(n*t.width+e)*4;const i=[];return i.push(t.data[s++],t.data[s++],t.data[s++],t.data[s++]),i}function uf(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)+Math.pow(t[2]-e[2],2))}function d8(t){const e=[0,0,0];for(let n=0;n<t.length;n++)e[0]+=t[n][0],e[1]+=t[n][1],e[2]+=t[n][2];return e[0]/=t.length,e[1]/=t.length,e[2]/=t.length,e}function f8(t,e){const n=Xp(t,0,0),s=Xp(t,t.width-1,0),i=Xp(t,0,t.height-1),c=Xp(t,t.width-1,t.height-1),d=e||10;if(uf(n,s)<d&&uf(s,c)<d&&uf(c,i)<d&&uf(i,n)<d){const h=d8([s,n,c,i]),p=[];for(let u=0;u<t.width*t.height;u++){const A=uf(h,[t.data[u*4],t.data[u*4+1],t.data[u*4+2]]);p[u]=A<d?0:255}return p}}function h8(t,e){for(let n=0;n<t.width*t.height;n++)t.data[4*n+3]=e[n]}function p8(t,e,n){const s=[1,1,1,1,0,1,1,1,1],i=Math.round(Math.sqrt(s.length)),c=Math.floor(i/2),d=[];for(let h=0;h<n;h++)for(let p=0;p<e;p++){const u=h*e+p;let A=0;for(let y=0;y<i;y++)for(let x=0;x<i;x++){const S=h+y-c,C=p+x-c;if(S>=0&&S<n&&C>=0&&C<e){const T=S*e+C,R=s[y*i+x];A+=t[T]*R}}d[u]=A===2040?255:0}return d}function A8(t,e,n){const s=[1,1,1,1,1,1,1,1,1],i=Math.round(Math.sqrt(s.length)),c=Math.floor(i/2),d=[];for(let h=0;h<n;h++)for(let p=0;p<e;p++){const u=h*e+p;let A=0;for(let y=0;y<i;y++)for(let x=0;x<i;x++){const S=h+y-c,C=p+x-c;if(S>=0&&S<n&&C>=0&&C<e){const T=S*e+C,R=s[y*i+x];A+=t[T]*R}}d[u]=A>=1020?255:0}return d}function m8(t,e,n){const s=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(s.length)),c=Math.floor(i/2),d=[];for(let h=0;h<n;h++)for(let p=0;p<e;p++){const u=h*e+p;let A=0;for(let y=0;y<i;y++)for(let x=0;x<i;x++){const S=h+y-c,C=p+x-c;if(S>=0&&S<n&&C>=0&&C<e){const T=S*e+C,R=s[y*i+x];A+=t[T]*R}}d[u]=A}return d}const g8=function(t){const e=this.threshold();let n=f8(t,e);return n&&(n=p8(n,t.width,t.height),n=A8(n,t.width,t.height),n=m8(n,t.width,t.height),h8(t,n)),t};te.addGetterSetter(Ge,"threshold",0,Xe(),te.afterSetFilter);const v8=function(t){const e=this.noise()*255,n=t.data,s=n.length,i=e/2;for(let c=0;c<s;c+=4)n[c+0]+=i-2*i*Math.random(),n[c+1]+=i-2*i*Math.random(),n[c+2]+=i-2*i*Math.random()};te.addGetterSetter(Ge,"noise",.2,Xe(),te.afterSetFilter);const y8=function(t){let e=Math.ceil(this.pixelSize()),n=t.width,s=t.height,i=Math.ceil(n/e),c=Math.ceil(s/e),d=t.data;if(e<=0){he.error("pixelSize value can not be <= 0");return}for(let h=0;h<i;h+=1)for(let p=0;p<c;p+=1){let u=0,A=0,y=0,x=0;const S=h*e,C=S+e,T=p*e,R=T+e;let D=0;for(let M=S;M<C;M+=1)if(!(M>=n))for(let P=T;P<R;P+=1){if(P>=s)continue;const O=(n*P+M)*4;u+=d[O+0],A+=d[O+1],y+=d[O+2],x+=d[O+3],D+=1}u=u/D,A=A/D,y=y/D,x=x/D;for(let M=S;M<C;M+=1)if(!(M>=n))for(let P=T;P<R;P+=1){if(P>=s)continue;const O=(n*P+M)*4;d[O+0]=u,d[O+1]=A,d[O+2]=y,d[O+3]=x}}};te.addGetterSetter(Ge,"pixelSize",8,Xe(),te.afterSetFilter);const x8=function(t){const e=Math.round(this.levels()*254)+1,n=t.data,s=n.length,i=255/e;for(let c=0;c<s;c+=1)n[c]=Math.floor(n[c]/i)*i};te.addGetterSetter(Ge,"levels",.5,Xe(),te.afterSetFilter);const b8=function(t){const e=t.data,n=e.length,s=this.red(),i=this.green(),c=this.blue();for(let d=0;d<n;d+=4){const h=(.34*e[d]+.5*e[d+1]+.16*e[d+2])/255;e[d]=h*s,e[d+1]=h*i,e[d+2]=h*c,e[d+3]=e[d+3]}};te.addGetterSetter(Ge,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"blue",0,Cx,te.afterSetFilter);const S8=function(t){const e=t.data,n=e.length,s=this.red(),i=this.green(),c=this.blue(),d=this.alpha();for(let h=0;h<n;h+=4){const p=1-d;e[h]=s*d+e[h]*p,e[h+1]=i*d+e[h+1]*p,e[h+2]=c*d+e[h+2]*p}};te.addGetterSetter(Ge,"red",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"green",0,function(t){return this._filterUpToDate=!1,t>255?255:t<0?0:Math.round(t)});te.addGetterSetter(Ge,"blue",0,Cx,te.afterSetFilter);te.addGetterSetter(Ge,"alpha",1,function(t){return this._filterUpToDate=!1,t>1?1:t<0?0:t});const C8=function(t){const e=t.data,n=e.length;for(let s=0;s<n;s+=4){const i=e[s+0],c=e[s+1],d=e[s+2];e[s+0]=Math.min(255,i*.393+c*.769+d*.189),e[s+1]=Math.min(255,i*.349+c*.686+d*.168),e[s+2]=Math.min(255,i*.272+c*.534+d*.131)}},w8=function(t){const n=t.data;for(let s=0;s<n.length;s+=4){const i=n[s],c=n[s+1],d=n[s+2];.2126*i+.7152*c+.0722*d>=128&&(n[s]=255-i,n[s+1]=255-c,n[s+2]=255-d)}return t},_8=function(t){const e=this.threshold()*255,n=t.data,s=n.length;for(let i=0;i<s;i+=1)n[i]=n[i]<e?0:255};te.addGetterSetter(Ge,"threshold",.5,Xe(),te.afterSetFilter);Pl.Util._assign(Pl,{Arc:Zs,Arrow:Il,Circle:Du,Ellipse:Ho,Image:Fi,Label:Jg,Tag:Ol,Line:$s,Path:wn,Rect:kf,RegularPolygon:Xo,Ring:Ul,Sprite:hs,Star:Wo,Text:_n,TextPath:hr,Transformer:Kt,Wedge:eo,Filters:{Blur:Zw,Brightness:e8,Brighten:$w,Contrast:t8,Emboss:n8,Enhance:r8,Grayscale:a8,HSL:i8,HSV:s8,Invert:o8,Kaleidoscope:u8,Mask:g8,Noise:v8,Pixelate:y8,Posterize:x8,RGB:b8,RGBA:S8,Sepia:C8,Solarize:w8,Threshold:_8}});var Wp={exports:{}},Qp={exports:{}},sg={};/**
278
278
  * @license React
279
279
  * scheduler.production.min.js
280
280
  *
@@ -282,7 +282,7 @@ js: import "konva/skia-backend";
282
282
  *
283
283
  * This source code is licensed under the MIT license found in the
284
284
  * LICENSE file in the root directory of this source tree.
285
- */var k2;function _8(){return k2||(k2=1,(function(t){function e(J,ae){var re=J.length;J.push(ae);e:for(;0<re;){var U=re-1>>>1,ee=J[U];if(0<i(ee,ae))J[U]=ae,J[re]=ee,re=U;else break e}}function n(J){return J.length===0?null:J[0]}function s(J){if(J.length===0)return null;var ae=J[0],re=J.pop();if(re!==ae){J[0]=re;e:for(var U=0,ee=J.length,Ee=ee>>>1;U<Ee;){var Te=2*(U+1)-1,Ne=J[Te],Ue=Te+1,ot=J[Ue];if(0>i(Ne,re))Ue<ee&&0>i(ot,Ne)?(J[U]=ot,J[Ue]=re,U=Ue):(J[U]=Ne,J[Te]=re,U=Te);else if(Ue<ee&&0>i(ot,re))J[U]=ot,J[Ue]=re,U=Ue;else break e}}return ae}function i(J,ae){var re=J.sortIndex-ae.sortIndex;return re!==0?re:J.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();t.unstable_now=function(){return d.now()-h}}var p=[],u=[],A=1,y=null,x=3,S=!1,C=!1,T=!1,R=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(J){for(var ae=n(u);ae!==null;){if(ae.callback===null)s(u);else if(ae.startTime<=J)s(u),ae.sortIndex=ae.expirationTime,e(p,ae);else break;ae=n(u)}}function O(J){if(T=!1,P(J),!C)if(n(p)!==null)C=!0,le(I);else{var ae=n(u);ae!==null&&pe(O,ae.startTime-J)}}function I(J,ae){C=!1,T&&(T=!1,D(q),q=-1),S=!0;var re=x;try{for(P(ae),y=n(p);y!==null&&(!(y.expirationTime>ae)||J&&!ge());){var U=y.callback;if(typeof U=="function"){y.callback=null,x=y.priorityLevel;var ee=U(y.expirationTime<=ae);ae=t.unstable_now(),typeof ee=="function"?y.callback=ee:y===n(p)&&s(p),P(ae)}else s(p);y=n(p)}if(y!==null)var Ee=!0;else{var Te=n(u);Te!==null&&pe(O,Te.startTime-ae),Ee=!1}return Ee}finally{y=null,x=re,S=!1}}var Y=!1,K=null,q=-1,Q=5,V=-1;function ge(){return!(t.unstable_now()-V<Q)}function X(){if(K!==null){var J=t.unstable_now();V=J;var ae=!0;try{ae=K(!0,J)}finally{ae?se():(Y=!1,K=null)}}else Y=!1}var se;if(typeof M=="function")se=function(){M(X)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,ne=L.port2;L.port1.onmessage=X,se=function(){ne.postMessage(null)}}else se=function(){R(X,0)};function le(J){K=J,Y||(Y=!0,se())}function pe(J,ae){q=R(function(){J(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(J){J.callback=null},t.unstable_continueExecution=function(){C||S||(C=!0,le(I))},t.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<J?Math.floor(1e3/J):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return n(p)},t.unstable_next=function(J){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var re=x;x=ae;try{return J()}finally{x=re}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(J,ae){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var re=x;x=J;try{return ae()}finally{x=re}},t.unstable_scheduleCallback=function(J,ae,re){var U=t.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?U+re:U):re=U,J){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=re+ee,J={id:A++,callback:ae,priorityLevel:J,startTime:re,expirationTime:ee,sortIndex:-1},re>U?(J.sortIndex=re,e(u,J),n(p)===null&&J===n(u)&&(T?(D(q),q=-1):T=!0,pe(O,re-U))):(J.sortIndex=ee,e(p,J),C||S||(C=!0,le(I))),J},t.unstable_shouldYield=ge,t.unstable_wrapCallback=function(J){var ae=x;return function(){var re=x;x=ae;try{return J.apply(this,arguments)}finally{x=re}}}})(sg)),sg}var og={};/**
285
+ */var k2;function E8(){return k2||(k2=1,(function(t){function e(J,ae){var re=J.length;J.push(ae);e:for(;0<re;){var U=re-1>>>1,ee=J[U];if(0<i(ee,ae))J[U]=ae,J[re]=ee,re=U;else break e}}function n(J){return J.length===0?null:J[0]}function s(J){if(J.length===0)return null;var ae=J[0],re=J.pop();if(re!==ae){J[0]=re;e:for(var U=0,ee=J.length,Ee=ee>>>1;U<Ee;){var Te=2*(U+1)-1,Ne=J[Te],Ue=Te+1,ot=J[Ue];if(0>i(Ne,re))Ue<ee&&0>i(ot,Ne)?(J[U]=ot,J[Ue]=re,U=Ue):(J[U]=Ne,J[Te]=re,U=Te);else if(Ue<ee&&0>i(ot,re))J[U]=ot,J[Ue]=re,U=Ue;else break e}}return ae}function i(J,ae){var re=J.sortIndex-ae.sortIndex;return re!==0?re:J.id-ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();t.unstable_now=function(){return d.now()-h}}var p=[],u=[],A=1,y=null,x=3,S=!1,C=!1,T=!1,R=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function P(J){for(var ae=n(u);ae!==null;){if(ae.callback===null)s(u);else if(ae.startTime<=J)s(u),ae.sortIndex=ae.expirationTime,e(p,ae);else break;ae=n(u)}}function O(J){if(T=!1,P(J),!C)if(n(p)!==null)C=!0,le(I);else{var ae=n(u);ae!==null&&pe(O,ae.startTime-J)}}function I(J,ae){C=!1,T&&(T=!1,D(q),q=-1),S=!0;var re=x;try{for(P(ae),y=n(p);y!==null&&(!(y.expirationTime>ae)||J&&!ge());){var U=y.callback;if(typeof U=="function"){y.callback=null,x=y.priorityLevel;var ee=U(y.expirationTime<=ae);ae=t.unstable_now(),typeof ee=="function"?y.callback=ee:y===n(p)&&s(p),P(ae)}else s(p);y=n(p)}if(y!==null)var Ee=!0;else{var Te=n(u);Te!==null&&pe(O,Te.startTime-ae),Ee=!1}return Ee}finally{y=null,x=re,S=!1}}var Y=!1,K=null,q=-1,Q=5,V=-1;function ge(){return!(t.unstable_now()-V<Q)}function X(){if(K!==null){var J=t.unstable_now();V=J;var ae=!0;try{ae=K(!0,J)}finally{ae?se():(Y=!1,K=null)}}else Y=!1}var se;if(typeof M=="function")se=function(){M(X)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,ne=L.port2;L.port1.onmessage=X,se=function(){ne.postMessage(null)}}else se=function(){R(X,0)};function le(J){K=J,Y||(Y=!0,se())}function pe(J,ae){q=R(function(){J(t.unstable_now())},ae)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(J){J.callback=null},t.unstable_continueExecution=function(){C||S||(C=!0,le(I))},t.unstable_forceFrameRate=function(J){0>J||125<J?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<J?Math.floor(1e3/J):5},t.unstable_getCurrentPriorityLevel=function(){return x},t.unstable_getFirstCallbackNode=function(){return n(p)},t.unstable_next=function(J){switch(x){case 1:case 2:case 3:var ae=3;break;default:ae=x}var re=x;x=ae;try{return J()}finally{x=re}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(J,ae){switch(J){case 1:case 2:case 3:case 4:case 5:break;default:J=3}var re=x;x=J;try{return ae()}finally{x=re}},t.unstable_scheduleCallback=function(J,ae,re){var U=t.unstable_now();switch(typeof re=="object"&&re!==null?(re=re.delay,re=typeof re=="number"&&0<re?U+re:U):re=U,J){case 1:var ee=-1;break;case 2:ee=250;break;case 5:ee=1073741823;break;case 4:ee=1e4;break;default:ee=5e3}return ee=re+ee,J={id:A++,callback:ae,priorityLevel:J,startTime:re,expirationTime:ee,sortIndex:-1},re>U?(J.sortIndex=re,e(u,J),n(p)===null&&J===n(u)&&(T?(D(q),q=-1):T=!0,pe(O,re-U))):(J.sortIndex=ee,e(p,J),C||S||(C=!0,le(I))),J},t.unstable_shouldYield=ge,t.unstable_wrapCallback=function(J){var ae=x;return function(){var re=x;x=ae;try{return J.apply(this,arguments)}finally{x=re}}}})(sg)),sg}var og={};/**
286
286
  * @license React
287
287
  * scheduler.development.js
288
288
  *
@@ -290,7 +290,7 @@ js: import "konva/skia-backend";
290
290
  *
291
291
  * This source code is licensed under the MIT license found in the
292
292
  * LICENSE file in the root directory of this source tree.
293
- */var N2;function E8(){return N2||(N2=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=!1,n=5;function s(Ye,ht){var Nt=Ye.length;Ye.push(ht),d(Ye,ht,Nt)}function i(Ye){return Ye.length===0?null:Ye[0]}function c(Ye){if(Ye.length===0)return null;var ht=Ye[0],Nt=Ye.pop();return Nt!==ht&&(Ye[0]=Nt,h(Ye,Nt,0)),ht}function d(Ye,ht,Nt){for(var et=Nt;et>0;){var pn=et-1>>>1,Wn=Ye[pn];if(p(Wn,ht)>0)Ye[pn]=ht,Ye[et]=Wn,et=pn;else return}}function h(Ye,ht,Nt){for(var et=Nt,pn=Ye.length,Wn=pn>>>1;et<Wn;){var it=(et+1)*2-1,st=Ye[it],En=it+1,un=Ye[En];if(p(st,ht)<0)En<pn&&p(un,st)<0?(Ye[et]=un,Ye[En]=ht,et=En):(Ye[et]=st,Ye[it]=ht,et=it);else if(En<pn&&p(un,ht)<0)Ye[et]=un,Ye[En]=ht,et=En;else return}}function p(Ye,ht){var Nt=Ye.sortIndex-ht.sortIndex;return Nt!==0?Nt:Ye.id-ht.id}var u=1,A=2,y=3,x=4,S=5;function C(Ye,ht){}var T=typeof performance=="object"&&typeof performance.now=="function";if(T){var R=performance;t.unstable_now=function(){return R.now()}}else{var D=Date,M=D.now();t.unstable_now=function(){return D.now()-M}}var P=1073741823,O=-1,I=250,Y=5e3,K=1e4,q=P,Q=[],V=[],ge=1,X=null,se=y,L=!1,ne=!1,le=!1,pe=typeof setTimeout=="function"?setTimeout:null,J=typeof clearTimeout=="function"?clearTimeout:null,ae=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function re(Ye){for(var ht=i(V);ht!==null;){if(ht.callback===null)c(V);else if(ht.startTime<=Ye)c(V),ht.sortIndex=ht.expirationTime,s(Q,ht);else return;ht=i(V)}}function U(Ye){if(le=!1,re(Ye),!ne)if(i(Q)!==null)ne=!0,Ie(ee);else{var ht=i(V);ht!==null&&dt(U,ht.startTime-Ye)}}function ee(Ye,ht){ne=!1,le&&(le=!1,Jt()),L=!0;var Nt=se;try{var et;if(!e)return Ee(Ye,ht)}finally{X=null,se=Nt,L=!1}}function Ee(Ye,ht){var Nt=ht;for(re(Nt),X=i(Q);X!==null&&!(X.expirationTime>Nt&&(!Ye||j()));){var et=X.callback;if(typeof et=="function"){X.callback=null,se=X.priorityLevel;var pn=X.expirationTime<=Nt,Wn=et(pn);Nt=t.unstable_now(),typeof Wn=="function"?X.callback=Wn:X===i(Q)&&c(Q),re(Nt)}else c(Q);X=i(Q)}if(X!==null)return!0;var it=i(V);return it!==null&&dt(U,it.startTime-Nt),!1}function Te(Ye,ht){switch(Ye){case u:case A:case y:case x:case S:break;default:Ye=y}var Nt=se;se=Ye;try{return ht()}finally{se=Nt}}function Ne(Ye){var ht;switch(se){case u:case A:case y:ht=y;break;default:ht=se;break}var Nt=se;se=ht;try{return Ye()}finally{se=Nt}}function Ue(Ye){var ht=se;return function(){var Nt=se;se=ht;try{return Ye.apply(this,arguments)}finally{se=Nt}}}function ot(Ye,ht,Nt){var et=t.unstable_now(),pn;if(typeof Nt=="object"&&Nt!==null){var Wn=Nt.delay;typeof Wn=="number"&&Wn>0?pn=et+Wn:pn=et}else pn=et;var it;switch(Ye){case u:it=O;break;case A:it=I;break;case S:it=q;break;case x:it=K;break;case y:default:it=Y;break}var st=pn+it,En={id:ge++,callback:ht,priorityLevel:Ye,startTime:pn,expirationTime:st,sortIndex:-1};return pn>et?(En.sortIndex=pn,s(V,En),i(Q)===null&&En===i(V)&&(le?Jt():le=!0,dt(U,pn-et))):(En.sortIndex=st,s(Q,En),!ne&&!L&&(ne=!0,Ie(ee))),En}function lt(){}function pt(){!ne&&!L&&(ne=!0,Ie(ee))}function Lt(){return i(Q)}function qe(Ye){Ye.callback=null}function Dt(){return se}var me=!1,k=null,ce=-1,de=n,G=-1;function j(){var Ye=t.unstable_now()-G;return!(Ye<de)}function $(){}function ye(Ye){if(Ye<0||Ye>125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");return}Ye>0?de=Math.floor(1e3/Ye):de=n}var Ce=function(){if(k!==null){var Ye=t.unstable_now();G=Ye;var ht=!0,Nt=!0;try{Nt=k(ht,Ye)}finally{Nt?Ae():(me=!1,k=null)}}else me=!1},Ae;if(typeof ae=="function")Ae=function(){ae(Ce)};else if(typeof MessageChannel<"u"){var ze=new MessageChannel,We=ze.port2;ze.port1.onmessage=Ce,Ae=function(){We.postMessage(null)}}else Ae=function(){pe(Ce,0)};function Ie(Ye){k=Ye,me||(me=!0,Ae())}function dt(Ye,ht){ce=pe(function(){Ye(t.unstable_now())},ht)}function Jt(){J(ce),ce=-1}var zt=$,pr=null;t.unstable_IdlePriority=S,t.unstable_ImmediatePriority=u,t.unstable_LowPriority=x,t.unstable_NormalPriority=y,t.unstable_Profiling=pr,t.unstable_UserBlockingPriority=A,t.unstable_cancelCallback=qe,t.unstable_continueExecution=pt,t.unstable_forceFrameRate=ye,t.unstable_getCurrentPriorityLevel=Dt,t.unstable_getFirstCallbackNode=Lt,t.unstable_next=Ne,t.unstable_pauseExecution=lt,t.unstable_requestPaint=zt,t.unstable_runWithPriority=Te,t.unstable_scheduleCallback=ot,t.unstable_shouldYield=j,t.unstable_wrapCallback=Ue,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()})(og)),og}var B2;function Zg(){return B2||(B2=1,process.env.NODE_ENV==="production"?Qp.exports=_8():Qp.exports=E8()),Qp.exports}/**
293
+ */var N2;function T8(){return N2||(N2=1,(function(t){process.env.NODE_ENV!=="production"&&(function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var e=!1,n=5;function s(Ye,ht){var Nt=Ye.length;Ye.push(ht),d(Ye,ht,Nt)}function i(Ye){return Ye.length===0?null:Ye[0]}function c(Ye){if(Ye.length===0)return null;var ht=Ye[0],Nt=Ye.pop();return Nt!==ht&&(Ye[0]=Nt,h(Ye,Nt,0)),ht}function d(Ye,ht,Nt){for(var et=Nt;et>0;){var pn=et-1>>>1,Wn=Ye[pn];if(p(Wn,ht)>0)Ye[pn]=ht,Ye[et]=Wn,et=pn;else return}}function h(Ye,ht,Nt){for(var et=Nt,pn=Ye.length,Wn=pn>>>1;et<Wn;){var it=(et+1)*2-1,st=Ye[it],En=it+1,un=Ye[En];if(p(st,ht)<0)En<pn&&p(un,st)<0?(Ye[et]=un,Ye[En]=ht,et=En):(Ye[et]=st,Ye[it]=ht,et=it);else if(En<pn&&p(un,ht)<0)Ye[et]=un,Ye[En]=ht,et=En;else return}}function p(Ye,ht){var Nt=Ye.sortIndex-ht.sortIndex;return Nt!==0?Nt:Ye.id-ht.id}var u=1,A=2,y=3,x=4,S=5;function C(Ye,ht){}var T=typeof performance=="object"&&typeof performance.now=="function";if(T){var R=performance;t.unstable_now=function(){return R.now()}}else{var D=Date,M=D.now();t.unstable_now=function(){return D.now()-M}}var P=1073741823,O=-1,I=250,Y=5e3,K=1e4,q=P,Q=[],V=[],ge=1,X=null,se=y,L=!1,ne=!1,le=!1,pe=typeof setTimeout=="function"?setTimeout:null,J=typeof clearTimeout=="function"?clearTimeout:null,ae=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function re(Ye){for(var ht=i(V);ht!==null;){if(ht.callback===null)c(V);else if(ht.startTime<=Ye)c(V),ht.sortIndex=ht.expirationTime,s(Q,ht);else return;ht=i(V)}}function U(Ye){if(le=!1,re(Ye),!ne)if(i(Q)!==null)ne=!0,Ie(ee);else{var ht=i(V);ht!==null&&dt(U,ht.startTime-Ye)}}function ee(Ye,ht){ne=!1,le&&(le=!1,Jt()),L=!0;var Nt=se;try{var et;if(!e)return Ee(Ye,ht)}finally{X=null,se=Nt,L=!1}}function Ee(Ye,ht){var Nt=ht;for(re(Nt),X=i(Q);X!==null&&!(X.expirationTime>Nt&&(!Ye||j()));){var et=X.callback;if(typeof et=="function"){X.callback=null,se=X.priorityLevel;var pn=X.expirationTime<=Nt,Wn=et(pn);Nt=t.unstable_now(),typeof Wn=="function"?X.callback=Wn:X===i(Q)&&c(Q),re(Nt)}else c(Q);X=i(Q)}if(X!==null)return!0;var it=i(V);return it!==null&&dt(U,it.startTime-Nt),!1}function Te(Ye,ht){switch(Ye){case u:case A:case y:case x:case S:break;default:Ye=y}var Nt=se;se=Ye;try{return ht()}finally{se=Nt}}function Ne(Ye){var ht;switch(se){case u:case A:case y:ht=y;break;default:ht=se;break}var Nt=se;se=ht;try{return Ye()}finally{se=Nt}}function Ue(Ye){var ht=se;return function(){var Nt=se;se=ht;try{return Ye.apply(this,arguments)}finally{se=Nt}}}function ot(Ye,ht,Nt){var et=t.unstable_now(),pn;if(typeof Nt=="object"&&Nt!==null){var Wn=Nt.delay;typeof Wn=="number"&&Wn>0?pn=et+Wn:pn=et}else pn=et;var it;switch(Ye){case u:it=O;break;case A:it=I;break;case S:it=q;break;case x:it=K;break;case y:default:it=Y;break}var st=pn+it,En={id:ge++,callback:ht,priorityLevel:Ye,startTime:pn,expirationTime:st,sortIndex:-1};return pn>et?(En.sortIndex=pn,s(V,En),i(Q)===null&&En===i(V)&&(le?Jt():le=!0,dt(U,pn-et))):(En.sortIndex=st,s(Q,En),!ne&&!L&&(ne=!0,Ie(ee))),En}function lt(){}function pt(){!ne&&!L&&(ne=!0,Ie(ee))}function Lt(){return i(Q)}function qe(Ye){Ye.callback=null}function Dt(){return se}var me=!1,k=null,ce=-1,de=n,G=-1;function j(){var Ye=t.unstable_now()-G;return!(Ye<de)}function $(){}function ye(Ye){if(Ye<0||Ye>125){console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported");return}Ye>0?de=Math.floor(1e3/Ye):de=n}var Ce=function(){if(k!==null){var Ye=t.unstable_now();G=Ye;var ht=!0,Nt=!0;try{Nt=k(ht,Ye)}finally{Nt?Ae():(me=!1,k=null)}}else me=!1},Ae;if(typeof ae=="function")Ae=function(){ae(Ce)};else if(typeof MessageChannel<"u"){var ze=new MessageChannel,We=ze.port2;ze.port1.onmessage=Ce,Ae=function(){We.postMessage(null)}}else Ae=function(){pe(Ce,0)};function Ie(Ye){k=Ye,me||(me=!0,Ae())}function dt(Ye,ht){ce=pe(function(){Ye(t.unstable_now())},ht)}function Jt(){J(ce),ce=-1}var zt=$,pr=null;t.unstable_IdlePriority=S,t.unstable_ImmediatePriority=u,t.unstable_LowPriority=x,t.unstable_NormalPriority=y,t.unstable_Profiling=pr,t.unstable_UserBlockingPriority=A,t.unstable_cancelCallback=qe,t.unstable_continueExecution=pt,t.unstable_forceFrameRate=ye,t.unstable_getCurrentPriorityLevel=Dt,t.unstable_getFirstCallbackNode=Lt,t.unstable_next=Ne,t.unstable_pauseExecution=lt,t.unstable_requestPaint=zt,t.unstable_runWithPriority=Te,t.unstable_scheduleCallback=ot,t.unstable_shouldYield=j,t.unstable_wrapCallback=Ue,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)})()})(og)),og}var B2;function Zg(){return B2||(B2=1,process.env.NODE_ENV==="production"?Qp.exports=E8():Qp.exports=T8()),Qp.exports}/**
294
294
  * @license React
295
295
  * react-reconciler.production.min.js
296
296
  *
@@ -298,7 +298,7 @@ js: import "konva/skia-backend";
298
298
  *
299
299
  * This source code is licensed under the MIT license found in the
300
300
  * LICENSE file in the root directory of this source tree.
301
- */var lg,M2;function T8(){return M2||(M2=1,lg=function(e){var n={},s=oe,i=Zg(),c=Object.assign;function d(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,g=1;g<arguments.length;g++)l+="&args[]="+encodeURIComponent(arguments[g]);return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var h=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,p=Symbol.for("react.element"),u=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),I=Symbol.iterator;function Y(o){return o===null||typeof o!="object"?null:(o=I&&o[I]||o["@@iterator"],typeof o=="function"?o:null)}function K(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case A:return"Fragment";case u:return"Portal";case x:return"Profiler";case y:return"StrictMode";case R:return"Suspense";case D:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case C:return(o.displayName||"Context")+".Consumer";case S:return(o._context.displayName||"Context")+".Provider";case T:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return l=o.displayName||null,l!==null?l:K(o.type)||"Memo";case P:l=o._payload,o=o._init;try{return K(o(l))}catch{}}return null}function q(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(l);case 8:return l===y?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Q(o){var l=o,g=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(g=l.return),o=l.return;while(o)}return l.tag===3?g:null}function V(o){if(Q(o)!==o)throw Error(d(188))}function ge(o){var l=o.alternate;if(!l){if(l=Q(o),l===null)throw Error(d(188));return l!==o?null:o}for(var g=o,b=l;;){var E=g.return;if(E===null)break;var N=E.alternate;if(N===null){if(b=E.return,b!==null){g=b;continue}break}if(E.child===N.child){for(N=E.child;N;){if(N===g)return V(E),o;if(N===b)return V(E),l;N=N.sibling}throw Error(d(188))}if(g.return!==b.return)g=E,b=N;else{for(var W=!1,fe=E.child;fe;){if(fe===g){W=!0,g=E,b=N;break}if(fe===b){W=!0,b=E,g=N;break}fe=fe.sibling}if(!W){for(fe=N.child;fe;){if(fe===g){W=!0,g=N,b=E;break}if(fe===b){W=!0,b=N,g=E;break}fe=fe.sibling}if(!W)throw Error(d(189))}}if(g.alternate!==b)throw Error(d(190))}if(g.tag!==3)throw Error(d(188));return g.stateNode.current===g?o:l}function X(o){return o=ge(o),o!==null?se(o):null}function se(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var l=se(o);if(l!==null)return l;o=o.sibling}return null}function L(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var l=L(o);if(l!==null)return l}o=o.sibling}return null}var ne=Array.isArray,le=e.getPublicInstance,pe=e.getRootHostContext,J=e.getChildHostContext,ae=e.prepareForCommit,re=e.resetAfterCommit,U=e.createInstance,ee=e.appendInitialChild,Ee=e.finalizeInitialChildren,Te=e.prepareUpdate,Ne=e.shouldSetTextContent,Ue=e.createTextInstance,ot=e.scheduleTimeout,lt=e.cancelTimeout,pt=e.noTimeout,Lt=e.isPrimaryRenderer,qe=e.supportsMutation,Dt=e.supportsPersistence,me=e.supportsHydration,k=e.getInstanceFromNode,ce=e.preparePortalMount,de=e.getCurrentEventPriority,G=e.detachDeletedInstance,j=e.supportsMicrotasks,$=e.scheduleMicrotask,ye=e.supportsTestSelectors,Ce=e.findFiberRoot,Ae=e.getBoundingRect,ze=e.getTextContent,We=e.isHiddenSubtree,Ie=e.matchAccessibilityRole,dt=e.setFocusIfFocusable,Jt=e.setupIntersectionObserver,zt=e.appendChild,pr=e.appendChildToContainer,Ye=e.commitTextUpdate,ht=e.commitMount,Nt=e.commitUpdate,et=e.insertBefore,pn=e.insertInContainerBefore,Wn=e.removeChild,it=e.removeChildFromContainer,st=e.resetTextContent,En=e.hideInstance,un=e.hideTextInstance,Ut=e.unhideInstance,Ea=e.unhideTextInstance,Ta=e.clearContainer,ps=e.cloneInstance,Qt=e.createContainerChildSet,Va=e.appendChildToContainerChildSet,As=e.finalizeContainerChildren,Ii=e.replaceContainerChildren,Ai=e.cloneHiddenInstance,qa=e.cloneHiddenTextInstance,ms=e.canHydrateInstance,Lu=e.canHydrateTextInstance,mA=e.canHydrateSuspenseInstance,Yo=e.isSuspenseInstancePending,tr=e.isSuspenseInstanceFallback,ku=e.getSuspenseInstanceFallbackErrorDetails,Nf=e.registerSuspenseInstanceRetry,to=e.getNextHydratableSibling,gs=e.getFirstHydratableChild,Nu=e.getFirstHydratableChildWithinContainer,Oi=e.getFirstHydratableChildWithinSuspenseInstance,Bu=e.hydrateInstance,Mu=e.hydrateTextInstance,Vo=e.hydrateSuspenseInstance,qo=e.getNextHydratableInstanceAfterSuspenseInstance,no=e.commitHydratedContainer,mi=e.commitHydratedSuspenseInstance,gA=e.clearSuspenseBoundary,jl=e.clearSuspenseBoundaryFromContainer,vA=e.shouldDeleteUnhydratedTailInstances,yA=e.didNotMatchHydratedContainerTextInstance,Bf=e.didNotMatchHydratedTextInstance,Gl;function vs(o){if(Gl===void 0)try{throw Error()}catch(g){var l=g.stack.trim().match(/\n( *(at )?)/);Gl=l&&l[1]||""}return`
301
+ */var lg,M2;function R8(){return M2||(M2=1,lg=function(e){var n={},s=oe,i=Zg(),c=Object.assign;function d(o){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+o,g=1;g<arguments.length;g++)l+="&args[]="+encodeURIComponent(arguments[g]);return"Minified React error #"+o+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var h=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,p=Symbol.for("react.element"),u=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),C=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),D=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),P=Symbol.for("react.lazy"),O=Symbol.for("react.offscreen"),I=Symbol.iterator;function Y(o){return o===null||typeof o!="object"?null:(o=I&&o[I]||o["@@iterator"],typeof o=="function"?o:null)}function K(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case A:return"Fragment";case u:return"Portal";case x:return"Profiler";case y:return"StrictMode";case R:return"Suspense";case D:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case C:return(o.displayName||"Context")+".Consumer";case S:return(o._context.displayName||"Context")+".Provider";case T:var l=o.render;return o=o.displayName,o||(o=l.displayName||l.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case M:return l=o.displayName||null,l!==null?l:K(o.type)||"Memo";case P:l=o._payload,o=o._init;try{return K(o(l))}catch{}}return null}function q(o){var l=o.type;switch(o.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=l.render,o=o.displayName||o.name||"",l.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return K(l);case 8:return l===y?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Q(o){var l=o,g=o;if(o.alternate)for(;l.return;)l=l.return;else{o=l;do l=o,(l.flags&4098)!==0&&(g=l.return),o=l.return;while(o)}return l.tag===3?g:null}function V(o){if(Q(o)!==o)throw Error(d(188))}function ge(o){var l=o.alternate;if(!l){if(l=Q(o),l===null)throw Error(d(188));return l!==o?null:o}for(var g=o,b=l;;){var E=g.return;if(E===null)break;var N=E.alternate;if(N===null){if(b=E.return,b!==null){g=b;continue}break}if(E.child===N.child){for(N=E.child;N;){if(N===g)return V(E),o;if(N===b)return V(E),l;N=N.sibling}throw Error(d(188))}if(g.return!==b.return)g=E,b=N;else{for(var W=!1,fe=E.child;fe;){if(fe===g){W=!0,g=E,b=N;break}if(fe===b){W=!0,b=E,g=N;break}fe=fe.sibling}if(!W){for(fe=N.child;fe;){if(fe===g){W=!0,g=N,b=E;break}if(fe===b){W=!0,b=N,g=E;break}fe=fe.sibling}if(!W)throw Error(d(189))}}if(g.alternate!==b)throw Error(d(190))}if(g.tag!==3)throw Error(d(188));return g.stateNode.current===g?o:l}function X(o){return o=ge(o),o!==null?se(o):null}function se(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){var l=se(o);if(l!==null)return l;o=o.sibling}return null}function L(o){if(o.tag===5||o.tag===6)return o;for(o=o.child;o!==null;){if(o.tag!==4){var l=L(o);if(l!==null)return l}o=o.sibling}return null}var ne=Array.isArray,le=e.getPublicInstance,pe=e.getRootHostContext,J=e.getChildHostContext,ae=e.prepareForCommit,re=e.resetAfterCommit,U=e.createInstance,ee=e.appendInitialChild,Ee=e.finalizeInitialChildren,Te=e.prepareUpdate,Ne=e.shouldSetTextContent,Ue=e.createTextInstance,ot=e.scheduleTimeout,lt=e.cancelTimeout,pt=e.noTimeout,Lt=e.isPrimaryRenderer,qe=e.supportsMutation,Dt=e.supportsPersistence,me=e.supportsHydration,k=e.getInstanceFromNode,ce=e.preparePortalMount,de=e.getCurrentEventPriority,G=e.detachDeletedInstance,j=e.supportsMicrotasks,$=e.scheduleMicrotask,ye=e.supportsTestSelectors,Ce=e.findFiberRoot,Ae=e.getBoundingRect,ze=e.getTextContent,We=e.isHiddenSubtree,Ie=e.matchAccessibilityRole,dt=e.setFocusIfFocusable,Jt=e.setupIntersectionObserver,zt=e.appendChild,pr=e.appendChildToContainer,Ye=e.commitTextUpdate,ht=e.commitMount,Nt=e.commitUpdate,et=e.insertBefore,pn=e.insertInContainerBefore,Wn=e.removeChild,it=e.removeChildFromContainer,st=e.resetTextContent,En=e.hideInstance,un=e.hideTextInstance,Ut=e.unhideInstance,Ea=e.unhideTextInstance,Ta=e.clearContainer,ps=e.cloneInstance,Qt=e.createContainerChildSet,Va=e.appendChildToContainerChildSet,As=e.finalizeContainerChildren,Ii=e.replaceContainerChildren,Ai=e.cloneHiddenInstance,qa=e.cloneHiddenTextInstance,ms=e.canHydrateInstance,Lu=e.canHydrateTextInstance,mA=e.canHydrateSuspenseInstance,Yo=e.isSuspenseInstancePending,tr=e.isSuspenseInstanceFallback,ku=e.getSuspenseInstanceFallbackErrorDetails,Nf=e.registerSuspenseInstanceRetry,to=e.getNextHydratableSibling,gs=e.getFirstHydratableChild,Nu=e.getFirstHydratableChildWithinContainer,Oi=e.getFirstHydratableChildWithinSuspenseInstance,Bu=e.hydrateInstance,Mu=e.hydrateTextInstance,Vo=e.hydrateSuspenseInstance,qo=e.getNextHydratableInstanceAfterSuspenseInstance,no=e.commitHydratedContainer,mi=e.commitHydratedSuspenseInstance,gA=e.clearSuspenseBoundary,jl=e.clearSuspenseBoundaryFromContainer,vA=e.shouldDeleteUnhydratedTailInstances,yA=e.didNotMatchHydratedContainerTextInstance,Bf=e.didNotMatchHydratedTextInstance,Gl;function vs(o){if(Gl===void 0)try{throw Error()}catch(g){var l=g.stack.trim().match(/\n( *(at )?)/);Gl=l&&l[1]||""}return`
302
302
  `+Gl+o}var Hl=!1;function Pu(o,l){if(!o||Hl)return"";Hl=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(je){var b=je}Reflect.construct(o,[],l)}else{try{l.call()}catch(je){b=je}o.call(l.prototype)}else{try{throw Error()}catch(je){b=je}o()}}catch(je){if(je&&b&&typeof je.stack=="string"){for(var E=je.stack.split(`
303
303
  `),N=b.stack.split(`
304
304
  `),W=E.length-1,fe=N.length-1;1<=W&&0<=fe&&E[W]!==N[fe];)fe--;for(;1<=W&&0<=fe;W--,fe--)if(E[W]!==N[fe]){if(W!==1||fe!==1)do if(W--,fe--,0>fe||E[W]!==N[fe]){var we=`
@@ -316,7 +316,7 @@ No matching component was found for:
316
316
  *
317
317
  * This source code is licensed under the MIT license found in the
318
318
  * LICENSE file in the root directory of this source tree.
319
- */var P2;function R8(){return P2||(P2=1,process.env.NODE_ENV!=="production"&&(cg.exports=function(e){var n={},s=oe,i=Zg(),c=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,d=!1;function h(r){d=r}function p(r){if(!d){for(var a=arguments.length,f=new Array(a>1?a-1:0),m=1;m<a;m++)f[m-1]=arguments[m];A("warn",r,f)}}function u(r){if(!d){for(var a=arguments.length,f=new Array(a>1?a-1:0),m=1;m<a;m++)f[m-1]=arguments[m];A("error",r,f)}}function A(r,a,f){{var m=c.ReactDebugCurrentFrame,v=m.getStackAddendum();v!==""&&(a+="%s",f=f.concat([v]));var _=f.map(function(B){return String(B)});_.unshift("Warning: "+a),Function.prototype.apply.call(console[r],console,_)}}var y=Object.assign;function x(r){return r._reactInternals}function S(r,a){r._reactInternals=a}var C=!1,T=!1,R=!1,D=!0,M=!0,P=!0,O=!0,I=0,Y=1,K=2,q=3,Q=4,V=5,ge=6,X=7,se=8,L=9,ne=10,le=11,pe=12,J=13,ae=14,re=15,U=16,ee=17,Ee=18,Te=19,Ne=21,Ue=22,ot=23,lt=24,pt=25,Lt=Symbol.for("react.element"),qe=Symbol.for("react.portal"),Dt=Symbol.for("react.fragment"),me=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),ce=Symbol.for("react.provider"),de=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),ye=Symbol.for("react.memo"),Ce=Symbol.for("react.lazy"),Ae=Symbol.for("react.scope"),ze=Symbol.for("react.debug_trace_mode"),We=Symbol.for("react.offscreen"),Ie=Symbol.for("react.legacy_hidden"),dt=Symbol.for("react.cache"),Jt=Symbol.for("react.tracing_marker"),zt=Symbol.iterator,pr="@@iterator";function Ye(r){if(r===null||typeof r!="object")return null;var a=zt&&r[zt]||r[pr];return typeof a=="function"?a:null}function ht(r,a,f){var m=r.displayName;if(m)return m;var v=a.displayName||a.name||"";return v!==""?f+"("+v+")":f}function Nt(r){return r.displayName||"Context"}function et(r){if(r==null)return null;if(typeof r.tag=="number"&&u("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case Dt:return"Fragment";case qe:return"Portal";case k:return"Profiler";case me:return"StrictMode";case j:return"Suspense";case $:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case de:var a=r;return Nt(a)+".Consumer";case ce:var f=r;return Nt(f._context)+".Provider";case G:return ht(r,r.render,"ForwardRef");case ye:var m=r.displayName||null;return m!==null?m:et(r.type)||"Memo";case Ce:{var v=r,_=v._payload,B=v._init;try{return et(B(_))}catch{return null}}}return null}function pn(r,a,f){var m=a.displayName||a.name||"";return r.displayName||(m!==""?f+"("+m+")":f)}function Wn(r){return r.displayName||"Context"}function it(r){var a=r.tag,f=r.type;switch(a){case lt:return"Cache";case L:var m=f;return Wn(m)+".Consumer";case ne:var v=f;return Wn(v._context)+".Provider";case Ee:return"DehydratedFragment";case le:return pn(f,f.render,"ForwardRef");case X:return"Fragment";case V:return f;case Q:return"Portal";case q:return"Root";case ge:return"Text";case U:return et(f);case se:return f===me?"StrictMode":"Mode";case Ue:return"Offscreen";case pe:return"Profiler";case Ne:return"Scope";case J:return"Suspense";case Te:return"SuspenseList";case pt:return"TracingMarker";case Y:case I:case ee:case K:case ae:case re:if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;break}return null}var st=0,En=1,un=2,Ut=4,Ea=16,Ta=32,ps=64,Qt=128,Va=256,As=512,Ii=1024,Ai=2048,qa=4096,ms=8192,Lu=16384,mA=32767,Yo=32768,tr=65536,ku=131072,Nf=1048576,to=2097152,gs=4194304,Nu=8388608,Oi=16777216,Bu=33554432,Mu=Ut|Ii|0,Vo=un|Ut|Ea|Ta|As|qa|ms,qo=Ut|ps|As|ms,no=Ai|Ea,mi=gs|Nu|to,gA=c.ReactCurrentOwner;function jl(r){var a=r,f=r;if(r.alternate)for(;a.return;)a=a.return;else{var m=a;do a=m,(a.flags&(un|qa))!==st&&(f=a.return),m=a.return;while(m)}return a.tag===q?f:null}function vA(r){return jl(r)===r}function yA(r){{var a=gA.current;if(a!==null&&a.tag===Y){var f=a,m=f.stateNode;m._warnedAboutRefsInRender||u("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",it(f)||"A component"),m._warnedAboutRefsInRender=!0}}var v=x(r);return v?jl(v)===v:!1}function Bf(r){if(jl(r)!==r)throw new Error("Unable to find node on an unmounted component.")}function Gl(r){var a=r.alternate;if(!a){var f=jl(r);if(f===null)throw new Error("Unable to find node on an unmounted component.");return f!==r?null:r}for(var m=r,v=a;;){var _=m.return;if(_===null)break;var B=_.alternate;if(B===null){var F=_.return;if(F!==null){m=v=F;continue}break}if(_.child===B.child){for(var H=_.child;H;){if(H===m)return Bf(_),r;if(H===v)return Bf(_),a;H=H.sibling}throw new Error("Unable to find node on an unmounted component.")}if(m.return!==v.return)m=_,v=B;else{for(var Z=!1,ie=_.child;ie;){if(ie===m){Z=!0,m=_,v=B;break}if(ie===v){Z=!0,v=_,m=B;break}ie=ie.sibling}if(!Z){for(ie=B.child;ie;){if(ie===m){Z=!0,m=B,v=_;break}if(ie===v){Z=!0,v=B,m=_;break}ie=ie.sibling}if(!Z)throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(m.alternate!==v)throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(m.tag!==q)throw new Error("Unable to find node on an unmounted component.");return m.stateNode.current===m?r:a}function vs(r){var a=Gl(r);return a!==null?Hl(a):null}function Hl(r){if(r.tag===V||r.tag===ge)return r;for(var a=r.child;a!==null;){var f=Hl(a);if(f!==null)return f;a=a.sibling}return null}function Pu(r){var a=Gl(r);return a!==null?Mf(a):null}function Mf(r){if(r.tag===V||r.tag===ge)return r;for(var a=r.child;a!==null;){if(a.tag!==Q){var f=Mf(a);if(f!==null)return f}a=a.sibling}return null}var zu=Array.isArray;function Qn(r){return zu(r)}var Ka=e.getPublicInstance,An=e.getRootHostContext,hn=e.getChildHostContext,Ui=e.prepareForCommit,Ar=e.resetAfterCommit,Mr=e.createInstance,gi=e.appendInitialChild,ys=e.finalizeInitialChildren,wr=e.prepareUpdate,ro=e.shouldSetTextContent,Fu=e.createTextInstance,Iu=e.scheduleTimeout,Xl=e.cancelTimeout,Wl=e.noTimeout,Pr=e.isPrimaryRenderer,xA=e.warnsIfNotActing,qr=e.supportsMutation,Ql=e.supportsPersistence,_r=e.supportsHydration,Yl=e.getInstanceFromNode;e.beforeActiveInstanceBlur,e.afterActiveInstanceBlur;var Ko=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var Vl=e.getCurrentEventPriority,bA=e.detachDeletedInstance,SA=e.supportsMicrotasks,Ou=e.scheduleMicrotask,xs=e.supportsTestSelectors,Uu=e.findFiberRoot,Jo=e.getBoundingRect,CA=e.getTextContent,bs=e.isHiddenSubtree,$t=e.matchAccessibilityRole,Pf=e.setFocusIfFocusable,ju=e.setupIntersectionObserver,zf=e.appendChild,wA=e.appendChildToContainer,_A=e.commitTextUpdate,Yn=e.commitMount,Gu=e.commitUpdate,EA=e.insertBefore,Hu=e.insertInContainerBefore,TA=e.removeChild,ql=e.removeChildFromContainer,Ra=e.resetTextContent,RA=e.hideInstance,DA=e.hideTextInstance,Da=e.unhideInstance,vi=e.unhideTextInstance,Kl=e.clearContainer,Xu=e.cloneInstance,Wu=e.createContainerChildSet,Ff=e.appendChildToContainerChildSet,Ja=e.finalizeContainerChildren,ji=e.replaceContainerChildren,Ss=e.cloneHiddenInstance,Zo=e.cloneHiddenTextInstance,Jl=e.canHydrateInstance,fa=e.canHydrateTextInstance,ha=e.canHydrateSuspenseInstance,Gi=e.isSuspenseInstancePending,La=e.isSuspenseInstanceFallback,yi=e.getSuspenseInstanceFallbackErrorDetails,Cs=e.registerSuspenseInstanceRetry,$o=e.getNextHydratableSibling,Qu=e.getFirstHydratableChild,Yu=e.getFirstHydratableChildWithinContainer,Kr=e.getFirstHydratableChildWithinSuspenseInstance,pa=e.hydrateInstance,bn=e.hydrateTextInstance,el=e.hydrateSuspenseInstance,ka=e.getNextHydratableInstanceAfterSuspenseInstance,If=e.commitHydratedContainer,Of=e.commitHydratedSuspenseInstance,Vu=e.clearSuspenseBoundary,qu=e.clearSuspenseBoundaryFromContainer,Uf=e.shouldDeleteUnhydratedTailInstances,Zl=e.didNotMatchHydratedContainerTextInstance,jf=e.didNotMatchHydratedTextInstance,ao=e.didNotHydrateInstanceWithinContainer,Ku=e.didNotHydrateInstanceWithinSuspenseInstance,LA=e.didNotHydrateInstance,$l=e.didNotFindHydratableInstanceWithinContainer,kA=e.didNotFindHydratableTextInstanceWithinContainer,tl=e.didNotFindHydratableSuspenseInstanceWithinContainer,ec=e.didNotFindHydratableInstanceWithinSuspenseInstance,Gf=e.didNotFindHydratableTextInstanceWithinSuspenseInstance,Hf=e.didNotFindHydratableSuspenseInstanceWithinSuspenseInstance,io=e.didNotFindHydratableInstance,Xf=e.didNotFindHydratableTextInstance,tc=e.didNotFindHydratableSuspenseInstance,nc=e.errorHydratingContainer,Za=0,rc,ac,Ju,ic,sc,ws,Jr;function Hi(){}Hi.__reactDisabledLog=!0;function Zu(){{if(Za===0){rc=console.log,ac=console.info,Ju=console.warn,ic=console.error,sc=console.group,ws=console.groupCollapsed,Jr=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Hi,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}Za++}}function Wf(){{if(Za--,Za===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:y({},r,{value:rc}),info:y({},r,{value:ac}),warn:y({},r,{value:Ju}),error:y({},r,{value:ic}),group:y({},r,{value:sc}),groupCollapsed:y({},r,{value:ws}),groupEnd:y({},r,{value:Jr})})}Za<0&&u("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Aa=c.ReactCurrentDispatcher,$a;function ei(r,a,f){{if($a===void 0)try{throw Error()}catch(v){var m=v.stack.trim().match(/\n( *(at )?)/);$a=m&&m[1]||""}return`
319
+ */var P2;function D8(){return P2||(P2=1,process.env.NODE_ENV!=="production"&&(cg.exports=function(e){var n={},s=oe,i=Zg(),c=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,d=!1;function h(r){d=r}function p(r){if(!d){for(var a=arguments.length,f=new Array(a>1?a-1:0),m=1;m<a;m++)f[m-1]=arguments[m];A("warn",r,f)}}function u(r){if(!d){for(var a=arguments.length,f=new Array(a>1?a-1:0),m=1;m<a;m++)f[m-1]=arguments[m];A("error",r,f)}}function A(r,a,f){{var m=c.ReactDebugCurrentFrame,v=m.getStackAddendum();v!==""&&(a+="%s",f=f.concat([v]));var _=f.map(function(B){return String(B)});_.unshift("Warning: "+a),Function.prototype.apply.call(console[r],console,_)}}var y=Object.assign;function x(r){return r._reactInternals}function S(r,a){r._reactInternals=a}var C=!1,T=!1,R=!1,D=!0,M=!0,P=!0,O=!0,I=0,Y=1,K=2,q=3,Q=4,V=5,ge=6,X=7,se=8,L=9,ne=10,le=11,pe=12,J=13,ae=14,re=15,U=16,ee=17,Ee=18,Te=19,Ne=21,Ue=22,ot=23,lt=24,pt=25,Lt=Symbol.for("react.element"),qe=Symbol.for("react.portal"),Dt=Symbol.for("react.fragment"),me=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),ce=Symbol.for("react.provider"),de=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),ye=Symbol.for("react.memo"),Ce=Symbol.for("react.lazy"),Ae=Symbol.for("react.scope"),ze=Symbol.for("react.debug_trace_mode"),We=Symbol.for("react.offscreen"),Ie=Symbol.for("react.legacy_hidden"),dt=Symbol.for("react.cache"),Jt=Symbol.for("react.tracing_marker"),zt=Symbol.iterator,pr="@@iterator";function Ye(r){if(r===null||typeof r!="object")return null;var a=zt&&r[zt]||r[pr];return typeof a=="function"?a:null}function ht(r,a,f){var m=r.displayName;if(m)return m;var v=a.displayName||a.name||"";return v!==""?f+"("+v+")":f}function Nt(r){return r.displayName||"Context"}function et(r){if(r==null)return null;if(typeof r.tag=="number"&&u("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case Dt:return"Fragment";case qe:return"Portal";case k:return"Profiler";case me:return"StrictMode";case j:return"Suspense";case $:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case de:var a=r;return Nt(a)+".Consumer";case ce:var f=r;return Nt(f._context)+".Provider";case G:return ht(r,r.render,"ForwardRef");case ye:var m=r.displayName||null;return m!==null?m:et(r.type)||"Memo";case Ce:{var v=r,_=v._payload,B=v._init;try{return et(B(_))}catch{return null}}}return null}function pn(r,a,f){var m=a.displayName||a.name||"";return r.displayName||(m!==""?f+"("+m+")":f)}function Wn(r){return r.displayName||"Context"}function it(r){var a=r.tag,f=r.type;switch(a){case lt:return"Cache";case L:var m=f;return Wn(m)+".Consumer";case ne:var v=f;return Wn(v._context)+".Provider";case Ee:return"DehydratedFragment";case le:return pn(f,f.render,"ForwardRef");case X:return"Fragment";case V:return f;case Q:return"Portal";case q:return"Root";case ge:return"Text";case U:return et(f);case se:return f===me?"StrictMode":"Mode";case Ue:return"Offscreen";case pe:return"Profiler";case Ne:return"Scope";case J:return"Suspense";case Te:return"SuspenseList";case pt:return"TracingMarker";case Y:case I:case ee:case K:case ae:case re:if(typeof f=="function")return f.displayName||f.name||null;if(typeof f=="string")return f;break}return null}var st=0,En=1,un=2,Ut=4,Ea=16,Ta=32,ps=64,Qt=128,Va=256,As=512,Ii=1024,Ai=2048,qa=4096,ms=8192,Lu=16384,mA=32767,Yo=32768,tr=65536,ku=131072,Nf=1048576,to=2097152,gs=4194304,Nu=8388608,Oi=16777216,Bu=33554432,Mu=Ut|Ii|0,Vo=un|Ut|Ea|Ta|As|qa|ms,qo=Ut|ps|As|ms,no=Ai|Ea,mi=gs|Nu|to,gA=c.ReactCurrentOwner;function jl(r){var a=r,f=r;if(r.alternate)for(;a.return;)a=a.return;else{var m=a;do a=m,(a.flags&(un|qa))!==st&&(f=a.return),m=a.return;while(m)}return a.tag===q?f:null}function vA(r){return jl(r)===r}function yA(r){{var a=gA.current;if(a!==null&&a.tag===Y){var f=a,m=f.stateNode;m._warnedAboutRefsInRender||u("%s is accessing isMounted inside its render() function. render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.",it(f)||"A component"),m._warnedAboutRefsInRender=!0}}var v=x(r);return v?jl(v)===v:!1}function Bf(r){if(jl(r)!==r)throw new Error("Unable to find node on an unmounted component.")}function Gl(r){var a=r.alternate;if(!a){var f=jl(r);if(f===null)throw new Error("Unable to find node on an unmounted component.");return f!==r?null:r}for(var m=r,v=a;;){var _=m.return;if(_===null)break;var B=_.alternate;if(B===null){var F=_.return;if(F!==null){m=v=F;continue}break}if(_.child===B.child){for(var H=_.child;H;){if(H===m)return Bf(_),r;if(H===v)return Bf(_),a;H=H.sibling}throw new Error("Unable to find node on an unmounted component.")}if(m.return!==v.return)m=_,v=B;else{for(var Z=!1,ie=_.child;ie;){if(ie===m){Z=!0,m=_,v=B;break}if(ie===v){Z=!0,v=_,m=B;break}ie=ie.sibling}if(!Z){for(ie=B.child;ie;){if(ie===m){Z=!0,m=B,v=_;break}if(ie===v){Z=!0,v=B,m=_;break}ie=ie.sibling}if(!Z)throw new Error("Child was not found in either parent set. This indicates a bug in React related to the return pointer. Please file an issue.")}}if(m.alternate!==v)throw new Error("Return fibers should always be each others' alternates. This error is likely caused by a bug in React. Please file an issue.")}if(m.tag!==q)throw new Error("Unable to find node on an unmounted component.");return m.stateNode.current===m?r:a}function vs(r){var a=Gl(r);return a!==null?Hl(a):null}function Hl(r){if(r.tag===V||r.tag===ge)return r;for(var a=r.child;a!==null;){var f=Hl(a);if(f!==null)return f;a=a.sibling}return null}function Pu(r){var a=Gl(r);return a!==null?Mf(a):null}function Mf(r){if(r.tag===V||r.tag===ge)return r;for(var a=r.child;a!==null;){if(a.tag!==Q){var f=Mf(a);if(f!==null)return f}a=a.sibling}return null}var zu=Array.isArray;function Qn(r){return zu(r)}var Ka=e.getPublicInstance,An=e.getRootHostContext,hn=e.getChildHostContext,Ui=e.prepareForCommit,Ar=e.resetAfterCommit,Mr=e.createInstance,gi=e.appendInitialChild,ys=e.finalizeInitialChildren,wr=e.prepareUpdate,ro=e.shouldSetTextContent,Fu=e.createTextInstance,Iu=e.scheduleTimeout,Xl=e.cancelTimeout,Wl=e.noTimeout,Pr=e.isPrimaryRenderer,xA=e.warnsIfNotActing,qr=e.supportsMutation,Ql=e.supportsPersistence,_r=e.supportsHydration,Yl=e.getInstanceFromNode;e.beforeActiveInstanceBlur,e.afterActiveInstanceBlur;var Ko=e.preparePortalMount;e.prepareScopeUpdate,e.getInstanceFromScope;var Vl=e.getCurrentEventPriority,bA=e.detachDeletedInstance,SA=e.supportsMicrotasks,Ou=e.scheduleMicrotask,xs=e.supportsTestSelectors,Uu=e.findFiberRoot,Jo=e.getBoundingRect,CA=e.getTextContent,bs=e.isHiddenSubtree,$t=e.matchAccessibilityRole,Pf=e.setFocusIfFocusable,ju=e.setupIntersectionObserver,zf=e.appendChild,wA=e.appendChildToContainer,_A=e.commitTextUpdate,Yn=e.commitMount,Gu=e.commitUpdate,EA=e.insertBefore,Hu=e.insertInContainerBefore,TA=e.removeChild,ql=e.removeChildFromContainer,Ra=e.resetTextContent,RA=e.hideInstance,DA=e.hideTextInstance,Da=e.unhideInstance,vi=e.unhideTextInstance,Kl=e.clearContainer,Xu=e.cloneInstance,Wu=e.createContainerChildSet,Ff=e.appendChildToContainerChildSet,Ja=e.finalizeContainerChildren,ji=e.replaceContainerChildren,Ss=e.cloneHiddenInstance,Zo=e.cloneHiddenTextInstance,Jl=e.canHydrateInstance,fa=e.canHydrateTextInstance,ha=e.canHydrateSuspenseInstance,Gi=e.isSuspenseInstancePending,La=e.isSuspenseInstanceFallback,yi=e.getSuspenseInstanceFallbackErrorDetails,Cs=e.registerSuspenseInstanceRetry,$o=e.getNextHydratableSibling,Qu=e.getFirstHydratableChild,Yu=e.getFirstHydratableChildWithinContainer,Kr=e.getFirstHydratableChildWithinSuspenseInstance,pa=e.hydrateInstance,bn=e.hydrateTextInstance,el=e.hydrateSuspenseInstance,ka=e.getNextHydratableInstanceAfterSuspenseInstance,If=e.commitHydratedContainer,Of=e.commitHydratedSuspenseInstance,Vu=e.clearSuspenseBoundary,qu=e.clearSuspenseBoundaryFromContainer,Uf=e.shouldDeleteUnhydratedTailInstances,Zl=e.didNotMatchHydratedContainerTextInstance,jf=e.didNotMatchHydratedTextInstance,ao=e.didNotHydrateInstanceWithinContainer,Ku=e.didNotHydrateInstanceWithinSuspenseInstance,LA=e.didNotHydrateInstance,$l=e.didNotFindHydratableInstanceWithinContainer,kA=e.didNotFindHydratableTextInstanceWithinContainer,tl=e.didNotFindHydratableSuspenseInstanceWithinContainer,ec=e.didNotFindHydratableInstanceWithinSuspenseInstance,Gf=e.didNotFindHydratableTextInstanceWithinSuspenseInstance,Hf=e.didNotFindHydratableSuspenseInstanceWithinSuspenseInstance,io=e.didNotFindHydratableInstance,Xf=e.didNotFindHydratableTextInstance,tc=e.didNotFindHydratableSuspenseInstance,nc=e.errorHydratingContainer,Za=0,rc,ac,Ju,ic,sc,ws,Jr;function Hi(){}Hi.__reactDisabledLog=!0;function Zu(){{if(Za===0){rc=console.log,ac=console.info,Ju=console.warn,ic=console.error,sc=console.group,ws=console.groupCollapsed,Jr=console.groupEnd;var r={configurable:!0,enumerable:!0,value:Hi,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}Za++}}function Wf(){{if(Za--,Za===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:y({},r,{value:rc}),info:y({},r,{value:ac}),warn:y({},r,{value:Ju}),error:y({},r,{value:ic}),group:y({},r,{value:sc}),groupCollapsed:y({},r,{value:ws}),groupEnd:y({},r,{value:Jr})})}Za<0&&u("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Aa=c.ReactCurrentDispatcher,$a;function ei(r,a,f){{if($a===void 0)try{throw Error()}catch(v){var m=v.stack.trim().match(/\n( *(at )?)/);$a=m&&m[1]||""}return`
320
320
  `+$a+r}}var oc=!1,ma;{var Xi=typeof WeakMap=="function"?WeakMap:Map;ma=new Xi}function so(r,a){if(!r||oc)return"";{var f=ma.get(r);if(f!==void 0)return f}var m;oc=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _;_=Aa.current,Aa.current=null,Zu();try{if(a){var B=function(){throw Error()};if(Object.defineProperty(B.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(B,[])}catch(Pe){m=Pe}Reflect.construct(r,[],B)}else{try{B.call()}catch(Pe){m=Pe}r.call(B.prototype)}}else{try{throw Error()}catch(Pe){m=Pe}r()}}catch(Pe){if(Pe&&m&&typeof Pe.stack=="string"){for(var F=Pe.stack.split(`
321
321
  `),H=m.stack.split(`
322
322
  `),Z=F.length-1,ie=H.length-1;Z>=1&&ie>=0&&F[Z]!==H[ie];)ie--;for(;Z>=1&&ie>=0;Z--,ie--)if(F[Z]!==H[ie]){if(Z!==1||ie!==1)do if(Z--,ie--,ie<0||F[Z]!==H[ie]){var ve=`
@@ -374,7 +374,7 @@ See https://reactjs.org/link/refs-must-have-owner for more information.`)}}retur
374
374
  See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`)}function o0(r,a){if(s0)return!1;if(a===null)return u("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.",Le),!1;r.length!==a.length&&u(`The final argument passed to %s changed size between renders. The order and size of this array must remain constant.
375
375
 
376
376
  Previous: %s
377
- Incoming: %s`,Le,"["+a.join(", ")+"]","["+r.join(", ")+"]");for(var f=0;f<a.length&&f<r.length;f++)if(!xr(r[f],a[f]))return!1;return!0}function nu(r,a,f,m,v,_){bl=_,ln=a,oi=r!==null?r._debugHookTypes:null,To=-1,s0=r!==null&&r.type!==a.type,a.memoizedState=null,a.updateQueue=null,a.lanes=Me,r!==null&&r.memoizedState!==null?rt.current=Xv:oi!==null?rt.current=Hv:rt.current=Gv;var B=f(m,v);if(Dd){var F=0;do{if(Dd=!1,Ld=0,F>=P5)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");F+=1,s0=!1,cr=null,ur=null,a.updateQueue=null,To=-1,rt.current=Wv,B=f(m,v)}while(Dd)}rt.current=Vh,a._debugHookTypes=oi;var H=cr!==null&&cr.next!==null;if(bl=Me,ln=null,cr=null,ur=null,Le=null,oi=null,To=-1,r!==null&&(r.flags&mi)!==(a.flags&mi)&&(r.mode&jt)!==mt&&u("Internal React error: Expected static flag was missing. Please notify the React team."),Ph=!1,H)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return B}function ru(){var r=Ld!==0;return Ld=0,r}function Cv(r,a,f){a.updateQueue=r.updateQueue,(a.mode&Pa)!==mt?a.flags&=-50333701:a.flags&=-2053,r.lanes=na(r.lanes,f)}function wv(){if(rt.current=Vh,Ph){for(var r=ln.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}Ph=!1}bl=Me,ln=null,cr=null,ur=null,oi=null,To=-1,Le=null,Fv=!1,Dd=!1,Ld=0}function ns(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ur===null?ln.memoizedState=ur=r:ur=ur.next=r,ur}function li(){var r;if(cr===null){var a=ln.alternate;a!==null?r=a.memoizedState:r=null}else r=cr.next;var f;if(ur===null?f=ln.memoizedState:f=ur.next,f!==null)ur=f,f=ur.next,cr=r;else{if(r===null)throw new Error("Rendered more hooks than during the previous render.");cr=r;var m={memoizedState:cr.memoizedState,baseState:cr.baseState,baseQueue:cr.baseQueue,queue:cr.queue,next:null};ur===null?ln.memoizedState=ur=m:ur=ur.next=m}return ur}function _v(){return{lastEffect:null,stores:null}}function l0(r,a){return typeof a=="function"?a(r):a}function c0(r,a,f){var m=ns(),v;f!==void 0?v=f(a):v=a,m.memoizedState=m.baseState=v;var _={pending:null,interleaved:null,lanes:Me,dispatch:null,lastRenderedReducer:r,lastRenderedState:v};m.queue=_;var B=_.dispatch=U5.bind(null,ln,_);return[m.memoizedState,B]}function u0(r,a,f){var m=li(),v=m.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=r;var _=cr,B=_.baseQueue,F=v.pending;if(F!==null){if(B!==null){var H=B.next,Z=F.next;B.next=Z,F.next=H}_.baseQueue!==B&&u("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."),_.baseQueue=B=F,v.pending=null}if(B!==null){var ie=B.next,ve=_.baseState,_e=null,ke=null,Pe=null,Be=ie;do{var ut=Be.lane;if(Ir(bl,ut)){if(Pe!==null){var gt={lane:Ln,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null};Pe=Pe.next=gt}if(Be.hasEagerState)ve=Be.eagerState;else{var cn=Be.action;ve=r(ve,cn)}}else{var bt={lane:ut,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null};Pe===null?(ke=Pe=bt,_e=ve):Pe=Pe.next=bt,ln.lanes=Bt(ln.lanes,ut),$d(ut)}Be=Be.next}while(Be!==null&&Be!==ie);Pe===null?_e=ve:Pe.next=ke,xr(ve,m.memoizedState)||Od(),m.memoizedState=ve,m.baseState=_e,m.baseQueue=Pe,v.lastRenderedState=ve}var qt=v.interleaved;if(qt!==null){var Se=qt;do{var De=Se.lane;ln.lanes=Bt(ln.lanes,De),$d(De),Se=Se.next}while(Se!==qt)}else B===null&&(v.lanes=Me);var be=v.dispatch;return[m.memoizedState,be]}function d0(r,a,f){var m=li(),v=m.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=r;var _=v.dispatch,B=v.pending,F=m.memoizedState;if(B!==null){v.pending=null;var H=B.next,Z=H;do{var ie=Z.action;F=r(F,ie),Z=Z.next}while(Z!==H);xr(F,m.memoizedState)||Od(),m.memoizedState=F,m.baseQueue===null&&(m.baseState=F),v.lastRenderedState=F}return[F,_]}function n7(r,a,f){}function r7(r,a,f){}function f0(r,a,f){var m=ln,v=ns(),_,B=l();if(B){if(f===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");_=f(),eu||_!==f()&&(u("The result of getServerSnapshot should be cached to avoid an infinite loop"),eu=!0)}else{if(_=a(),!eu){var F=a();xr(_,F)||(u("The result of getSnapshot should be cached to avoid an infinite loop"),eu=!0)}var H=Cp();if(H===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");po(H,bl)||Ev(m,a,_)}v.memoizedState=_;var Z={value:_,getSnapshot:a};return v.queue=Z,Uh(Rv.bind(null,m,Z,r),[r]),m.flags|=Ai,kd(or|Tr,Tv.bind(null,m,Z,_,a),void 0,null),_}function zh(r,a,f){var m=ln,v=li(),_=a();if(!eu){var B=a();xr(_,B)||(u("The result of getSnapshot should be cached to avoid an infinite loop"),eu=!0)}var F=v.memoizedState,H=!xr(F,_);H&&(v.memoizedState=_,Od());var Z=v.queue;if(Bd(Rv.bind(null,m,Z,r),[r]),Z.getSnapshot!==a||H||ur!==null&&ur.memoizedState.tag&or){m.flags|=Ai,kd(or|Tr,Tv.bind(null,m,Z,_,a),void 0,null);var ie=Cp();if(ie===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");po(ie,bl)||Ev(m,a,_)}return _}function Ev(r,a,f){r.flags|=Lu;var m={getSnapshot:a,value:f},v=ln.updateQueue;if(v===null)v=_v(),ln.updateQueue=v,v.stores=[m];else{var _=v.stores;_===null?v.stores=[m]:_.push(m)}}function Tv(r,a,f,m){a.value=f,a.getSnapshot=m,Dv(a)&&Lv(r)}function Rv(r,a,f){var m=function(){Dv(a)&&Lv(r)};return f(m)}function Dv(r){var a=r.getSnapshot,f=r.value;try{var m=a();return!xr(f,m)}catch{return!0}}function Lv(r){var a=oa(r,vt);a!==null&&er(a,r,vt,dn)}function Fh(r){var a=ns();typeof r=="function"&&(r=r()),a.memoizedState=a.baseState=r;var f={pending:null,interleaved:null,lanes:Me,dispatch:null,lastRenderedReducer:l0,lastRenderedState:r};a.queue=f;var m=f.dispatch=j5.bind(null,ln,f);return[a.memoizedState,m]}function h0(r){return u0(l0)}function p0(r){return d0(l0)}function kd(r,a,f,m){var v={tag:r,create:a,destroy:f,deps:m,next:null},_=ln.updateQueue;if(_===null)_=_v(),ln.updateQueue=_,_.lastEffect=v.next=v;else{var B=_.lastEffect;if(B===null)_.lastEffect=v.next=v;else{var F=B.next;B.next=v,v.next=F,_.lastEffect=v}}return v}function A0(r){var a=ns();{var f={current:r};return a.memoizedState=f,f}}function Ih(r){var a=li();return a.memoizedState}function Nd(r,a,f,m){var v=ns(),_=m===void 0?null:m;ln.flags|=r,v.memoizedState=kd(or|a,f,void 0,_)}function Oh(r,a,f,m){var v=li(),_=m===void 0?null:m,B=void 0;if(cr!==null){var F=cr.memoizedState;if(B=F.destroy,_!==null){var H=F.deps;if(o0(_,H)){v.memoizedState=kd(a,f,B,_);return}}}ln.flags|=r,v.memoizedState=kd(or|a,f,B,_)}function Uh(r,a){return(ln.mode&Pa)!==mt?Nd(Bu|Ai|Nu,Tr,r,a):Nd(Ai|Nu,Tr,r,a)}function Bd(r,a){return Oh(Ai,Tr,r,a)}function m0(r,a){return Nd(Ut,ts,r,a)}function jh(r,a){return Oh(Ut,ts,r,a)}function g0(r,a){var f=Ut;return f|=gs,(ln.mode&Pa)!==mt&&(f|=Oi),Nd(f,lr,r,a)}function Gh(r,a){return Oh(Ut,lr,r,a)}function kv(r,a){if(typeof a=="function"){var f=a,m=r();return f(m),function(){f(null)}}else if(a!=null){var v=a;v.hasOwnProperty("current")||u("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(v).join(", ")+"}");var _=r();return v.current=_,function(){v.current=null}}}function v0(r,a,f){typeof a!="function"&&u("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",a!==null?typeof a:"null");var m=f!=null?f.concat([r]):null,v=Ut;return v|=gs,(ln.mode&Pa)!==mt&&(v|=Oi),Nd(v,lr,kv.bind(null,a,r),m)}function Hh(r,a,f){typeof a!="function"&&u("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",a!==null?typeof a:"null");var m=f!=null?f.concat([r]):null;return Oh(Ut,lr,kv.bind(null,a,r),m)}function F5(r,a){}var Xh=F5;function y0(r,a){var f=ns(),m=a===void 0?null:a;return f.memoizedState=[r,m],r}function Wh(r,a){var f=li(),m=a===void 0?null:a,v=f.memoizedState;if(v!==null&&m!==null){var _=v[1];if(o0(m,_))return v[0]}return f.memoizedState=[r,m],r}function x0(r,a){var f=ns(),m=a===void 0?null:a,v=r();return f.memoizedState=[v,m],v}function Qh(r,a){var f=li(),m=a===void 0?null:a,v=f.memoizedState;if(v!==null&&m!==null){var _=v[1];if(o0(m,_))return v[0]}var B=r();return f.memoizedState=[B,m],B}function b0(r){var a=ns();return a.memoizedState=r,r}function Nv(r){var a=li(),f=cr,m=f.memoizedState;return Mv(a,m,r)}function Bv(r){var a=li();if(cr===null)return a.memoizedState=r,r;var f=cr.memoizedState;return Mv(a,f,r)}function Mv(r,a,f){var m=!nh(bl);if(m){if(!xr(f,a)){var v=Tc();ln.lanes=Bt(ln.lanes,v),$d(v),r.baseState=!0}return a}else return r.baseState&&(r.baseState=!1,Od()),r.memoizedState=f,f}function I5(r,a,f){var m=Er();kn(sh(m,ni)),r(!0);var v=Rd.transition;Rd.transition={};var _=Rd.transition;Rd.transition._updatedFibers=new Set;try{r(!1),a()}finally{if(kn(m),Rd.transition=v,v===null&&_._updatedFibers){var B=_._updatedFibers.size;B>10&&p("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),_._updatedFibers.clear()}}}function S0(){var r=Fh(!1),a=r[0],f=r[1],m=I5.bind(null,f),v=ns();return v.memoizedState=m,[a,m]}function Pv(){var r=h0(),a=r[0],f=li(),m=f.memoizedState;return[a,m]}function zv(){var r=p0(),a=r[0],f=li(),m=f.memoizedState;return[a,m]}var Fv=!1;function O5(){return Fv}function C0(){var r=ns(),a=Cp(),f=a.identifierPrefix,m;if(l()){var v=dh();m=":"+f+"R"+v;var _=Ld++;_>0&&(m+="H"+_.toString(32)),m+=":"}else{var B=M5++;m=":"+f+"r"+B.toString(32)+":"}return r.memoizedState=m,m}function Yh(){var r=li(),a=r.memoizedState;return a}function U5(r,a,f){typeof arguments[3]=="function"&&u("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=ko(r),v={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(Iv(r))Ov(a,v);else{var _=pv(r,a,v,m);if(_!==null){var B=Wr();er(_,r,m,B),Uv(_,a,m)}}jv(r,m)}function j5(r,a,f){typeof arguments[3]=="function"&&u("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=ko(r),v={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(Iv(r))Ov(a,v);else{var _=r.alternate;if(r.lanes===Me&&(_===null||_.lanes===Me)){var B=a.lastRenderedReducer;if(B!==null){var F;F=rt.current,rt.current=Di;try{var H=a.lastRenderedState,Z=B(H,f);if(v.hasEagerState=!0,v.eagerState=Z,xr(Z,H)){_5(r,a,v,m);return}}catch{}finally{rt.current=F}}}var ie=pv(r,a,v,m);if(ie!==null){var ve=Wr();er(ie,r,m,ve),Uv(ie,a,m)}}jv(r,m)}function Iv(r){var a=r.alternate;return r===ln||a!==null&&a===ln}function Ov(r,a){Dd=Ph=!0;var f=r.pending;f===null?a.next=a:(a.next=f.next,f.next=a),r.pending=a}function Uv(r,a,f){if(ld(f)){var m=a.lanes;m=cd(m,r.pendingLanes);var v=Bt(m,f);a.lanes=v,ud(r,v)}}function jv(r,a,f){pl(r,a)}var Vh={readContext:Zn,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useInsertionEffect:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr,useDeferredValue:Xr,useTransition:Xr,useMutableSource:Xr,useSyncExternalStore:Xr,useId:Xr,unstable_isNewReconciler:C},Gv=null,Hv=null,Xv=null,Wv=null,rs=null,Di=null,qh=null;{var w0=function(){u("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")},Tt=function(){u("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks")};Gv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",an(),tu(a),y0(r,a)},useContext:function(r){return Le="useContext",an(),Zn(r)},useEffect:function(r,a){return Le="useEffect",an(),tu(a),Uh(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",an(),tu(f),v0(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",an(),tu(a),m0(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",an(),tu(a),g0(r,a)},useMemo:function(r,a){Le="useMemo",an(),tu(a);var f=rt.current;rt.current=rs;try{return x0(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",an();var m=rt.current;rt.current=rs;try{return c0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",an(),A0(r)},useState:function(r){Le="useState",an();var a=rt.current;rt.current=rs;try{return Fh(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",an(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",an(),b0(r)},useTransition:function(){return Le="useTransition",an(),S0()},useMutableSource:function(r,a,f){return Le="useMutableSource",an(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",an(),f0(r,a,f)},useId:function(){return Le="useId",an(),C0()},unstable_isNewReconciler:C},Hv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",Ke(),y0(r,a)},useContext:function(r){return Le="useContext",Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Ke(),Uh(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Ke(),v0(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Ke(),m0(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Ke(),g0(r,a)},useMemo:function(r,a){Le="useMemo",Ke();var f=rt.current;rt.current=rs;try{return x0(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Ke();var m=rt.current;rt.current=rs;try{return c0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Ke(),A0(r)},useState:function(r){Le="useState",Ke();var a=rt.current;rt.current=rs;try{return Fh(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Ke(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",Ke(),b0(r)},useTransition:function(){return Le="useTransition",Ke(),S0()},useMutableSource:function(r,a,f){return Le="useMutableSource",Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Ke(),f0(r,a,f)},useId:function(){return Le="useId",Ke(),C0()},unstable_isNewReconciler:C},Xv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Ke();var f=rt.current;rt.current=Di;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Ke();var m=rt.current;rt.current=Di;try{return u0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Ke(),Ih()},useState:function(r){Le="useState",Ke();var a=rt.current;rt.current=Di;try{return h0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Ke(),Nv(r)},useTransition:function(){return Le="useTransition",Ke(),Pv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Ke(),zh(r,a)},useId:function(){return Le="useId",Ke(),Yh()},unstable_isNewReconciler:C},Wv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Ke();var f=rt.current;rt.current=qh;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Ke();var m=rt.current;rt.current=qh;try{return d0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Ke(),Ih()},useState:function(r){Le="useState",Ke();var a=rt.current;rt.current=qh;try{return p0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Ke(),Bv(r)},useTransition:function(){return Le="useTransition",Ke(),zv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Ke(),zh(r,a)},useId:function(){return Le="useId",Ke(),Yh()},unstable_isNewReconciler:C},rs={readContext:function(r){return w0(),Zn(r)},useCallback:function(r,a){return Le="useCallback",Tt(),an(),y0(r,a)},useContext:function(r){return Le="useContext",Tt(),an(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Tt(),an(),Uh(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Tt(),an(),v0(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Tt(),an(),m0(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Tt(),an(),g0(r,a)},useMemo:function(r,a){Le="useMemo",Tt(),an();var f=rt.current;rt.current=rs;try{return x0(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Tt(),an();var m=rt.current;rt.current=rs;try{return c0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Tt(),an(),A0(r)},useState:function(r){Le="useState",Tt(),an();var a=rt.current;rt.current=rs;try{return Fh(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Tt(),an(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",Tt(),an(),b0(r)},useTransition:function(){return Le="useTransition",Tt(),an(),S0()},useMutableSource:function(r,a,f){return Le="useMutableSource",Tt(),an(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Tt(),an(),f0(r,a,f)},useId:function(){return Le="useId",Tt(),an(),C0()},unstable_isNewReconciler:C},Di={readContext:function(r){return w0(),Zn(r)},useCallback:function(r,a){return Le="useCallback",Tt(),Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Tt(),Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Tt(),Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Tt(),Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Tt(),Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Tt(),Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Tt(),Ke();var f=rt.current;rt.current=Di;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Tt(),Ke();var m=rt.current;rt.current=Di;try{return u0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Tt(),Ke(),Ih()},useState:function(r){Le="useState",Tt(),Ke();var a=rt.current;rt.current=Di;try{return h0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Tt(),Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Tt(),Ke(),Nv(r)},useTransition:function(){return Le="useTransition",Tt(),Ke(),Pv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Tt(),Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Tt(),Ke(),zh(r,a)},useId:function(){return Le="useId",Tt(),Ke(),Yh()},unstable_isNewReconciler:C},qh={readContext:function(r){return w0(),Zn(r)},useCallback:function(r,a){return Le="useCallback",Tt(),Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Tt(),Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Tt(),Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Tt(),Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Tt(),Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Tt(),Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Tt(),Ke();var f=rt.current;rt.current=Di;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Tt(),Ke();var m=rt.current;rt.current=Di;try{return d0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Tt(),Ke(),Ih()},useState:function(r){Le="useState",Tt(),Ke();var a=rt.current;rt.current=Di;try{return p0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Tt(),Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Tt(),Ke(),Bv(r)},useTransition:function(){return Le="useTransition",Tt(),Ke(),zv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Tt(),Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Tt(),Ke(),zh(r,a)},useId:function(){return Le="useId",Tt(),Ke(),Yh()},unstable_isNewReconciler:C}}var Ro=i.unstable_now,Qv=0,Kh=-1,Md=-1,Jh=-1,_0=!1,Zh=!1;function Yv(){return _0}function G5(){Zh=!0}function H5(){_0=!1,Zh=!1}function X5(){_0=Zh,Zh=!1}function Vv(){return Qv}function qv(){Qv=Ro()}function E0(r){Md=Ro(),r.actualStartTime<0&&(r.actualStartTime=Ro())}function Kv(r){Md=-1}function $h(r,a){if(Md>=0){var f=Ro()-Md;r.actualDuration+=f,a&&(r.selfBaseDuration=f),Md=-1}}function as(r){if(Kh>=0){var a=Ro()-Kh;Kh=-1;for(var f=r.return;f!==null;){switch(f.tag){case q:var m=f.stateNode;m.effectDuration+=a;return;case pe:var v=f.stateNode;v.effectDuration+=a;return}f=f.return}}}function T0(r){if(Jh>=0){var a=Ro()-Jh;Jh=-1;for(var f=r.return;f!==null;){switch(f.tag){case q:var m=f.stateNode;m!==null&&(m.passiveEffectDuration+=a);return;case pe:var v=f.stateNode;v!==null&&(v.passiveEffectDuration+=a);return}f=f.return}}}function is(){Kh=Ro()}function R0(){Jh=Ro()}function D0(r){for(var a=r.child;a;)r.actualDuration+=a.actualDuration,a=a.sibling}function Li(r,a){if(r&&r.defaultProps){var f=y({},a),m=r.defaultProps;for(var v in m)f[v]===void 0&&(f[v]=m[v]);return f}return a}var L0={},k0,N0,B0,M0,P0,Jv,ep,z0,F0,I0,Pd;{k0=new Set,N0=new Set,B0=new Set,M0=new Set,z0=new Set,P0=new Set,F0=new Set,I0=new Set,Pd=new Set;var Zv=new Set;ep=function(r,a){if(!(r===null||typeof r=="function")){var f=a+"_"+r;Zv.has(f)||(Zv.add(f),u("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",a,r))}},Jv=function(r,a){if(a===void 0){var f=et(r)||"Component";P0.has(f)||(P0.add(f),u("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.",f))}},Object.defineProperty(L0,"_processChildContext",{enumerable:!1,value:function(){throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).")}}),Object.freeze(L0)}function O0(r,a,f,m){var v=r.memoizedState,_=f(m,v);{if(r.mode&Tn){Fn(!0);try{_=f(m,v)}finally{Fn(!1)}}Jv(a,_)}var B=_==null?v:y({},v,_);if(r.memoizedState=B,r.lanes===Me){var F=r.updateQueue;F.baseState=B}}var U0={isMounted:yA,enqueueSetState:function(r,a,f){var m=x(r),v=Wr(),_=ko(m),B=Hs(v,_);B.payload=a,f!=null&&(ep(f,"setState"),B.callback=f);var F=wo(m,B,_);F!==null&&(er(F,m,_,v),Dh(F,m,_)),pl(m,_)},enqueueReplaceState:function(r,a,f){var m=x(r),v=Wr(),_=ko(m),B=Hs(v,_);B.tag=mv,B.payload=a,f!=null&&(ep(f,"replaceState"),B.callback=f);var F=wo(m,B,_);F!==null&&(er(F,m,_,v),Dh(F,m,_)),pl(m,_)},enqueueForceUpdate:function(r,a){var f=x(r),m=Wr(),v=ko(f),_=Hs(m,v);_.tag=Eh,a!=null&&(ep(a,"forceUpdate"),_.callback=a);var B=wo(f,_,v);B!==null&&(er(B,f,v,m),Dh(B,f,v)),Oc(f,v)}};function $v(r,a,f,m,v,_,B){var F=r.stateNode;if(typeof F.shouldComponentUpdate=="function"){var H=F.shouldComponentUpdate(m,_,B);{if(r.mode&Tn){Fn(!0);try{H=F.shouldComponentUpdate(m,_,B)}finally{Fn(!1)}}H===void 0&&u("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.",et(a)||"Component")}return H}return a.prototype&&a.prototype.isPureReactComponent?!W(f,m)||!W(v,_):!0}function W5(r,a,f){var m=r.stateNode;{var v=et(a)||"Component",_=m.render;_||(a.prototype&&typeof a.prototype.render=="function"?u("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?",v):u("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.",v)),m.getInitialState&&!m.getInitialState.isReactClassApproved&&!m.state&&u("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",v),m.getDefaultProps&&!m.getDefaultProps.isReactClassApproved&&u("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",v),m.propTypes&&u("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",v),m.contextType&&u("contextType was defined as an instance property on %s. Use a static property to define contextType instead.",v),a.childContextTypes&&!Pd.has(a)&&(r.mode&Tn)===mt&&(Pd.add(a),u(`%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead
377
+ Incoming: %s`,Le,"["+a.join(", ")+"]","["+r.join(", ")+"]");for(var f=0;f<a.length&&f<r.length;f++)if(!xr(r[f],a[f]))return!1;return!0}function nu(r,a,f,m,v,_){bl=_,ln=a,oi=r!==null?r._debugHookTypes:null,To=-1,s0=r!==null&&r.type!==a.type,a.memoizedState=null,a.updateQueue=null,a.lanes=Me,r!==null&&r.memoizedState!==null?rt.current=Xv:oi!==null?rt.current=Hv:rt.current=Gv;var B=f(m,v);if(Dd){var F=0;do{if(Dd=!1,Ld=0,F>=P5)throw new Error("Too many re-renders. React limits the number of renders to prevent an infinite loop.");F+=1,s0=!1,cr=null,ur=null,a.updateQueue=null,To=-1,rt.current=Wv,B=f(m,v)}while(Dd)}rt.current=Vh,a._debugHookTypes=oi;var H=cr!==null&&cr.next!==null;if(bl=Me,ln=null,cr=null,ur=null,Le=null,oi=null,To=-1,r!==null&&(r.flags&mi)!==(a.flags&mi)&&(r.mode&jt)!==mt&&u("Internal React error: Expected static flag was missing. Please notify the React team."),Ph=!1,H)throw new Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement.");return B}function ru(){var r=Ld!==0;return Ld=0,r}function Cv(r,a,f){a.updateQueue=r.updateQueue,(a.mode&Pa)!==mt?a.flags&=-50333701:a.flags&=-2053,r.lanes=na(r.lanes,f)}function wv(){if(rt.current=Vh,Ph){for(var r=ln.memoizedState;r!==null;){var a=r.queue;a!==null&&(a.pending=null),r=r.next}Ph=!1}bl=Me,ln=null,cr=null,ur=null,oi=null,To=-1,Le=null,Fv=!1,Dd=!1,Ld=0}function ns(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ur===null?ln.memoizedState=ur=r:ur=ur.next=r,ur}function li(){var r;if(cr===null){var a=ln.alternate;a!==null?r=a.memoizedState:r=null}else r=cr.next;var f;if(ur===null?f=ln.memoizedState:f=ur.next,f!==null)ur=f,f=ur.next,cr=r;else{if(r===null)throw new Error("Rendered more hooks than during the previous render.");cr=r;var m={memoizedState:cr.memoizedState,baseState:cr.baseState,baseQueue:cr.baseQueue,queue:cr.queue,next:null};ur===null?ln.memoizedState=ur=m:ur=ur.next=m}return ur}function _v(){return{lastEffect:null,stores:null}}function l0(r,a){return typeof a=="function"?a(r):a}function c0(r,a,f){var m=ns(),v;f!==void 0?v=f(a):v=a,m.memoizedState=m.baseState=v;var _={pending:null,interleaved:null,lanes:Me,dispatch:null,lastRenderedReducer:r,lastRenderedState:v};m.queue=_;var B=_.dispatch=U5.bind(null,ln,_);return[m.memoizedState,B]}function u0(r,a,f){var m=li(),v=m.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=r;var _=cr,B=_.baseQueue,F=v.pending;if(F!==null){if(B!==null){var H=B.next,Z=F.next;B.next=Z,F.next=H}_.baseQueue!==B&&u("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."),_.baseQueue=B=F,v.pending=null}if(B!==null){var ie=B.next,ve=_.baseState,_e=null,ke=null,Pe=null,Be=ie;do{var ut=Be.lane;if(Ir(bl,ut)){if(Pe!==null){var gt={lane:Ln,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null};Pe=Pe.next=gt}if(Be.hasEagerState)ve=Be.eagerState;else{var cn=Be.action;ve=r(ve,cn)}}else{var bt={lane:ut,action:Be.action,hasEagerState:Be.hasEagerState,eagerState:Be.eagerState,next:null};Pe===null?(ke=Pe=bt,_e=ve):Pe=Pe.next=bt,ln.lanes=Bt(ln.lanes,ut),$d(ut)}Be=Be.next}while(Be!==null&&Be!==ie);Pe===null?_e=ve:Pe.next=ke,xr(ve,m.memoizedState)||Od(),m.memoizedState=ve,m.baseState=_e,m.baseQueue=Pe,v.lastRenderedState=ve}var qt=v.interleaved;if(qt!==null){var Se=qt;do{var De=Se.lane;ln.lanes=Bt(ln.lanes,De),$d(De),Se=Se.next}while(Se!==qt)}else B===null&&(v.lanes=Me);var be=v.dispatch;return[m.memoizedState,be]}function d0(r,a,f){var m=li(),v=m.queue;if(v===null)throw new Error("Should have a queue. This is likely a bug in React. Please file an issue.");v.lastRenderedReducer=r;var _=v.dispatch,B=v.pending,F=m.memoizedState;if(B!==null){v.pending=null;var H=B.next,Z=H;do{var ie=Z.action;F=r(F,ie),Z=Z.next}while(Z!==H);xr(F,m.memoizedState)||Od(),m.memoizedState=F,m.baseQueue===null&&(m.baseState=F),v.lastRenderedState=F}return[F,_]}function r7(r,a,f){}function a7(r,a,f){}function f0(r,a,f){var m=ln,v=ns(),_,B=l();if(B){if(f===void 0)throw new Error("Missing getServerSnapshot, which is required for server-rendered content. Will revert to client rendering.");_=f(),eu||_!==f()&&(u("The result of getServerSnapshot should be cached to avoid an infinite loop"),eu=!0)}else{if(_=a(),!eu){var F=a();xr(_,F)||(u("The result of getSnapshot should be cached to avoid an infinite loop"),eu=!0)}var H=Cp();if(H===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");po(H,bl)||Ev(m,a,_)}v.memoizedState=_;var Z={value:_,getSnapshot:a};return v.queue=Z,Uh(Rv.bind(null,m,Z,r),[r]),m.flags|=Ai,kd(or|Tr,Tv.bind(null,m,Z,_,a),void 0,null),_}function zh(r,a,f){var m=ln,v=li(),_=a();if(!eu){var B=a();xr(_,B)||(u("The result of getSnapshot should be cached to avoid an infinite loop"),eu=!0)}var F=v.memoizedState,H=!xr(F,_);H&&(v.memoizedState=_,Od());var Z=v.queue;if(Bd(Rv.bind(null,m,Z,r),[r]),Z.getSnapshot!==a||H||ur!==null&&ur.memoizedState.tag&or){m.flags|=Ai,kd(or|Tr,Tv.bind(null,m,Z,_,a),void 0,null);var ie=Cp();if(ie===null)throw new Error("Expected a work-in-progress root. This is a bug in React. Please file an issue.");po(ie,bl)||Ev(m,a,_)}return _}function Ev(r,a,f){r.flags|=Lu;var m={getSnapshot:a,value:f},v=ln.updateQueue;if(v===null)v=_v(),ln.updateQueue=v,v.stores=[m];else{var _=v.stores;_===null?v.stores=[m]:_.push(m)}}function Tv(r,a,f,m){a.value=f,a.getSnapshot=m,Dv(a)&&Lv(r)}function Rv(r,a,f){var m=function(){Dv(a)&&Lv(r)};return f(m)}function Dv(r){var a=r.getSnapshot,f=r.value;try{var m=a();return!xr(f,m)}catch{return!0}}function Lv(r){var a=oa(r,vt);a!==null&&er(a,r,vt,dn)}function Fh(r){var a=ns();typeof r=="function"&&(r=r()),a.memoizedState=a.baseState=r;var f={pending:null,interleaved:null,lanes:Me,dispatch:null,lastRenderedReducer:l0,lastRenderedState:r};a.queue=f;var m=f.dispatch=j5.bind(null,ln,f);return[a.memoizedState,m]}function h0(r){return u0(l0)}function p0(r){return d0(l0)}function kd(r,a,f,m){var v={tag:r,create:a,destroy:f,deps:m,next:null},_=ln.updateQueue;if(_===null)_=_v(),ln.updateQueue=_,_.lastEffect=v.next=v;else{var B=_.lastEffect;if(B===null)_.lastEffect=v.next=v;else{var F=B.next;B.next=v,v.next=F,_.lastEffect=v}}return v}function A0(r){var a=ns();{var f={current:r};return a.memoizedState=f,f}}function Ih(r){var a=li();return a.memoizedState}function Nd(r,a,f,m){var v=ns(),_=m===void 0?null:m;ln.flags|=r,v.memoizedState=kd(or|a,f,void 0,_)}function Oh(r,a,f,m){var v=li(),_=m===void 0?null:m,B=void 0;if(cr!==null){var F=cr.memoizedState;if(B=F.destroy,_!==null){var H=F.deps;if(o0(_,H)){v.memoizedState=kd(a,f,B,_);return}}}ln.flags|=r,v.memoizedState=kd(or|a,f,B,_)}function Uh(r,a){return(ln.mode&Pa)!==mt?Nd(Bu|Ai|Nu,Tr,r,a):Nd(Ai|Nu,Tr,r,a)}function Bd(r,a){return Oh(Ai,Tr,r,a)}function m0(r,a){return Nd(Ut,ts,r,a)}function jh(r,a){return Oh(Ut,ts,r,a)}function g0(r,a){var f=Ut;return f|=gs,(ln.mode&Pa)!==mt&&(f|=Oi),Nd(f,lr,r,a)}function Gh(r,a){return Oh(Ut,lr,r,a)}function kv(r,a){if(typeof a=="function"){var f=a,m=r();return f(m),function(){f(null)}}else if(a!=null){var v=a;v.hasOwnProperty("current")||u("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.","an object with keys {"+Object.keys(v).join(", ")+"}");var _=r();return v.current=_,function(){v.current=null}}}function v0(r,a,f){typeof a!="function"&&u("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",a!==null?typeof a:"null");var m=f!=null?f.concat([r]):null,v=Ut;return v|=gs,(ln.mode&Pa)!==mt&&(v|=Oi),Nd(v,lr,kv.bind(null,a,r),m)}function Hh(r,a,f){typeof a!="function"&&u("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.",a!==null?typeof a:"null");var m=f!=null?f.concat([r]):null;return Oh(Ut,lr,kv.bind(null,a,r),m)}function F5(r,a){}var Xh=F5;function y0(r,a){var f=ns(),m=a===void 0?null:a;return f.memoizedState=[r,m],r}function Wh(r,a){var f=li(),m=a===void 0?null:a,v=f.memoizedState;if(v!==null&&m!==null){var _=v[1];if(o0(m,_))return v[0]}return f.memoizedState=[r,m],r}function x0(r,a){var f=ns(),m=a===void 0?null:a,v=r();return f.memoizedState=[v,m],v}function Qh(r,a){var f=li(),m=a===void 0?null:a,v=f.memoizedState;if(v!==null&&m!==null){var _=v[1];if(o0(m,_))return v[0]}var B=r();return f.memoizedState=[B,m],B}function b0(r){var a=ns();return a.memoizedState=r,r}function Nv(r){var a=li(),f=cr,m=f.memoizedState;return Mv(a,m,r)}function Bv(r){var a=li();if(cr===null)return a.memoizedState=r,r;var f=cr.memoizedState;return Mv(a,f,r)}function Mv(r,a,f){var m=!nh(bl);if(m){if(!xr(f,a)){var v=Tc();ln.lanes=Bt(ln.lanes,v),$d(v),r.baseState=!0}return a}else return r.baseState&&(r.baseState=!1,Od()),r.memoizedState=f,f}function I5(r,a,f){var m=Er();kn(sh(m,ni)),r(!0);var v=Rd.transition;Rd.transition={};var _=Rd.transition;Rd.transition._updatedFibers=new Set;try{r(!1),a()}finally{if(kn(m),Rd.transition=v,v===null&&_._updatedFibers){var B=_._updatedFibers.size;B>10&&p("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),_._updatedFibers.clear()}}}function S0(){var r=Fh(!1),a=r[0],f=r[1],m=I5.bind(null,f),v=ns();return v.memoizedState=m,[a,m]}function Pv(){var r=h0(),a=r[0],f=li(),m=f.memoizedState;return[a,m]}function zv(){var r=p0(),a=r[0],f=li(),m=f.memoizedState;return[a,m]}var Fv=!1;function O5(){return Fv}function C0(){var r=ns(),a=Cp(),f=a.identifierPrefix,m;if(l()){var v=dh();m=":"+f+"R"+v;var _=Ld++;_>0&&(m+="H"+_.toString(32)),m+=":"}else{var B=M5++;m=":"+f+"r"+B.toString(32)+":"}return r.memoizedState=m,m}function Yh(){var r=li(),a=r.memoizedState;return a}function U5(r,a,f){typeof arguments[3]=="function"&&u("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=ko(r),v={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(Iv(r))Ov(a,v);else{var _=pv(r,a,v,m);if(_!==null){var B=Wr();er(_,r,m,B),Uv(_,a,m)}}jv(r,m)}function j5(r,a,f){typeof arguments[3]=="function"&&u("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect().");var m=ko(r),v={lane:m,action:f,hasEagerState:!1,eagerState:null,next:null};if(Iv(r))Ov(a,v);else{var _=r.alternate;if(r.lanes===Me&&(_===null||_.lanes===Me)){var B=a.lastRenderedReducer;if(B!==null){var F;F=rt.current,rt.current=Di;try{var H=a.lastRenderedState,Z=B(H,f);if(v.hasEagerState=!0,v.eagerState=Z,xr(Z,H)){_5(r,a,v,m);return}}catch{}finally{rt.current=F}}}var ie=pv(r,a,v,m);if(ie!==null){var ve=Wr();er(ie,r,m,ve),Uv(ie,a,m)}}jv(r,m)}function Iv(r){var a=r.alternate;return r===ln||a!==null&&a===ln}function Ov(r,a){Dd=Ph=!0;var f=r.pending;f===null?a.next=a:(a.next=f.next,f.next=a),r.pending=a}function Uv(r,a,f){if(ld(f)){var m=a.lanes;m=cd(m,r.pendingLanes);var v=Bt(m,f);a.lanes=v,ud(r,v)}}function jv(r,a,f){pl(r,a)}var Vh={readContext:Zn,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useInsertionEffect:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr,useDeferredValue:Xr,useTransition:Xr,useMutableSource:Xr,useSyncExternalStore:Xr,useId:Xr,unstable_isNewReconciler:C},Gv=null,Hv=null,Xv=null,Wv=null,rs=null,Di=null,qh=null;{var w0=function(){u("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo().")},Tt=function(){u("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks")};Gv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",an(),tu(a),y0(r,a)},useContext:function(r){return Le="useContext",an(),Zn(r)},useEffect:function(r,a){return Le="useEffect",an(),tu(a),Uh(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",an(),tu(f),v0(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",an(),tu(a),m0(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",an(),tu(a),g0(r,a)},useMemo:function(r,a){Le="useMemo",an(),tu(a);var f=rt.current;rt.current=rs;try{return x0(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",an();var m=rt.current;rt.current=rs;try{return c0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",an(),A0(r)},useState:function(r){Le="useState",an();var a=rt.current;rt.current=rs;try{return Fh(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",an(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",an(),b0(r)},useTransition:function(){return Le="useTransition",an(),S0()},useMutableSource:function(r,a,f){return Le="useMutableSource",an(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",an(),f0(r,a,f)},useId:function(){return Le="useId",an(),C0()},unstable_isNewReconciler:C},Hv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",Ke(),y0(r,a)},useContext:function(r){return Le="useContext",Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Ke(),Uh(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Ke(),v0(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Ke(),m0(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Ke(),g0(r,a)},useMemo:function(r,a){Le="useMemo",Ke();var f=rt.current;rt.current=rs;try{return x0(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Ke();var m=rt.current;rt.current=rs;try{return c0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Ke(),A0(r)},useState:function(r){Le="useState",Ke();var a=rt.current;rt.current=rs;try{return Fh(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Ke(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",Ke(),b0(r)},useTransition:function(){return Le="useTransition",Ke(),S0()},useMutableSource:function(r,a,f){return Le="useMutableSource",Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Ke(),f0(r,a,f)},useId:function(){return Le="useId",Ke(),C0()},unstable_isNewReconciler:C},Xv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Ke();var f=rt.current;rt.current=Di;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Ke();var m=rt.current;rt.current=Di;try{return u0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Ke(),Ih()},useState:function(r){Le="useState",Ke();var a=rt.current;rt.current=Di;try{return h0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Ke(),Nv(r)},useTransition:function(){return Le="useTransition",Ke(),Pv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Ke(),zh(r,a)},useId:function(){return Le="useId",Ke(),Yh()},unstable_isNewReconciler:C},Wv={readContext:function(r){return Zn(r)},useCallback:function(r,a){return Le="useCallback",Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Ke();var f=rt.current;rt.current=qh;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Ke();var m=rt.current;rt.current=qh;try{return d0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Ke(),Ih()},useState:function(r){Le="useState",Ke();var a=rt.current;rt.current=qh;try{return p0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Ke(),Bv(r)},useTransition:function(){return Le="useTransition",Ke(),zv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Ke(),zh(r,a)},useId:function(){return Le="useId",Ke(),Yh()},unstable_isNewReconciler:C},rs={readContext:function(r){return w0(),Zn(r)},useCallback:function(r,a){return Le="useCallback",Tt(),an(),y0(r,a)},useContext:function(r){return Le="useContext",Tt(),an(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Tt(),an(),Uh(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Tt(),an(),v0(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Tt(),an(),m0(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Tt(),an(),g0(r,a)},useMemo:function(r,a){Le="useMemo",Tt(),an();var f=rt.current;rt.current=rs;try{return x0(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Tt(),an();var m=rt.current;rt.current=rs;try{return c0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Tt(),an(),A0(r)},useState:function(r){Le="useState",Tt(),an();var a=rt.current;rt.current=rs;try{return Fh(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Tt(),an(),void 0},useDeferredValue:function(r){return Le="useDeferredValue",Tt(),an(),b0(r)},useTransition:function(){return Le="useTransition",Tt(),an(),S0()},useMutableSource:function(r,a,f){return Le="useMutableSource",Tt(),an(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Tt(),an(),f0(r,a,f)},useId:function(){return Le="useId",Tt(),an(),C0()},unstable_isNewReconciler:C},Di={readContext:function(r){return w0(),Zn(r)},useCallback:function(r,a){return Le="useCallback",Tt(),Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Tt(),Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Tt(),Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Tt(),Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Tt(),Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Tt(),Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Tt(),Ke();var f=rt.current;rt.current=Di;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Tt(),Ke();var m=rt.current;rt.current=Di;try{return u0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Tt(),Ke(),Ih()},useState:function(r){Le="useState",Tt(),Ke();var a=rt.current;rt.current=Di;try{return h0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Tt(),Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Tt(),Ke(),Nv(r)},useTransition:function(){return Le="useTransition",Tt(),Ke(),Pv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Tt(),Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Tt(),Ke(),zh(r,a)},useId:function(){return Le="useId",Tt(),Ke(),Yh()},unstable_isNewReconciler:C},qh={readContext:function(r){return w0(),Zn(r)},useCallback:function(r,a){return Le="useCallback",Tt(),Ke(),Wh(r,a)},useContext:function(r){return Le="useContext",Tt(),Ke(),Zn(r)},useEffect:function(r,a){return Le="useEffect",Tt(),Ke(),Bd(r,a)},useImperativeHandle:function(r,a,f){return Le="useImperativeHandle",Tt(),Ke(),Hh(r,a,f)},useInsertionEffect:function(r,a){return Le="useInsertionEffect",Tt(),Ke(),jh(r,a)},useLayoutEffect:function(r,a){return Le="useLayoutEffect",Tt(),Ke(),Gh(r,a)},useMemo:function(r,a){Le="useMemo",Tt(),Ke();var f=rt.current;rt.current=Di;try{return Qh(r,a)}finally{rt.current=f}},useReducer:function(r,a,f){Le="useReducer",Tt(),Ke();var m=rt.current;rt.current=Di;try{return d0(r,a,f)}finally{rt.current=m}},useRef:function(r){return Le="useRef",Tt(),Ke(),Ih()},useState:function(r){Le="useState",Tt(),Ke();var a=rt.current;rt.current=Di;try{return p0(r)}finally{rt.current=a}},useDebugValue:function(r,a){return Le="useDebugValue",Tt(),Ke(),Xh()},useDeferredValue:function(r){return Le="useDeferredValue",Tt(),Ke(),Bv(r)},useTransition:function(){return Le="useTransition",Tt(),Ke(),zv()},useMutableSource:function(r,a,f){return Le="useMutableSource",Tt(),Ke(),void 0},useSyncExternalStore:function(r,a,f){return Le="useSyncExternalStore",Tt(),Ke(),zh(r,a)},useId:function(){return Le="useId",Tt(),Ke(),Yh()},unstable_isNewReconciler:C}}var Ro=i.unstable_now,Qv=0,Kh=-1,Md=-1,Jh=-1,_0=!1,Zh=!1;function Yv(){return _0}function G5(){Zh=!0}function H5(){_0=!1,Zh=!1}function X5(){_0=Zh,Zh=!1}function Vv(){return Qv}function qv(){Qv=Ro()}function E0(r){Md=Ro(),r.actualStartTime<0&&(r.actualStartTime=Ro())}function Kv(r){Md=-1}function $h(r,a){if(Md>=0){var f=Ro()-Md;r.actualDuration+=f,a&&(r.selfBaseDuration=f),Md=-1}}function as(r){if(Kh>=0){var a=Ro()-Kh;Kh=-1;for(var f=r.return;f!==null;){switch(f.tag){case q:var m=f.stateNode;m.effectDuration+=a;return;case pe:var v=f.stateNode;v.effectDuration+=a;return}f=f.return}}}function T0(r){if(Jh>=0){var a=Ro()-Jh;Jh=-1;for(var f=r.return;f!==null;){switch(f.tag){case q:var m=f.stateNode;m!==null&&(m.passiveEffectDuration+=a);return;case pe:var v=f.stateNode;v!==null&&(v.passiveEffectDuration+=a);return}f=f.return}}}function is(){Kh=Ro()}function R0(){Jh=Ro()}function D0(r){for(var a=r.child;a;)r.actualDuration+=a.actualDuration,a=a.sibling}function Li(r,a){if(r&&r.defaultProps){var f=y({},a),m=r.defaultProps;for(var v in m)f[v]===void 0&&(f[v]=m[v]);return f}return a}var L0={},k0,N0,B0,M0,P0,Jv,ep,z0,F0,I0,Pd;{k0=new Set,N0=new Set,B0=new Set,M0=new Set,z0=new Set,P0=new Set,F0=new Set,I0=new Set,Pd=new Set;var Zv=new Set;ep=function(r,a){if(!(r===null||typeof r=="function")){var f=a+"_"+r;Zv.has(f)||(Zv.add(f),u("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",a,r))}},Jv=function(r,a){if(a===void 0){var f=et(r)||"Component";P0.has(f)||(P0.add(f),u("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.",f))}},Object.defineProperty(L0,"_processChildContext",{enumerable:!1,value:function(){throw new Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal).")}}),Object.freeze(L0)}function O0(r,a,f,m){var v=r.memoizedState,_=f(m,v);{if(r.mode&Tn){Fn(!0);try{_=f(m,v)}finally{Fn(!1)}}Jv(a,_)}var B=_==null?v:y({},v,_);if(r.memoizedState=B,r.lanes===Me){var F=r.updateQueue;F.baseState=B}}var U0={isMounted:yA,enqueueSetState:function(r,a,f){var m=x(r),v=Wr(),_=ko(m),B=Hs(v,_);B.payload=a,f!=null&&(ep(f,"setState"),B.callback=f);var F=wo(m,B,_);F!==null&&(er(F,m,_,v),Dh(F,m,_)),pl(m,_)},enqueueReplaceState:function(r,a,f){var m=x(r),v=Wr(),_=ko(m),B=Hs(v,_);B.tag=mv,B.payload=a,f!=null&&(ep(f,"replaceState"),B.callback=f);var F=wo(m,B,_);F!==null&&(er(F,m,_,v),Dh(F,m,_)),pl(m,_)},enqueueForceUpdate:function(r,a){var f=x(r),m=Wr(),v=ko(f),_=Hs(m,v);_.tag=Eh,a!=null&&(ep(a,"forceUpdate"),_.callback=a);var B=wo(f,_,v);B!==null&&(er(B,f,v,m),Dh(B,f,v)),Oc(f,v)}};function $v(r,a,f,m,v,_,B){var F=r.stateNode;if(typeof F.shouldComponentUpdate=="function"){var H=F.shouldComponentUpdate(m,_,B);{if(r.mode&Tn){Fn(!0);try{H=F.shouldComponentUpdate(m,_,B)}finally{Fn(!1)}}H===void 0&&u("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.",et(a)||"Component")}return H}return a.prototype&&a.prototype.isPureReactComponent?!W(f,m)||!W(v,_):!0}function W5(r,a,f){var m=r.stateNode;{var v=et(a)||"Component",_=m.render;_||(a.prototype&&typeof a.prototype.render=="function"?u("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?",v):u("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.",v)),m.getInitialState&&!m.getInitialState.isReactClassApproved&&!m.state&&u("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?",v),m.getDefaultProps&&!m.getDefaultProps.isReactClassApproved&&u("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.",v),m.propTypes&&u("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.",v),m.contextType&&u("contextType was defined as an instance property on %s. Use a static property to define contextType instead.",v),a.childContextTypes&&!Pd.has(a)&&(r.mode&Tn)===mt&&(Pd.add(a),u(`%s uses the legacy childContextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() instead
378
378
 
379
379
  .Learn more about this warning here: https://reactjs.org/link/legacy-context`,v)),a.contextTypes&&!Pd.has(a)&&(r.mode&Tn)===mt&&(Pd.add(a),u(`%s uses the legacy contextTypes API which is no longer supported and will be removed in the next major release. Use React.createContext() with static contextType instead.
380
380
 
@@ -435,7 +435,7 @@ This ensures that you're testing the behavior the user would see in the browser.
435
435
 
436
436
  Check the render method of \``+Z+"`.")}throw new Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) "+("but got: "+(r==null?r:typeof r)+"."+H))}}var ie=Ua(B,f,a,v);return ie.elementType=r,ie.type=F,ie.lanes=_,ie._debugOwner=m,ie}function Im(r,a,f){var m=null;m=r._owner;var v=r.type,_=r.key,B=r.props,F=Fm(v,_,B,m,a,f);return F._debugSource=r._source,F._debugOwner=r._owner,F}function Bo(r,a,f,m){var v=Ua(X,r,m,a);return v.lanes=f,v}function T4(r,a,f,m){typeof r.id!="string"&&u('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.',typeof r.id);var v=Ua(pe,r,m,a|tn);return v.elementType=k,v.lanes=f,v.stateNode={effectDuration:0,passiveEffectDuration:0},v}function R4(r,a,f,m){var v=Ua(J,r,m,a);return v.elementType=j,v.lanes=f,v}function D4(r,a,f,m){var v=Ua(Te,r,m,a);return v.elementType=$,v.lanes=f,v}function gy(r,a,f,m){var v=Ua(Ue,r,m,a);v.elementType=We,v.lanes=f;var _={isHidden:!1};return v.stateNode=_,v}function Om(r,a,f){var m=Ua(ge,r,null,a);return m.lanes=f,m}function L4(){var r=Ua(V,null,null,mt);return r.elementType="DELETED",r}function k4(r){var a=Ua(Ee,null,null,mt);return a.stateNode=r,a}function Um(r,a,f){var m=r.children!==null?r.children:[],v=Ua(Q,m,r.key,a);return v.lanes=f,v.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},v}function vy(r,a){return r===null&&(r=Ua(K,null,null,mt)),r.tag=a.tag,r.key=a.key,r.elementType=a.elementType,r.type=a.type,r.stateNode=a.stateNode,r.return=a.return,r.child=a.child,r.sibling=a.sibling,r.index=a.index,r.ref=a.ref,r.pendingProps=a.pendingProps,r.memoizedProps=a.memoizedProps,r.updateQueue=a.updateQueue,r.memoizedState=a.memoizedState,r.dependencies=a.dependencies,r.mode=a.mode,r.flags=a.flags,r.subtreeFlags=a.subtreeFlags,r.deletions=a.deletions,r.lanes=a.lanes,r.childLanes=a.childLanes,r.alternate=a.alternate,r.actualDuration=a.actualDuration,r.actualStartTime=a.actualStartTime,r.selfBaseDuration=a.selfBaseDuration,r.treeBaseDuration=a.treeBaseDuration,r._debugSource=a._debugSource,r._debugOwner=a._debugOwner,r._debugNeedsRemount=a._debugNeedsRemount,r._debugHookTypes=a._debugHookTypes,r}function N4(r,a,f,m,v){this.tag=a,this.containerInfo=r,this.pendingChildren=null,this.current=null,this.pingCache=null,this.finishedWork=null,this.timeoutHandle=Wl,this.context=null,this.pendingContext=null,this.callbackNode=null,this.callbackPriority=Ln,this.eventTimes=mo(Me),this.expirationTimes=mo(dn),this.pendingLanes=Me,this.suspendedLanes=Me,this.pingedLanes=Me,this.expiredLanes=Me,this.mutableReadLanes=Me,this.finishedLanes=Me,this.entangledLanes=Me,this.entanglements=mo(Me),this.identifierPrefix=m,this.onRecoverableError=v,_r&&(this.mutableSourceEagerHydrationData=null),this.effectDuration=0,this.passiveEffectDuration=0;{this.memoizedUpdaters=new Set;for(var _=this.pendingUpdatersLaneMap=[],B=0;B<Ts;B++)_.push(new Set)}switch(a){case dc:this._debugRootType=f?"hydrateRoot()":"createRoot()";break;case ti:this._debugRootType=f?"hydrate()":"render()";break}}function yy(r,a,f,m,v,_,B,F,H,Z){var ie=new N4(r,a,f,F,H),ve=E4(a,_);ie.current=ve,ve.stateNode=ie;{var _e={element:m,isDehydrated:f,cache:null,transitions:null,pendingSuspenseBoundaries:null};ve.memoizedState=_e}return KA(ve),ie}var B4="18.3.1";function M4(r,a,f){var m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null;return g5(m),{$$typeof:qe,key:m==null?null:""+m,children:r,containerInfo:a,implementation:f}}var jm,Gm;jm=!1,Gm={};function xy(r){if(!r)return mr;var a=x(r),f=ga(a);if(a.tag===Y){var m=a.type;if(zr(m))return uc(a,m,f)}return f}function P4(r){var a=x(r);if(a===void 0){if(typeof r.render=="function")throw new Error("Unable to find node on an unmounted component.");var f=Object.keys(r).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+f)}var m=vs(a);return m===null?null:m.stateNode}function z4(r,a){{var f=x(r);if(f===void 0){if(typeof r.render=="function")throw new Error("Unable to find node on an unmounted component.");var m=Object.keys(r).join(",");throw new Error("Argument appears to not be a ReactComponent. Keys: "+m)}var v=vs(f);if(v===null)return null;if(v.mode&Tn){var _=it(f)||"Component";if(!Gm[_]){Gm[_]=!0;var B=Je;try{Vt(v),f.mode&Tn?u("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",a,a,_):u("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node",a,a,_)}finally{B?Vt(B):Mt()}}}return v.stateNode}}function F4(r,a,f,m,v,_,B,F){var H=!1,Z=null;return yy(r,a,H,Z,f,m,v,_,B)}function I4(r,a,f,m,v,_,B,F,H,Z){var ie=!0,ve=yy(f,m,ie,r,v,_,B,F,H);ve.context=xy(null);var _e=ve.current,ke=Wr(),Pe=ko(_e),Be=Hs(ke,Pe);return Be.callback=a??null,wo(_e,Be,Pe),F3(ve,Pe,ke),ve}function by(r,a,f,m){Pc(a,r);var v=a.current,_=Wr(),B=ko(v);vo(B);var F=xy(f);a.context===null?a.context=F:a.pendingContext=F,St&&Je!==null&&!jm&&(jm=!0,u(`Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.
437
437
 
438
- Check the render method of %s.`,it(Je)||"Unknown"));var H=Hs(_,B);H.payload={element:r},m=m===void 0?null:m,m!==null&&(typeof m!="function"&&u("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",m),H.callback=m);var Z=wo(v,H,B);return Z!==null&&(er(Z,v,B,_),Dh(Z,v,B)),B}function O4(r){var a=r.current;if(!a.child)return null;switch(a.child.tag){case V:return Ka(a.child.stateNode);default:return a.child.stateNode}}function U4(r){switch(r.tag){case q:{var a=r.stateNode;if(Ci(a)){var f=th(a);j3(a,f)}break}case J:{wp(function(){var v=oa(r,vt);if(v!==null){var _=Wr();er(v,r,vt,_)}});var m=vt;Lp(r,m);break}}}function Sy(r,a){var f=r.memoizedState;f!==null&&f.dehydrated!==null&&(f.retryLane=ol(f.retryLane,a))}function Lp(r,a){Sy(r,a);var f=r.alternate;f&&Sy(f,a)}function j4(r){if(r.tag===J){var a=vt,f=oa(r,a);if(f!==null){var m=Wr();er(f,r,a,m)}Lp(r,a)}}function G4(r){if(r.tag===J){var a=Ns,f=oa(r,a);if(f!==null){var m=Wr();er(f,r,a,m)}Lp(r,a)}}function H4(r){if(r.tag===J){var a=ko(r),f=oa(r,a);if(f!==null){var m=Wr();er(f,r,a,m)}Lp(r,a)}}function X4(r){var a=Pu(r);return a===null?null:a.stateNode}var Cy=function(r){return null};function wy(r){return Cy(r)}var _y=function(r){return!1};function Ey(r){return _y(r)}var Ty=null,Ry=null,Dy=null,Ly=null,ky=null,Ny=null,By=null,My=null,Py=null;{var zy=function(r,a,f){var m=a[f],v=Qn(r)?r.slice():y({},r);return f+1===a.length?(Qn(v)?v.splice(m,1):delete v[m],v):(v[m]=zy(r[m],a,f+1),v)},Fy=function(r,a){return zy(r,a,0)},Iy=function(r,a,f,m){var v=a[m],_=Qn(r)?r.slice():y({},r);if(m+1===a.length){var B=f[m];_[B]=_[v],Qn(_)?_.splice(v,1):delete _[v]}else _[v]=Iy(r[v],a,f,m+1);return _},Oy=function(r,a,f){if(a.length!==f.length){p("copyWithRename() expects paths of the same length");return}else for(var m=0;m<f.length-1;m++)if(a[m]!==f[m]){p("copyWithRename() expects paths to be the same except for the deepest key");return}return Iy(r,a,f,0)},Uy=function(r,a,f,m){if(f>=a.length)return m;var v=a[f],_=Qn(r)?r.slice():y({},r);return _[v]=Uy(r[v],a,f+1,m),_},jy=function(r,a,f){return Uy(r,a,0,f)},Hm=function(r,a){for(var f=r.memoizedState;f!==null&&a>0;)f=f.next,a--;return f};Ty=function(r,a,f,m){var v=Hm(r,a);if(v!==null){var _=jy(v.memoizedState,f,m);v.memoizedState=_,v.baseState=_,r.memoizedProps=y({},r.memoizedProps);var B=oa(r,vt);B!==null&&er(B,r,vt,dn)}},Ry=function(r,a,f){var m=Hm(r,a);if(m!==null){var v=Fy(m.memoizedState,f);m.memoizedState=v,m.baseState=v,r.memoizedProps=y({},r.memoizedProps);var _=oa(r,vt);_!==null&&er(_,r,vt,dn)}},Dy=function(r,a,f,m){var v=Hm(r,a);if(v!==null){var _=Oy(v.memoizedState,f,m);v.memoizedState=_,v.baseState=_,r.memoizedProps=y({},r.memoizedProps);var B=oa(r,vt);B!==null&&er(B,r,vt,dn)}},Ly=function(r,a,f){r.pendingProps=jy(r.memoizedProps,a,f),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var m=oa(r,vt);m!==null&&er(m,r,vt,dn)},ky=function(r,a){r.pendingProps=Fy(r.memoizedProps,a),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var f=oa(r,vt);f!==null&&er(f,r,vt,dn)},Ny=function(r,a,f){r.pendingProps=Oy(r.memoizedProps,a,f),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var m=oa(r,vt);m!==null&&er(m,r,vt,dn)},By=function(r){var a=oa(r,vt);a!==null&&er(a,r,vt,dn)},My=function(r){Cy=r},Py=function(r){_y=r}}function W4(r){var a=vs(r);return a===null?null:a.stateNode}function Q4(r){return null}function Y4(){return Je}function V4(r){var a=r.findFiberByHostInstance,f=c.ReactCurrentDispatcher;return Mc({bundleType:r.bundleType,version:r.version,rendererPackageName:r.rendererPackageName,rendererConfig:r.rendererConfig,overrideHookState:Ty,overrideHookStateDeletePath:Ry,overrideHookStateRenamePath:Dy,overrideProps:Ly,overridePropsDeletePath:ky,overridePropsRenamePath:Ny,setErrorHandler:My,setSuspenseHandler:Py,scheduleUpdate:By,currentDispatcherRef:f,findHostInstanceByFiber:W4,findFiberByHostInstance:a||Q4,findHostInstancesForRefresh:y4,scheduleRefresh:g4,scheduleRoot:v4,setRefreshHandler:m4,getCurrentFiber:Y4,reconcilerVersion:B4})}return n.attemptContinuousHydration=G4,n.attemptDiscreteHydration=j4,n.attemptHydrationAtCurrentPriority=H4,n.attemptSynchronousHydration=U4,n.batchedUpdates=H3,n.createComponentSelector=y3,n.createContainer=F4,n.createHasPseudoClassSelector=x3,n.createHydrationContainer=I4,n.createPortal=M4,n.createRoleSelector=b3,n.createTestNameSelector=C3,n.createTextSelector=S3,n.deferredUpdates=G3,n.discreteUpdates=X3,n.findAllNodes=pp,n.findBoundingRects=E3,n.findHostInstance=P4,n.findHostInstanceWithNoPortals=X4,n.findHostInstanceWithWarning=z4,n.flushControlled=Q3,n.flushPassiveEffects=us,n.flushSync=wp,n.focusWithin=T3,n.getCurrentUpdatePriority=Er,n.getFindAllNodesFailureDescription=_3,n.getPublicRootInstance=O4,n.injectIntoDevTools=V4,n.isAlreadyRendering=W3,n.observeVisibleRects=D3,n.registerMutableSourceForHydration=B5,n.runWithPriority=dd,n.shouldError=wy,n.shouldSuspend=Ey,n.updateContainer=by,n})),cg.exports}var z2;function D8(){return z2||(z2=1,process.env.NODE_ENV==="production"?Wp.exports=T8():Wp.exports=R8()),Wp.exports}var L8=D8();const k8=lA(L8);var Yp={exports:{}},Mo={};/**
438
+ Check the render method of %s.`,it(Je)||"Unknown"));var H=Hs(_,B);H.payload={element:r},m=m===void 0?null:m,m!==null&&(typeof m!="function"&&u("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.",m),H.callback=m);var Z=wo(v,H,B);return Z!==null&&(er(Z,v,B,_),Dh(Z,v,B)),B}function O4(r){var a=r.current;if(!a.child)return null;switch(a.child.tag){case V:return Ka(a.child.stateNode);default:return a.child.stateNode}}function U4(r){switch(r.tag){case q:{var a=r.stateNode;if(Ci(a)){var f=th(a);j3(a,f)}break}case J:{wp(function(){var v=oa(r,vt);if(v!==null){var _=Wr();er(v,r,vt,_)}});var m=vt;Lp(r,m);break}}}function Sy(r,a){var f=r.memoizedState;f!==null&&f.dehydrated!==null&&(f.retryLane=ol(f.retryLane,a))}function Lp(r,a){Sy(r,a);var f=r.alternate;f&&Sy(f,a)}function j4(r){if(r.tag===J){var a=vt,f=oa(r,a);if(f!==null){var m=Wr();er(f,r,a,m)}Lp(r,a)}}function G4(r){if(r.tag===J){var a=Ns,f=oa(r,a);if(f!==null){var m=Wr();er(f,r,a,m)}Lp(r,a)}}function H4(r){if(r.tag===J){var a=ko(r),f=oa(r,a);if(f!==null){var m=Wr();er(f,r,a,m)}Lp(r,a)}}function X4(r){var a=Pu(r);return a===null?null:a.stateNode}var Cy=function(r){return null};function wy(r){return Cy(r)}var _y=function(r){return!1};function Ey(r){return _y(r)}var Ty=null,Ry=null,Dy=null,Ly=null,ky=null,Ny=null,By=null,My=null,Py=null;{var zy=function(r,a,f){var m=a[f],v=Qn(r)?r.slice():y({},r);return f+1===a.length?(Qn(v)?v.splice(m,1):delete v[m],v):(v[m]=zy(r[m],a,f+1),v)},Fy=function(r,a){return zy(r,a,0)},Iy=function(r,a,f,m){var v=a[m],_=Qn(r)?r.slice():y({},r);if(m+1===a.length){var B=f[m];_[B]=_[v],Qn(_)?_.splice(v,1):delete _[v]}else _[v]=Iy(r[v],a,f,m+1);return _},Oy=function(r,a,f){if(a.length!==f.length){p("copyWithRename() expects paths of the same length");return}else for(var m=0;m<f.length-1;m++)if(a[m]!==f[m]){p("copyWithRename() expects paths to be the same except for the deepest key");return}return Iy(r,a,f,0)},Uy=function(r,a,f,m){if(f>=a.length)return m;var v=a[f],_=Qn(r)?r.slice():y({},r);return _[v]=Uy(r[v],a,f+1,m),_},jy=function(r,a,f){return Uy(r,a,0,f)},Hm=function(r,a){for(var f=r.memoizedState;f!==null&&a>0;)f=f.next,a--;return f};Ty=function(r,a,f,m){var v=Hm(r,a);if(v!==null){var _=jy(v.memoizedState,f,m);v.memoizedState=_,v.baseState=_,r.memoizedProps=y({},r.memoizedProps);var B=oa(r,vt);B!==null&&er(B,r,vt,dn)}},Ry=function(r,a,f){var m=Hm(r,a);if(m!==null){var v=Fy(m.memoizedState,f);m.memoizedState=v,m.baseState=v,r.memoizedProps=y({},r.memoizedProps);var _=oa(r,vt);_!==null&&er(_,r,vt,dn)}},Dy=function(r,a,f,m){var v=Hm(r,a);if(v!==null){var _=Oy(v.memoizedState,f,m);v.memoizedState=_,v.baseState=_,r.memoizedProps=y({},r.memoizedProps);var B=oa(r,vt);B!==null&&er(B,r,vt,dn)}},Ly=function(r,a,f){r.pendingProps=jy(r.memoizedProps,a,f),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var m=oa(r,vt);m!==null&&er(m,r,vt,dn)},ky=function(r,a){r.pendingProps=Fy(r.memoizedProps,a),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var f=oa(r,vt);f!==null&&er(f,r,vt,dn)},Ny=function(r,a,f){r.pendingProps=Oy(r.memoizedProps,a,f),r.alternate&&(r.alternate.pendingProps=r.pendingProps);var m=oa(r,vt);m!==null&&er(m,r,vt,dn)},By=function(r){var a=oa(r,vt);a!==null&&er(a,r,vt,dn)},My=function(r){Cy=r},Py=function(r){_y=r}}function W4(r){var a=vs(r);return a===null?null:a.stateNode}function Q4(r){return null}function Y4(){return Je}function V4(r){var a=r.findFiberByHostInstance,f=c.ReactCurrentDispatcher;return Mc({bundleType:r.bundleType,version:r.version,rendererPackageName:r.rendererPackageName,rendererConfig:r.rendererConfig,overrideHookState:Ty,overrideHookStateDeletePath:Ry,overrideHookStateRenamePath:Dy,overrideProps:Ly,overridePropsDeletePath:ky,overridePropsRenamePath:Ny,setErrorHandler:My,setSuspenseHandler:Py,scheduleUpdate:By,currentDispatcherRef:f,findHostInstanceByFiber:W4,findFiberByHostInstance:a||Q4,findHostInstancesForRefresh:y4,scheduleRefresh:g4,scheduleRoot:v4,setRefreshHandler:m4,getCurrentFiber:Y4,reconcilerVersion:B4})}return n.attemptContinuousHydration=G4,n.attemptDiscreteHydration=j4,n.attemptHydrationAtCurrentPriority=H4,n.attemptSynchronousHydration=U4,n.batchedUpdates=H3,n.createComponentSelector=y3,n.createContainer=F4,n.createHasPseudoClassSelector=x3,n.createHydrationContainer=I4,n.createPortal=M4,n.createRoleSelector=b3,n.createTestNameSelector=C3,n.createTextSelector=S3,n.deferredUpdates=G3,n.discreteUpdates=X3,n.findAllNodes=pp,n.findBoundingRects=E3,n.findHostInstance=P4,n.findHostInstanceWithNoPortals=X4,n.findHostInstanceWithWarning=z4,n.flushControlled=Q3,n.flushPassiveEffects=us,n.flushSync=wp,n.focusWithin=T3,n.getCurrentUpdatePriority=Er,n.getFindAllNodesFailureDescription=_3,n.getPublicRootInstance=O4,n.injectIntoDevTools=V4,n.isAlreadyRendering=W3,n.observeVisibleRects=D3,n.registerMutableSourceForHydration=B5,n.runWithPriority=dd,n.shouldError=wy,n.shouldSuspend=Ey,n.updateContainer=by,n})),cg.exports}var z2;function L8(){return z2||(z2=1,process.env.NODE_ENV==="production"?Wp.exports=R8():Wp.exports=D8()),Wp.exports}var k8=L8();const N8=lA(k8);var Yp={exports:{}},Mo={};/**
439
439
  * @license React
440
440
  * react-reconciler-constants.production.min.js
441
441
  *
@@ -443,7 +443,7 @@ Check the render method of %s.`,it(Je)||"Unknown"));var H=Hs(_,B);H.payload={ele
443
443
  *
444
444
  * This source code is licensed under the MIT license found in the
445
445
  * LICENSE file in the root directory of this source tree.
446
- */var F2;function N8(){return F2||(F2=1,Mo.ConcurrentRoot=1,Mo.ContinuousEventPriority=4,Mo.DefaultEventPriority=16,Mo.DiscreteEventPriority=1,Mo.IdleEventPriority=536870912,Mo.LegacyRoot=0),Mo}var Po={};/**
446
+ */var F2;function B8(){return F2||(F2=1,Mo.ConcurrentRoot=1,Mo.ContinuousEventPriority=4,Mo.DefaultEventPriority=16,Mo.DiscreteEventPriority=1,Mo.IdleEventPriority=536870912,Mo.LegacyRoot=0),Mo}var Po={};/**
447
447
  * @license React
448
448
  * react-reconciler-constants.development.js
449
449
  *
@@ -451,19 +451,19 @@ Check the render method of %s.`,it(Je)||"Unknown"));var H=Hs(_,B);H.payload={ele
451
451
  *
452
452
  * This source code is licensed under the MIT license found in the
453
453
  * LICENSE file in the root directory of this source tree.
454
- */var I2;function B8(){return I2||(I2=1,process.env.NODE_ENV!=="production"&&(function(){var t=1,e=4,n=16,s=536870912,i=t,c=e,d=n,h=s,p=0,u=1;Po.ConcurrentRoot=u,Po.ContinuousEventPriority=c,Po.DefaultEventPriority=d,Po.DiscreteEventPriority=i,Po.IdleEventPriority=h,Po.LegacyRoot=p})()),Po}var O2;function M8(){return O2||(O2=1,process.env.NODE_ENV==="production"?Yp.exports=N8():Yp.exports=B8()),Yp.exports}var t5=M8();const U2={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let j2=!1,G2=!1;const $g=".react-konva-event",P8=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
454
+ */var I2;function M8(){return I2||(I2=1,process.env.NODE_ENV!=="production"&&(function(){var t=1,e=4,n=16,s=536870912,i=t,c=e,d=n,h=s,p=0,u=1;Po.ConcurrentRoot=u,Po.ContinuousEventPriority=c,Po.DefaultEventPriority=d,Po.DiscreteEventPriority=i,Po.IdleEventPriority=h,Po.LegacyRoot=p})()),Po}var O2;function P8(){return O2||(O2=1,process.env.NODE_ENV==="production"?Yp.exports=B8():Yp.exports=M8()),Yp.exports}var t5=P8();const U2={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let j2=!1,G2=!1;const $g=".react-konva-event",z8=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled.
455
455
  Position of a node will be changed during drag&drop, so you should update state of the react app as well.
456
456
  Consider to add onDragMove or onDragEnd events.
457
457
  For more info see: https://github.com/konvajs/react-konva/issues/256
458
- `,z8=`ReactKonva: You are using "zIndex" attribute for a Konva node.
458
+ `,F8=`ReactKonva: You are using "zIndex" attribute for a Konva node.
459
459
  react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
460
460
  For more info see: https://github.com/konvajs/react-konva/issues/194
461
- `,F8={};function AA(t,e,n=F8){if(!j2&&"zIndex"in e&&(console.warn(z8),j2=!0),!G2&&e.draggable){var s=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;s&&!i&&(console.warn(P8),G2=!0)}for(var c in n)if(!U2[c]){var d=c.slice(0,2)==="on",h=n[c]!==e[c];if(d&&h){var p=c.substr(2).toLowerCase();p.substr(0,7)==="content"&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),t.off(p,n[c])}var u=!e.hasOwnProperty(c);u&&t.setAttr(c,void 0)}var A=e._useStrictMode,y={},x=!1;const S={};for(var c in e)if(!U2[c]){var d=c.slice(0,2)==="on",C=n[c]!==e[c];if(d&&C){var p=c.substr(2).toLowerCase();p.substr(0,7)==="content"&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),e[c]&&(S[p]=e[c])}!d&&(e[c]!==n[c]||A&&e[c]!==t.getAttr(c))&&(x=!0,y[c]=e[c])}x&&(t.setAttrs(y),Qo(t));for(var p in S)t.on(p+$g,S[p])}function Qo(t){if(!Qe.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}var ug=Zg();const n5={},I8={};Pl.Node.prototype._applyProps=AA;function O8(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),Qo(t)}function U8(t,e,n){let s=Pl[t];s||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),s=Pl.Group);const i={},c={};for(var d in e){var h=d.slice(0,2)==="on";h?c[d]=e[d]:i[d]=e[d]}const p=new s(i);return AA(p,c),p}function j8(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function G8(t,e,n){return!1}function H8(t){return t}function X8(){return null}function W8(){return null}function Q8(t,e,n,s){return I8}function Y8(){}function V8(t){}function q8(t,e){return!1}function K8(){return n5}function J8(){return n5}const Z8=setTimeout,$8=clearTimeout,e9=-1;function t9(t,e){return!1}const n9=!1,r9=!0,a9=!0;function i9(t,e){e.parent===t?e.moveToTop():t.add(e),Qo(t)}function s9(t,e){e.parent===t?e.moveToTop():t.add(e),Qo(t)}function r5(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),Qo(t)}function o9(t,e,n){r5(t,e,n)}function l9(t,e){e.destroy(),e.off($g),Qo(t)}function c9(t,e){e.destroy(),e.off($g),Qo(t)}function u9(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function d9(t,e,n){}function f9(t,e,n,s,i){AA(t,i,s)}function h9(t){t.hide(),Qo(t)}function p9(t){}function A9(t,e){(e.visible==null||e.visible)&&t.show()}function m9(t,e){}function g9(t){}function v9(){}const y9=()=>t5.DefaultEventPriority,x9=Object.freeze(Object.defineProperty({__proto__:null,appendChild:i9,appendChildToContainer:s9,appendInitialChild:O8,cancelTimeout:$8,clearContainer:g9,commitMount:d9,commitTextUpdate:u9,commitUpdate:f9,createInstance:U8,createTextInstance:j8,detachDeletedInstance:v9,finalizeInitialChildren:G8,getChildHostContext:J8,getCurrentEventPriority:y9,getPublicInstance:H8,getRootHostContext:K8,hideInstance:h9,hideTextInstance:p9,idlePriority:ug.unstable_IdlePriority,insertBefore:r5,insertInContainerBefore:o9,isPrimaryRenderer:n9,noTimeout:e9,now:ug.unstable_now,prepareForCommit:X8,preparePortalMount:W8,prepareUpdate:Q8,removeChild:l9,removeChildFromContainer:c9,resetAfterCommit:Y8,resetTextContent:V8,run:ug.unstable_runWithPriority,scheduleTimeout:Z8,shouldDeprioritizeSubtree:q8,shouldSetTextContent:t9,supportsMutation:a9,unhideInstance:A9,unhideTextInstance:m9,warnsIfNotActing:r9},Symbol.toStringTag,{value:"Module"}));var b9=Object.defineProperty,S9=Object.defineProperties,C9=Object.getOwnPropertyDescriptors,H2=Object.getOwnPropertySymbols,w9=Object.prototype.hasOwnProperty,_9=Object.prototype.propertyIsEnumerable,X2=(t,e,n)=>e in t?b9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,W2=(t,e)=>{for(var n in e||(e={}))w9.call(e,n)&&X2(t,n,e[n]);if(H2)for(var n of H2(e))_9.call(e,n)&&X2(t,n,e[n]);return t},E9=(t,e)=>S9(t,C9(e)),Q2,Y2;typeof window<"u"&&((Q2=window.document)!=null&&Q2.createElement||((Y2=window.navigator)==null?void 0:Y2.product)==="ReactNative")?_a.useLayoutEffect:_a.useEffect;function a5(t,e,n){if(!t)return;if(n(t)===!0)return t;let s=t.child;for(;s;){const i=a5(s,e,n);if(i)return i;s=s.sibling}}function i5(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const V2=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=V2;return}return V2.apply(this,arguments)};const ev=i5(_a.createContext(null));class s5 extends _a.Component{render(){return _a.createElement(ev.Provider,{value:this._reactInternals},this.props.children)}}function T9(){const t=_a.useContext(ev);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=_a.useId();return _a.useMemo(()=>{for(const s of[t,t==null?void 0:t.alternate]){if(!s)continue;const i=a5(s,!1,c=>{let d=c.memoizedState;for(;d;){if(d.memoizedState===e)return!0;d=d.next}});if(i)return i}},[t,e])}function R9(){const t=T9(),[e]=_a.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==ev&&!e.has(i)&&e.set(i,_a.useContext(i5(i)))}n=n.return}return e}function o5(){const t=R9();return _a.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>s=>_a.createElement(e,null,_a.createElement(n.Provider,E9(W2({},s),{value:t.get(n)}))),e=>_a.createElement(s5,W2({},e))),[t])}function D9(t){const e=oe.useRef({});return oe.useLayoutEffect(()=>{e.current=t}),oe.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const L9=t=>{const e=oe.useRef(null),n=oe.useRef(null),s=oe.useRef(null),i=D9(t),c=o5(),d=h=>{const{forwardedRef:p}=t;p&&(typeof p=="function"?p(h):p.current=h)};return oe.useLayoutEffect(()=>(n.current=new Pl.Stage({width:t.width,height:t.height,container:e.current}),d(n.current),s.current=vf.createContainer(n.current,t5.LegacyRoot,!1,null),vf.updateContainer(oe.createElement(c,{},t.children),s.current),()=>{Pl.isBrowser&&(d(null),vf.updateContainer(null,s.current,null),n.current.destroy())}),[]),oe.useLayoutEffect(()=>{d(n.current),AA(n.current,t,i),vf.updateContainer(oe.createElement(c,{},t.children),s.current,null)}),oe.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},l5="Layer",di="Group",Vr="Rect",tv="Ellipse",Uo="Line",nA="Image",Ks="Text",nv="Arrow",rv="Transformer",vf=k8(x9);vf.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:process.env.NODE_ENV!=="production"?1:0,version:oe.version,rendererPackageName:"react-konva"});const c5=oe.forwardRef((t,e)=>oe.createElement(s5,{},oe.createElement(L9,{...t,forwardedRef:e}))),Vp=960,qp=540,u5=(t,e,n)=>{if(!n.enabled)return{x:t.x,y:t.y,guides:[]};let s=t.x,i=t.y;const c=[],d=Math.max(n.threshold,15),h=t.x,p=t.x+t.width,u=t.x+t.width/2,A=t.y,y=t.y+t.height,x=t.y+t.height/2,S=Vp/2,C=qp/2;if(n.snapToCenter&&(Math.abs(u-S)<d?(s=S-t.width/2,c.push({type:"vertical",position:S,isCenter:!0})):Math.abs(h-S)<d?(s=S,c.push({type:"vertical",position:S,isCenter:!0})):Math.abs(p-S)<d&&(s=S-t.width,c.push({type:"vertical",position:S,isCenter:!0})),Math.abs(x-C)<d?(i=C-t.height/2,c.push({type:"horizontal",position:C,isCenter:!0})):Math.abs(A-C)<d?(i=C,c.push({type:"horizontal",position:C,isCenter:!0})):Math.abs(y-C)<d&&(i=C-t.height,c.push({type:"horizontal",position:C,isCenter:!0}))),n.snapToEdges&&(Math.abs(h)<d&&(s=0,c.push({type:"vertical",position:0})),Math.abs(p-Vp)<d&&(s=Vp-t.width,c.push({type:"vertical",position:Vp})),Math.abs(A)<d&&(i=0,c.push({type:"horizontal",position:0})),Math.abs(y-qp)<d&&(i=qp-t.height,c.push({type:"horizontal",position:qp}))),n.snapToElements)for(const T of e){const R=T.x,D=T.x+T.width,M=T.x+T.width/2,P=T.y,O=T.y+T.height,I=T.y+T.height/2;Math.abs(h-R)<d&&(s=R,c.push({type:"vertical",position:R})),Math.abs(p-D)<d&&(s=D-t.width,c.push({type:"vertical",position:D})),Math.abs(u-M)<d&&(s=M-t.width/2,c.push({type:"vertical",position:M})),Math.abs(A-P)<d&&(i=P,c.push({type:"horizontal",position:P})),Math.abs(y-O)<d&&(i=O-t.height,c.push({type:"horizontal",position:O})),Math.abs(x-I)<d&&(i=I-t.height/2,c.push({type:"horizontal",position:I}))}return{x:s,y:i,guides:c}};var vu={},q2;function k9(){if(q2)return vu;q2=1;var t=Z2;if(process.env.NODE_ENV==="production")vu.createRoot=t.createRoot,vu.hydrateRoot=t.hydrateRoot;else{var e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;vu.createRoot=function(n,s){e.usingClientEntryPoint=!0;try{return t.createRoot(n,s)}finally{e.usingClientEntryPoint=!1}},vu.hydrateRoot=function(n,s,i){e.usingClientEntryPoint=!0;try{return t.hydrateRoot(n,s,i)}finally{e.usingClientEntryPoint=!1}}}return vu}var N9=k9();const B9=lA(N9);var M9=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]]);return n};const P9=t=>{const e=window.getComputedStyle(t).position;return!(e==="absolute"||e==="relative")};function z9(t=()=>{}){const e=oe.useRef(t);return e.current=t,oe.useCallback((...n)=>e.current.apply(null,n),[])}const Fg=({children:t,groupProps:e,divProps:n,transform:s,transformFunc:i,parentNodeFunc:c})=>{const d=o5(),h=oe.useRef(null),[p]=oe.useState(()=>document.createElement("div")),u=oe.useMemo(()=>B9.createRoot(p),[p]),A=s??!0,y=z9(()=>{if(A&&h.current){let R=h.current.getAbsoluteTransform().decompose();i&&(R=i(R)),p.style.position="absolute",p.style.zIndex="10",p.style.top="0px",p.style.left="0px",p.style.transform=`translate(${R.x}px, ${R.y}px) rotate(${R.rotation}deg) scaleX(${R.scaleX}) scaleY(${R.scaleY})`,p.style.transformOrigin="top left"}else p.style.position="",p.style.zIndex="",p.style.top="",p.style.left="",p.style.transform="",p.style.transformOrigin="";const x=n||{},{style:S}=x,C=M9(x,["style"]);Object.assign(p.style,S),Object.assign(p,C)});return oe.useLayoutEffect(()=>{var x;const S=h.current;if(!S)return;const C=c?c({stage:S.getStage()}):(x=S.getStage())===null||x===void 0?void 0:x.container();if(C)return C.appendChild(p),A&&P9(C)&&(C.style.position="relative"),S.on("absoluteTransformChange",y),y(),()=>{var T;S.off("absoluteTransformChange",y),(T=p.parentNode)===null||T===void 0||T.removeChild(p)}},[A,c]),oe.useLayoutEffect(()=>{y()},[n,i]),oe.useLayoutEffect(()=>{queueMicrotask(()=>{Z2.flushSync(()=>{u.render(oe.createElement(d,null,t))})})}),oe.useLayoutEffect(()=>()=>{setTimeout(()=>{u.unmount()})},[]),oe.createElement(di,Object.assign({ref:h},e))};var dg,K2;function F9(){if(K2)return dg;K2=1;var t=oe;return dg=function(n,s,i){const c=t.useRef("loading"),d=t.useRef(),[h,p]=t.useState(0),u=t.useRef(),A=t.useRef(),y=t.useRef();return(u.current!==n||A.current!==s||y.current!==i)&&(c.current="loading",d.current=void 0,u.current=n,A.current=s,y.current=i),t.useLayoutEffect(function(){if(!n)return;var x=document.createElement("img");function S(){x.decode().catch(()=>{}).finally(()=>{c.current="loaded",d.current=x,p(Math.random())})}function C(){c.current="failed",d.current=void 0,p(Math.random())}return x.addEventListener("load",S),x.addEventListener("error",C),s&&(x.crossOrigin=s),i&&(x.referrerPolicy=i),x.src=n,function(){x.removeEventListener("load",S),x.removeEventListener("error",C)}},[n,s,i]),[d.current,c.current]},dg}var I9=F9();const O9=lA(I9),d5=({element:t,isSelected:e,onSelect:n,onChange:s,onDragStart:i,onDragEnd:c})=>{const d=oe.useRef(null),h=oe.useRef(null),p=oe.useRef(null),[u,A]=oe.useState(!1),[y,x]=oe.useState(t.fontSize*2);oe.useEffect(()=>{var M;e&&!u&&p.current&&d.current&&(p.current.nodes([d.current]),(M=p.current.getLayer())==null||M.batchDraw())},[e,u]),oe.useEffect(()=>{h.current&&x(h.current.height())},[t.content,t.fontSize,t.width]);const S=oe.useCallback(()=>{A(!0)},[]),C=oe.useCallback(M=>{s({content:M}),A(!1)},[s]),T=M=>{const P=M.target;s({x:P.x()-P.offsetX(),y:P.y()-P.offsetY()},!0)},R=M=>{const P=M.target;s({x:P.x()-P.offsetX(),y:P.y()-P.offsetY()}),c==null||c()},D=()=>{const M=d.current;if(!M)return;const P=M.scaleX(),O=Math.max(50,t.width*P);M.scaleX(1),M.scaleY(1),M.offsetX(O/2),s({x:M.x()-O/2,y:M.y()-M.offsetY(),width:O,rotation:M.rotation()})};return w.jsxs(w.Fragment,{children:[w.jsx(di,{ref:d,x:t.x+t.width/2,y:t.y+y/2,offsetX:t.width/2,offsetY:y/2,rotation:t.rotation,draggable:!u,onClick:n,onTap:n,onDblClick:S,onDblTap:S,onDragStart:()=>i==null?void 0:i(),onDragMove:T,onDragEnd:R,onTransformStart:()=>i==null?void 0:i(),onTransformEnd:D,children:w.jsx(Ks,{ref:h,x:0,y:0,width:t.width,text:t.content,fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontWeight==="700"||t.fontWeight==="800"?"bold":"normal",fill:t.fill,align:t.align,lineHeight:t.lineHeight||1.2,opacity:u?0:1})}),e&&!u&&w.jsx(rv,{ref:p,flipEnabled:!1,enabledAnchors:["middle-left","middle-right"],rotateEnabled:!0,rotateAnchorOffset:20,rotateAnchorCursor:"grab",anchorSize:10,anchorCornerRadius:5,anchorFill:"#ffffff",anchorStroke:"#5B6EF7",anchorStrokeWidth:2,borderStroke:"#5B6EF7",borderStrokeWidth:2,rotationSnaps:[0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345],rotationSnapTolerance:5,boundBoxFunc:(M,P)=>Math.abs(P.width)<50?M:P}),u&&w.jsx(Fg,{groupProps:{x:t.x,y:t.y},divProps:{style:{opacity:1}},children:w.jsx(j9,{element:t,onComplete:C,onCancel:()=>A(!1)})})]})},U9=t=>{let e=t.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const n=parseInt(e.substring(0,2),16),s=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16);return(n*299+s*587+i*114)/1e3>180},j9=({element:t,onComplete:e,onCancel:n})=>{const s=oe.useRef(null),[i,c]=oe.useState(t.content),d=U9(t.fill)?"#1e293b":t.fill;oe.useEffect(()=>{const u=s.current;u&&requestAnimationFrame(()=>{u.focus(),u.select()})},[]);const h=u=>{u.key==="Escape"?n():u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),e(i))},p=()=>{setTimeout(()=>{e(i)},100)};return w.jsx("textarea",{ref:s,value:i,onChange:u=>c(u.target.value),onKeyDown:h,onBlur:p,style:{width:`${t.width}px`,minHeight:"60px",padding:"8px",fontSize:`${t.fontSize}px`,fontFamily:t.fontFamily,color:d,textAlign:t.align,border:"2px solid #5B6EF7",borderRadius:"8px",outline:"none",resize:"vertical",backgroundColor:"white",boxShadow:"0 4px 20px rgba(0,0,0,0.15)",lineHeight:t.lineHeight||1.2},placeholder:"텍스트를 입력하세요... (마크다운 지원: **굵게**, *기울임*)"})},f5=({element:t,isSelected:e,onSelect:n,onChange:s,onDragStart:i,onDragEnd:c,onReplaceWithImage:d})=>{const h=oe.useRef(null),p=oe.useRef(null),u=oe.useRef(null),[A,y]=oe.useState(!1);oe.useEffect(()=>{var q;e&&!A&&p.current&&h.current&&(p.current.nodes([h.current]),(q=p.current.getLayer())==null||q.batchDraw())},[e,A]);const x=q=>{const Q=q.target;s({x:Q.x()-Q.offsetX(),y:Q.y()-Q.offsetY()},!0)},S=q=>{const Q=q.target;s({x:Q.x()-Q.offsetX(),y:Q.y()-Q.offsetY()}),c==null||c()},C=()=>{const q=h.current;if(!q)return;const Q=q.scaleX(),V=q.scaleY(),ge=Math.max(10,t.width*Q),X=Math.max(10,t.height*V);q.scaleX(1),q.scaleY(1),q.offsetX(ge/2),q.offsetY(X/2),s({x:q.x()-ge/2,y:q.y()-X/2,width:ge,height:X,rotation:q.rotation()})},T=oe.useCallback(()=>{t.isImagePlaceholder&&u.current&&u.current.click()},[t.isImagePlaceholder]),R=oe.useCallback(q=>{var ge;const Q=(ge=q.target.files)==null?void 0:ge[0];if(!Q||!d)return;const V=new FileReader;V.onload=X=>{var ne;const se=(ne=X.target)==null?void 0:ne.result,L=new window.Image;L.onload=()=>{const le=L.width/L.height,pe=t.width/t.height;let J=0,ae=0,re=L.width,U=L.height;le>pe?(re=L.height*pe,J=(L.width-re)/2):(U=L.width/pe,ae=(L.height-U)/2),d({src:se,width:t.width,height:t.height,crop:{x:J,y:ae,width:re,height:U}})},L.src=se},V.readAsDataURL(Q),q.target.value=""},[t.width,t.height,d]),D=oe.useCallback(()=>{t.isImagePlaceholder||t.shapeType==="line"||t.shapeType==="arrow"||y(!0)},[t.shapeType,t.isImagePlaceholder]),M=oe.useCallback(q=>{s({text:q}),y(!1)},[s]),P=()=>[t.width/2,0,t.width,t.height,0,t.height],O=()=>[0,0,t.width,t.height],I=()=>{const q={fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth};switch(t.shapeType){case"rect":return w.jsx(Vr,{width:t.width,height:t.height,cornerRadius:t.cornerRadius||0,...q});case"ellipse":return w.jsx(tv,{x:t.width/2,y:t.height/2,radiusX:t.width/2,radiusY:t.height/2,...q});case"triangle":return w.jsx(Uo,{points:P(),closed:!0,...q});case"line":return w.jsx(Uo,{points:O(),stroke:t.stroke,strokeWidth:t.strokeWidth});case"arrow":return w.jsx(nv,{points:O(),stroke:t.stroke,fill:t.stroke,strokeWidth:t.strokeWidth,pointerLength:10,pointerWidth:10});default:return null}},Y=t.shapeType!=="line"&&t.shapeType!=="arrow",K=oe.useCallback(()=>{t.isImagePlaceholder&&T(),n()},[t.isImagePlaceholder,T,n]);return w.jsxs(w.Fragment,{children:[t.isImagePlaceholder&&w.jsx(Fg,{groupProps:{x:0,y:0},divProps:{style:{display:"none"}},children:w.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:R,style:{display:"none"}})}),w.jsxs(di,{ref:h,x:t.x+t.width/2,y:t.y+t.height/2,offsetX:t.width/2,offsetY:t.height/2,rotation:t.rotation,draggable:!A,onClick:K,onTap:K,onDblClick:D,onDblTap:D,onDragStart:()=>i==null?void 0:i(),onDragMove:x,onDragEnd:S,onTransformStart:()=>i==null?void 0:i(),onTransformEnd:C,style:{cursor:t.isImagePlaceholder?"pointer":"move"},children:[I(),Y&&t.text&&!A&&w.jsx(Ks,{x:0,y:0,width:t.width,height:t.height,text:t.text,fontSize:t.textSize||16,fill:t.textColor||"#1e293b",align:"center",verticalAlign:"middle",listening:!1}),A&&w.jsx(Fg,{groupProps:{x:0,y:0},divProps:{style:{opacity:1}},children:w.jsx(H9,{element:t,onComplete:M,onCancel:()=>y(!1)})})]}),e&&!A&&w.jsx(rv,{ref:p,flipEnabled:!1,rotateEnabled:!0,rotateAnchorOffset:20,rotateAnchorCursor:"grab",anchorSize:10,anchorCornerRadius:5,anchorFill:"#ffffff",anchorStroke:"#5B6EF7",anchorStrokeWidth:2,borderStroke:"#5B6EF7",borderStrokeWidth:2,rotationSnaps:[0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345],rotationSnapTolerance:5,boundBoxFunc:(q,Q)=>Math.abs(Q.width)<10||Math.abs(Q.height)<10?q:Q})]})},G9=t=>{let e=t.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const n=parseInt(e.substring(0,2),16),s=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16);return(n*299+s*587+i*114)/1e3>180},H9=({element:t,onComplete:e,onCancel:n})=>{const s=oe.useRef(null),[i,c]=oe.useState(t.text||""),d=t.textColor||"#1e293b",h=G9(d)?"#1e293b":d;oe.useEffect(()=>{s.current&&requestAnimationFrame(()=>{var A,y;(A=s.current)==null||A.focus(),(y=s.current)==null||y.select()})},[]);const p=A=>{A.key==="Escape"?n():A.key==="Enter"&&(A.preventDefault(),e(i))},u=()=>{setTimeout(()=>{e(i)},100)};return w.jsx("input",{ref:s,type:"text",value:i,onChange:A=>c(A.target.value),onKeyDown:p,onBlur:u,style:{width:`${t.width}px`,height:`${t.height}px`,padding:"8px",fontSize:`${t.textSize||16}px`,color:h,textAlign:"center",border:"2px solid #5B6EF7",borderRadius:t.shapeType==="ellipse"?"50%":"8px",outline:"none",backgroundColor:"rgba(255,255,255,0.9)",boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},placeholder:"텍스트 입력..."})},h5=({element:t,isSelected:e,onSelect:n,onChange:s,onDragStart:i,onDragEnd:c})=>{const d=oe.useRef(null),h=oe.useRef(null),p=oe.useRef(null),[u,A]=oe.useState(null),[y,x]=oe.useState(!1),[S,C]=oe.useState({x:0,y:0}),[T,R]=oe.useState(1);oe.useEffect(()=>{const re=new window.Image;re.src=t.src,re.onload=()=>{A(re)}},[t.src]),oe.useEffect(()=>{var re;e&&!y&&h.current&&d.current&&(h.current.nodes([d.current]),(re=h.current.getLayer())==null||re.batchDraw())},[e,y]),oe.useEffect(()=>{y&&(C({x:0,y:0}),R(1))},[y]);const D=oe.useCallback(re=>{if(!t.crop||!u)return;const U=t.crop,ee=T,Ee=Math.max(1,Math.min(3,re)),Te=t.width/2,Ne=t.height/2,Ue=t.width/U.width*ee,ot=t.height/U.height*ee,lt=-U.x*Ue+S.x,pt=-U.y*ot+S.y,Lt=(Te-lt)/Ue,qe=(Ne-pt)/ot,Dt=t.width/U.width*Ee,me=t.height/U.height*Ee,k=Te-Lt*Dt,ce=Ne-qe*me,de=k+U.x*Dt,G=ce+U.y*me,j=u.width*Dt,$=u.height*me,ye=t.width-j,Ce=0,Ae=t.height-$,ze=0,We=Math.max(ye,Math.min(Ce,de)),Ie=Math.max(Ae,Math.min(ze,G));R(Ee),C({x:We,y:Ie})},[t.crop,t.width,t.height,u,T,S]),M=re=>{const U=re.target;s({x:U.x()-t.width/2,y:U.y()-t.height/2},!0)},P=re=>{const U=re.target;s({x:U.x()-t.width/2,y:U.y()-t.height/2}),c==null||c()},O=()=>{const re=d.current;if(!re)return;const U=re.scaleX(),ee=re.scaleY(),Ee=Math.max(20,t.width*U),Te=Math.max(20,t.height*ee);re.scaleX(1),re.scaleY(1),re.offsetX(Ee/2),re.offsetY(Te/2),s({x:re.x()-Ee/2,y:re.y()-Te/2,width:Ee,height:Te,rotation:re.rotation()})},I=oe.useCallback(re=>{const U=t.cornerRadius||0,ee=t.width,Ee=t.height;if(U===0)re.rect(0,0,ee,Ee);else{const Te=Math.min(U,ee/2,Ee/2);re.beginPath(),re.moveTo(Te,0),re.lineTo(ee-Te,0),re.arcTo(ee,0,ee,Te,Te),re.lineTo(ee,Ee-Te),re.arcTo(ee,Ee,ee-Te,Ee,Te),re.lineTo(Te,Ee),re.arcTo(0,Ee,0,Ee-Te,Te),re.lineTo(0,Te),re.arcTo(0,0,Te,0,Te),re.closePath()}},[t.cornerRadius,t.width,t.height]),Y=oe.useCallback(()=>{t.crop&&x(!0)},[t.crop]),K=oe.useCallback(re=>{const U=re.target,ee=t.crop;if(!ee||!u)return;const Ee=t.width/ee.width*T,Te=t.height/ee.height*T,Ne=u.width*Ee,Ue=u.height*Te,ot=-ee.x*Ee,lt=-ee.y*Te,pt=t.width-Ne,Lt=0,qe=t.height-Ue,Dt=0,me=Math.max(pt,Math.min(Lt,U.x())),k=Math.max(qe,Math.min(Dt,U.y()));U.x(me),U.y(k),C({x:me-ot,y:k-lt})},[t.crop,t.width,t.height,u,T]),q=oe.useCallback(()=>{if(!t.crop||!u){x(!1);return}const re=t.crop,U=re.width/t.width/T,ee=re.height/t.height/T,Ee=re.width/T,Te=re.height/T,Ne=Math.max(0,Math.min(u.width-Ee,re.x-S.x*U)),Ue=Math.max(0,Math.min(u.height-Te,re.y-S.y*ee));s({crop:{x:Ne,y:Ue,width:Ee,height:Te}}),x(!1),C({x:0,y:0}),R(1)},[t.crop,t.width,t.height,u,S,T,s]),Q=oe.useCallback(()=>{x(!1),C({x:0,y:0}),R(1)},[]),V=oe.useCallback(()=>{C({x:0,y:0}),R(1)},[]);if(oe.useEffect(()=>{if(!y)return;const re=U=>{U.key==="Escape"?Q():U.key==="Enter"&&q()};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[y,q,Q]),!u)return null;const ge=t.crop,X=ge?t.width/ge.width:1,se=ge?t.height/ge.height:1,L=y?X*T:X,ne=y?se*T:se,le=u.width*L,pe=u.height*ne,J=ge?-ge.x*L:0,ae=ge?-ge.y*ne:0;return w.jsxs(w.Fragment,{children:[y&&ge&&w.jsxs(di,{x:t.x+t.width/2,y:t.y+t.height/2,offsetX:t.width/2,offsetY:t.height/2,rotation:t.rotation,children:[w.jsx(Vr,{x:J+S.x-500,y:ae+S.y-500,width:le+1e3,height:pe+1e3,fill:"rgba(0,0,0,0.5)",listening:!1}),w.jsx(nA,{ref:p,image:u,x:J+S.x,y:ae+S.y,width:le,height:pe,opacity:.7,draggable:!0,onDragMove:K}),w.jsx(di,{clipFunc:re=>re.rect(0,0,t.width,t.height),listening:!1,children:w.jsx(nA,{image:u,x:J+S.x,y:ae+S.y,width:le,height:pe})}),w.jsx(Vr,{x:0,y:0,width:t.width,height:t.height,stroke:"#5B6EF7",strokeWidth:2,fill:"transparent",listening:!1}),[{x:0,y:0},{x:t.width,y:0},{x:0,y:t.height},{x:t.width,y:t.height}].map((re,U)=>w.jsx(Vr,{x:re.x-5,y:re.y-5,width:10,height:10,fill:"#ffffff",stroke:"#5B6EF7",strokeWidth:2,cornerRadius:2,listening:!1},U))]}),!y&&w.jsx(di,{ref:d,x:t.x+t.width/2,y:t.y+t.height/2,offsetX:t.width/2,offsetY:t.height/2,rotation:t.rotation,draggable:!0,onClick:n,onTap:n,onDblClick:Y,onDblTap:Y,onDragStart:()=>i==null?void 0:i(),onDragMove:M,onDragEnd:P,onTransformStart:()=>i==null?void 0:i(),onTransformEnd:O,clipFunc:t.cornerRadius?I:void 0,children:w.jsx(nA,{image:u,x:0,y:0,width:t.width,height:t.height,crop:t.crop})}),y&&w.jsxs(di,{x:t.x,y:t.y-50,children:[w.jsx(Vr,{x:0,y:0,width:390,height:40,fill:"white",cornerRadius:8,shadowColor:"black",shadowBlur:10,shadowOpacity:.15}),w.jsxs(di,{x:10,y:5,onClick:()=>D(T-.25),onTap:()=>D(T-.25),children:[w.jsx(Vr,{width:30,height:30,fill:T<=1?"#e2e8f0":"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"-",x:0,y:0,width:30,height:30,align:"center",verticalAlign:"middle",fill:T<=1?"#94a3b8":"#64748b",fontSize:18,fontFamily:"Inter"})]}),w.jsx(Ks,{text:`${Math.round(T*100)}%`,x:45,y:5,width:50,height:30,align:"center",verticalAlign:"middle",fill:"#334155",fontSize:12,fontFamily:"Inter"}),w.jsxs(di,{x:100,y:5,onClick:()=>D(T+.25),onTap:()=>D(T+.25),children:[w.jsx(Vr,{width:30,height:30,fill:T>=3?"#e2e8f0":"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"+",x:0,y:0,width:30,height:30,align:"center",verticalAlign:"middle",fill:T>=3?"#94a3b8":"#64748b",fontSize:18,fontFamily:"Inter"})]}),w.jsxs(di,{x:140,y:5,onClick:V,onTap:V,children:[w.jsx(Vr,{width:50,height:30,fill:"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"↺",x:0,y:0,width:50,height:30,align:"center",verticalAlign:"middle",fill:"#64748b",fontSize:16,fontFamily:"Inter"})]}),w.jsxs(di,{x:200,y:5,onClick:q,onTap:q,children:[w.jsx(Vr,{width:85,height:30,fill:"#5B6EF7",cornerRadius:6}),w.jsx(Ks,{text:"완료",x:0,y:0,width:85,height:30,align:"center",verticalAlign:"middle",fill:"white",fontSize:13,fontFamily:"Malgun Gothic"})]}),w.jsxs(di,{x:295,y:5,onClick:Q,onTap:Q,children:[w.jsx(Vr,{width:85,height:30,fill:"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"취소",x:0,y:0,width:85,height:30,align:"center",verticalAlign:"middle",fill:"#64748b",fontSize:13,fontFamily:"Malgun Gothic"})]})]}),e&&!y&&w.jsx(rv,{ref:h,flipEnabled:!1,rotateEnabled:!0,rotateAnchorOffset:20,rotateAnchorCursor:"grab",anchorSize:10,anchorCornerRadius:5,anchorFill:"#ffffff",anchorStroke:"#5B6EF7",anchorStrokeWidth:2,borderStroke:"#5B6EF7",borderStrokeWidth:2,rotationSnaps:[0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345],rotationSnapTolerance:5,boundBoxFunc:(re,U)=>Math.abs(U.width)<20||Math.abs(U.height)<20?re:U})]})},yu=960,xu=540,p5=()=>{const t=oe.useRef(null),e=oe.useRef(null),[n,s]=oe.useState(1);oe.useEffect(()=>{const me=()=>{if(!e.current)return;const ce=e.current.offsetWidth,de=e.current.offsetHeight,G=48,j=ce-G,$=de-G,ye=j/yu,Ce=$/xu,Ae=Math.min(ye,Ce);s(Ae)};me();const k=new ResizeObserver(me);return e.current&&k.observe(e.current),()=>k.disconnect()},[]);const i=Ve(me=>me.slides),c=Ve(me=>me.currentSlideIndex),d=Ve(me=>me.selectedElementId),h=Ve(me=>me.mode),p=Ve(me=>me.currentShapeType),u=Ve(me=>me.currentTextStyle),A=Ve(me=>me.currentFontFamily),y=Ve(me=>me.addElement),x=Ve(me=>me.updateElement),S=Ve(me=>me.deleteElement),C=Ve(me=>me.selectElement),T=Ve(me=>me.setMode),R=Ve(me=>me.snapSettings),D=Ve(me=>me.commitElementUpdate),M=Ve(me=>me.selectedElementIds),P=Ve(me=>me.selectElements),O=Ve(me=>me.clearSelection),I=i[c],[Y,K]=oe.useState([]),[q,Q]=oe.useState(!1),[V,ge]=oe.useState(null),[X,se]=oe.useState(!1),[L,ne]=oe.useState(null),[le,pe]=oe.useState(!1),[J,ae]=oe.useState(null),[re,U]=oe.useState("default"),ee=oe.useCallback(me=>{if(!d)return{isInZone:!1,element:null,corner:""};const k=I.elements.find(j=>j.id===d);if(!k)return{isInZone:!1,element:null,corner:""};const ce=[{name:"nw",x:k.x,y:k.y,checkX:-1,checkY:-1},{name:"ne",x:k.x+k.width,y:k.y,checkX:1,checkY:-1},{name:"sw",x:k.x,y:k.y+k.height,checkX:-1,checkY:1},{name:"se",x:k.x+k.width,y:k.y+k.height,checkX:1,checkY:1}],de=5,G=40;for(const j of ce){const $=me.x-j.x,ye=me.y-j.y,Ce=Math.sqrt($*$+ye*ye);if(Ce>=de&&Ce<=G){const Ae=j.checkX<0&&$<0||j.checkX>0&&$>0,ze=j.checkY<0&&ye<0||j.checkY>0&&ye>0;if(Ae&&ze)return{isInZone:!0,element:k,corner:j.name};if((Ae||ze)&&Ce<=25)return{isInZone:!0,element:k,corner:j.name}}}return{isInZone:!1,element:null,corner:""}},[d,I.elements]),Ee=oe.useCallback(me=>{var G;const k=t.current;if(!k)return;const ce=k.getPointerPosition();if(!ce)return;if(h==="select"){const j=ee(ce);if(j.isInZone&&j.element){D();const $=j.element,ye=$.x+$.width/2,Ce=$.y+$.height/2,Ae=Math.atan2(ce.y-Ce,ce.x-ye)*(180/Math.PI);pe(!0),ae({elementId:$.id,centerX:ye,centerY:Ce,startAngle:Ae,initialRotation:$.rotation||0});return}}me.target===((G=me.target.getStage())==null?void 0:G.findOne(".background"))&&(h==="select"?(se(!0),ne({startX:ce.x,startY:ce.y,currentX:ce.x,currentY:ce.y})):(h==="text"||h==="shape")&&(Q(!0),ge({startX:ce.x,startY:ce.y,currentX:ce.x,currentY:ce.y})))},[h,O,ee,D]),Te=oe.useCallback(me=>{const k=t.current;if(!k)return;const ce=k.getPointerPosition();if(ce){if(le&&J){const G=Math.atan2(ce.y-J.centerY,ce.x-J.centerX)*(180/Math.PI)-J.startAngle;let j=J.initialRotation+G;const $=15,ye=5,Ce=Math.round(j/$)*$;Math.abs(j-Ce)<ye&&(j=Ce),j=(j%360+360)%360,x(J.elementId,{rotation:j});return}if(h==="select"&&!X&&!q){const de=ee(ce);de.isInZone?U({nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"}[de.corner]||"grab"):U("default")}if(X&&L){ne({...L,currentX:ce.x,currentY:ce.y});return}q&&V&&ge({...V,currentX:ce.x,currentY:ce.y})}},[q,V,X,L,le,J,h,ee,x]),Ne=oe.useCallback(me=>{const k=Math.min(me.startX,me.currentX),ce=Math.min(me.startY,me.currentY),de=Math.abs(me.currentX-me.startX),G=Math.abs(me.currentY-me.startY);return de<5&&G<5?[]:I.elements.filter(j=>{const $=j.x+j.width,ye=j.y+j.height,Ce=k+de,Ae=ce+G;return j.x<Ce&&$>k&&j.y<Ae&&ye>ce}).map(j=>j.id)},[I.elements]),Ue=oe.useCallback(()=>{if(le){pe(!1),ae(null),U("default");return}if(X&&L){const ye=Ne(L);ye.length>0?P(ye):O(),se(!1),ne(null);return}if(!q||!V)return;const me=Math.min(V.startX,V.currentX),k=Math.min(V.startY,V.currentY),ce=Math.abs(V.currentX-V.startX),de=Math.abs(V.currentY-V.startY),G=20,j=Math.max(ce,G),$=Math.max(de,G);if(h==="text"){const ye=Eu[u],Ce={id:fi(),type:"text",x:me,y:k,width:j<100?u==="title"?600:300:j,height:$<50?ye.fontSize*2:$,rotation:0,content:u==="title"?"제목을 입력하세요":u==="subtitle"?"소제목을 입력하세요":"텍스트를 입력하세요",fontSize:ye.fontSize,fontFamily:A,fill:"#1e293b",align:u==="title"||u==="subtitle"?"center":"left",textStyle:u,fontWeight:ye.fontWeight,lineHeight:ye.lineHeight};y(Ce)}else if(h==="shape"){const ye={id:fi(),type:"shape",x:me,y:k,width:j,height:$,rotation:0,shapeType:p,fill:"#5B6EF7",stroke:"#4338ca",strokeWidth:2};y(ye)}Q(!1),ge(null),T("select")},[q,V,h,p,u,A,y,T,X,L,Ne,P,O,le]),ot=()=>{if(!X||!L)return null;const me=Math.min(L.startX,L.currentX),k=Math.min(L.startY,L.currentY),ce=Math.abs(L.currentX-L.startX),de=Math.abs(L.currentY-L.startY);return w.jsx(Vr,{x:me,y:k,width:ce,height:de,fill:"rgba(91, 110, 247, 0.1)",stroke:"#5B6EF7",strokeWidth:1,dash:[4,4]})},lt=()=>{if(!q||!V)return null;const me=Math.min(V.startX,V.currentX),k=Math.min(V.startY,V.currentY),ce=Math.abs(V.currentX-V.startX),de=Math.abs(V.currentY-V.startY);if(h==="text")return w.jsx(Vr,{x:me,y:k,width:ce||100,height:de||40,fill:"rgba(91, 110, 247, 0.1)",stroke:"#5B6EF7",strokeWidth:1,dash:[5,5]});if(h==="shape"){const G={fill:"rgba(91, 110, 247, 0.3)",stroke:"#5B6EF7",strokeWidth:2};switch(p){case"rect":return w.jsx(Vr,{x:me,y:k,width:ce,height:de,...G});case"ellipse":return w.jsx(tv,{x:me+ce/2,y:k+de/2,radiusX:ce/2,radiusY:de/2,...G});case"triangle":return w.jsx(Uo,{points:[me+ce/2,k,me+ce,k+de,me,k+de],closed:!0,...G});case"line":return w.jsx(Uo,{points:[V.startX,V.startY,V.currentX,V.currentY],stroke:"#5B6EF7",strokeWidth:2});case"arrow":return w.jsx(nv,{points:[V.startX,V.startY,V.currentX,V.currentY],stroke:"#5B6EF7",fill:"#5B6EF7",strokeWidth:2,pointerLength:10,pointerWidth:10});default:return null}}return null},pt=oe.useCallback((me,k,ce=!1)=>{if(ce&&R.enabled&&"x"in k&&"y"in k){const de=I.elements.find(G=>G.id===me);if(de){const G="width"in k?k.width:de.width,j="height"in k?k.height:de.height,$=I.elements.filter(Ce=>Ce.id!==me),ye=u5({x:k.x,y:k.y,width:G,height:j},$,R);K(ye.guides),x(me,{...k,x:ye.x,y:ye.y});return}}K([]),x(me,k)},[x,R,I.elements]),Lt=oe.useCallback(()=>{K([])},[]),qe=oe.useCallback((me,k)=>{const ce={id:fi(),type:"image",x:me.x,y:me.y,width:me.width,height:me.height,rotation:me.rotation,src:k.src,crop:k.crop};S(me.id),y(ce)},[S,y]),Dt=()=>Y.length===0?null:Y.map((me,k)=>{const ce=me.isCenter,de=ce?"#5B6EF7":"#ef4444",G=ce?2:1,j=ce?[8,4]:[4,4];return me.type==="vertical"?w.jsx(Uo,{points:[me.position,0,me.position,xu],stroke:de,strokeWidth:G,dash:j},`guide-${k}`):w.jsx(Uo,{points:[0,me.position,yu,me.position],stroke:de,strokeWidth:G,dash:j},`guide-${k}`)});return w.jsx(z.Center,{ref:e,w:"100%",h:"100%",children:w.jsx(z.Box,{style:{width:yu*n,height:xu*n},children:w.jsx(z.Box,{bg:"white",style:{width:yu,height:xu,transform:`scale(${n})`,transformOrigin:"top left",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",boxShadow:"0 20px 70px rgba(0, 0, 0, 0.12)"},children:w.jsx(c5,{ref:t,width:yu,height:xu,onMouseDown:Ee,onMouseMove:Te,onMouseUp:Ue,onMouseLeave:Ue,style:{cursor:h!=="select"?"crosshair":le?"grabbing":re},children:w.jsxs(l5,{children:[w.jsx(Vr,{name:"background",x:0,y:0,width:yu,height:xu,fill:I.background}),I.elements.map(me=>{const k=d===me.id||M.includes(me.id);return me.type==="text"?w.jsx(d5,{element:me,isSelected:k,onSelect:()=>C(me.id),onChange:(ce,de)=>pt(me.id,ce,de),onDragStart:D,onDragEnd:Lt},me.id):me.type==="shape"?w.jsx(f5,{element:me,isSelected:k,onSelect:()=>C(me.id),onChange:(ce,de)=>pt(me.id,ce,de),onDragStart:D,onDragEnd:Lt,onReplaceWithImage:ce=>qe(me,ce)},me.id):me.type==="image"?w.jsx(h5,{element:me,isSelected:k,onSelect:()=>C(me.id),onChange:(ce,de)=>pt(me.id,ce,de),onDragStart:D,onDragEnd:Lt},me.id):null}),Dt(),lt(),ot()]})})})})})},oA=142,Ig=80,X9=960,nn=oA/X9,W9=({element:t,scale:e})=>{const[n]=O9(t.src);return n?w.jsx(nA,{image:n,x:t.x*e,y:t.y*e,width:t.width*e,height:t.height*e,rotation:t.rotation}):null},Q9=({slide:t})=>{const e=oe.useMemo(()=>t.elements.map(n=>{if(n.type==="text"){const s=n;return w.jsx(Ks,{x:s.x*nn,y:s.y*nn,width:s.width*nn,height:s.height*nn,text:a6(s.content),fontSize:s.fontSize*nn,fontFamily:s.fontFamily,fill:s.fill,align:s.align,rotation:s.rotation},n.id)}else if(n.type==="shape"){const s=n,i={x:s.x*nn,y:s.y*nn,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth*nn,rotation:s.rotation};switch(s.shapeType){case"rect":return w.jsx(Vr,{width:s.width*nn,height:s.height*nn,...i},n.id);case"ellipse":return w.jsx(tv,{x:(s.x+s.width/2)*nn,y:(s.y+s.height/2)*nn,radiusX:s.width/2*nn,radiusY:s.height/2*nn,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth*nn,rotation:s.rotation},n.id);case"triangle":return w.jsx(Uo,{points:[(s.x+s.width/2)*nn,s.y*nn,(s.x+s.width)*nn,(s.y+s.height)*nn,s.x*nn,(s.y+s.height)*nn],closed:!0,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth*nn},n.id);case"line":return w.jsx(Uo,{points:[s.x*nn,s.y*nn,(s.x+s.width)*nn,(s.y+s.height)*nn],stroke:s.stroke,strokeWidth:s.strokeWidth*nn},n.id);case"arrow":return w.jsx(nv,{points:[s.x*nn,s.y*nn,(s.x+s.width)*nn,(s.y+s.height)*nn],stroke:s.stroke,fill:s.stroke,strokeWidth:s.strokeWidth*nn,pointerLength:5,pointerWidth:5},n.id);default:return null}}else if(n.type==="image")return w.jsx(W9,{element:n,scale:nn},n.id);return null}),[t.elements]);return w.jsx(c5,{width:oA,height:Ig,children:w.jsxs(l5,{children:[w.jsx(Vr,{x:0,y:0,width:oA,height:Ig,fill:t.background}),e]})})},A5=()=>{const t=Ve(p=>p.slides),e=Ve(p=>p.currentSlideIndex),n=Ve(p=>p.selectSlide),s=Ve(p=>p.addSlide),i=Ve(p=>p.deleteSlide),[c,d]=oe.useState(null),h=(p,u)=>{p.stopPropagation(),t.length>1&&i(u)};return w.jsx(z.Box,{h:128,bg:"white",px:"md",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.ScrollArea,{h:"100%",type:"auto",scrollbarSize:6,children:w.jsxs(z.Group,{gap:"md",h:128,align:"center",wrap:"nowrap",children:[t.map((p,u)=>w.jsxs(z.Box,{pos:"relative",style:{flexShrink:0},onMouseEnter:()=>d(u),onMouseLeave:()=>d(null),children:[w.jsxs(z.Badge,{size:"xs",color:e===u?"devdive":"gray",pos:"absolute",top:-8,left:8,style:{zIndex:10},children:["#",u+1]}),c===u&&t.length>1&&w.jsx(z.ActionIcon,{variant:"filled",color:"red",size:"xs",radius:"xl",pos:"absolute",top:-6,right:-6,style:{zIndex:20},onClick:A=>h(A,u),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:12},children:"close"})}),w.jsx(z.UnstyledButton,{onClick:()=>n(u),style:{borderRadius:"var(--mantine-radius-lg)",overflow:"hidden",border:e===u?"2px solid var(--devdive-primary)":"1px solid var(--devdive-border-light)",boxShadow:e===u?"0 0 0 4px rgba(91, 110, 247, 0.1), 0 4px 6px rgba(0, 0, 0, 0.1)":void 0,transition:"all 150ms ease"},children:w.jsx(Q9,{slide:p})})]},p.id)),w.jsx(z.ActionIcon,{variant:"outline",color:"gray",size:Ig,w:oA,radius:"lg",onClick:s,style:{flexShrink:0,borderStyle:"dashed",borderWidth:2},children:w.jsxs(z.Box,{ta:"center",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"add"}),w.jsx(z.Box,{fz:9,fw:700,tt:"uppercase",lts:"0.05em",children:"Add"})]})})]})})})},m5=()=>{const[t,e]=oe.useState(!1),n=Ve(R=>R.slides),s=Ve(R=>R.currentSlideIndex),i=Ve(R=>R.selectedElementId),c=Ve(R=>R.updateElement),d=Ve(R=>R.updateSlideBackground),h=Ve(R=>R.bringToFront),p=Ve(R=>R.sendToBack),u=Ve(R=>R.bringForward),A=Ve(R=>R.sendBackward),y=Ve(R=>R.copyElement),x=Ve(R=>R.commitElementUpdate),S=n[s],C=i?S.elements.find(R=>R.id===i):null;if(t)return w.jsx(z.Box,{w:40,bg:"white",py:"md",style:{borderLeft:"1px solid var(--devdive-border-light)"},children:w.jsx(z.Stack,{align:"center",children:w.jsx(z.Tooltip,{label:"속성 패널 펼치기",position:"left",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>e(!1),children:w.jsx("span",{className:"material-symbols-outlined",children:"chevron_left"})})})})});if(!C)return w.jsxs(z.Box,{w:256,p:"md",bg:"white",style:{borderLeft:"1px solid var(--devdive-border-light)",overflowY:"auto"},children:[w.jsxs(z.Group,{justify:"space-between",mb:"md",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{color:"var(--devdive-primary)",fontSize:18},children:"palette"}),w.jsx(z.Text,{size:"sm",fw:700,children:"슬라이드 설정"})]}),w.jsx(z.Tooltip,{label:"패널 접기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>e(!0),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"chevron_right"})})})]}),w.jsx(_f,{color:S.background,onChange:R=>d(R),label:"배경 색상"}),w.jsxs(z.Box,{mt:"xl",pt:"md",ta:"center",c:"dimmed",style:{borderTop:"1px solid var(--devdive-border-light)"},children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:32,marginBottom:4},children:"touch_app"}),w.jsxs(z.Text,{size:"xs",children:["요소를 선택하면",w.jsx("br",{}),"속성을 편집할 수 있습니다"]}),w.jsxs(z.Text,{size:"xs",c:"dimmed",mt:"sm",children:["하단 입력창에서 AI로",w.jsx("br",{}),"슬라이드 내용을 수정하세요"]})]})]});const T=R=>{c(i,R)};return w.jsxs(z.Box,{w:256,p:"md",bg:"white",style:{borderLeft:"1px solid var(--devdive-border-light)",overflowY:"auto"},children:[w.jsxs(z.Group,{justify:"space-between",mb:"md",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{color:"var(--devdive-primary)",fontSize:18},children:"tune"}),w.jsx(z.Text,{size:"sm",fw:700,children:"속성"})]}),w.jsx(z.Tooltip,{label:"패널 접기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>e(!0),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"chevron_right"})})})]}),w.jsxs(z.Box,{mb:"md",pb:"md",style:{borderBottom:"1px solid var(--devdive-border-light)"},children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"레이어 순서"}),w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Tooltip,{label:"맨 뒤로 (Ctrl+[)",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:p,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"vertical_align_bottom"})})}),w.jsx(z.Tooltip,{label:"한 단계 뒤로",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:A,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"arrow_downward"})})}),w.jsx(z.Tooltip,{label:"한 단계 앞으로",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:u,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"arrow_upward"})})}),w.jsx(z.Tooltip,{label:"맨 앞으로 (Ctrl+])",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:h,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"vertical_align_top"})})})]}),w.jsx(z.Button,{variant:"light",color:"gray",size:"xs",fullWidth:!0,mt:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"content_copy"}),onClick:y,children:"복사"})]}),w.jsx(Y9,{element:C,onUpdate:T,onStartEdit:x}),C.type==="text"&&w.jsx(V9,{element:C,onUpdate:T,onStartEdit:x}),C.type==="shape"&&w.jsx(q9,{element:C,onUpdate:T,onStartEdit:x}),C.type==="image"&&w.jsx(K9,{element:C,onUpdate:T,onStartEdit:x})]})},Y9=({element:t,onUpdate:e,onStartEdit:n})=>{const[s,i]=oe.useState(Math.round(t.width)),[c,d]=oe.useState(Math.round(t.height)),[h,p]=oe.useState(!0),u=t.width/t.height;oe.useEffect(()=>{i(Math.round(t.width)),d(Math.round(t.height))},[t.width,t.height]);const A=x=>{const S=Number(x);if(i(S),h){const C=Math.round(S/u);d(C),e({width:S,height:C})}else e({width:S})},y=x=>{const S=Number(x);if(d(S),h){const C=Math.round(S*u);i(C),e({width:C,height:S})}else e({height:S})};return w.jsxs(z.Box,{mb:"md",pb:"md",style:{borderBottom:"1px solid var(--devdive-border-light)"},children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"크기"}),w.jsxs(z.Group,{gap:"xs",align:"flex-end",children:[w.jsxs(z.Box,{flex:1,children:[w.jsx(z.Text,{size:"xs",c:"dimmed",mb:2,children:"너비"}),w.jsx(z.NumberInput,{value:s,onFocus:n,onChange:A,size:"xs",min:10})]}),w.jsx(z.Tooltip,{label:h?"비율 잠금 해제":"비율 잠금",children:w.jsx(z.ActionIcon,{variant:h?"light":"subtle",color:h?"devdive":"gray",onClick:()=>p(!h),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:h?"link":"link_off"})})}),w.jsxs(z.Box,{flex:1,children:[w.jsx(z.Text,{size:"xs",c:"dimmed",mb:2,children:"높이"}),w.jsx(z.NumberInput,{value:c,onFocus:n,onChange:y,size:"xs",min:10})]})]})]})},_f=({color:t,onChange:e,label:n,onStartEdit:s})=>{const[i,c]=oe.useState(!1),[d,h]=oe.useState(t);oe.useEffect(()=>{h(t)},[t]);const p=["#5B6EF7","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#8b5cf6","#ec4899","#1e293b","#64748b","#e2e8f0","#ffffff"];return w.jsxs(z.Box,{mb:"sm",children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:n}),w.jsxs(z.Group,{gap:"xs",children:[w.jsxs(z.Popover,{opened:i,onChange:c,position:"bottom-start",radius:"lg",shadow:"xl",children:[w.jsx(z.Popover.Target,{children:w.jsx(z.ActionIcon,{variant:"outline",size:"lg",onClick:()=>{i||s==null||s(),c(!i)},style:{backgroundColor:d,borderColor:"var(--devdive-border-light)"}})}),w.jsx(z.Popover.Dropdown,{p:"sm",children:w.jsxs(z.Stack,{gap:"sm",children:[w.jsx(bx,{color:d,onChange:u=>{h(u),e(u)}}),w.jsx(z.Box,{pt:"sm",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.SimpleGrid,{cols:4,spacing:6,children:p.map(u=>w.jsx(z.ActionIcon,{size:"sm",variant:"outline",onClick:()=>{h(u),e(u)},style:{backgroundColor:u,borderColor:"var(--devdive-border-light)"}},u))})})]})})]}),w.jsx(z.NumberInput,{value:d,onChange:u=>{const A=String(u);h(A),/^#[0-9A-Fa-f]{6}$/.test(A)&&e(A)},hideControls:!0,size:"xs",flex:1,styles:{input:{fontFamily:"monospace"}}})]})]})},V9=({element:t,onUpdate:e,onStartEdit:n})=>w.jsxs(z.Stack,{gap:"md",children:[w.jsx(_f,{color:t.fill,onChange:s=>e({fill:s}),label:"텍스트 색상",onStartEdit:n}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"폰트 크기"}),w.jsx(z.NumberInput,{value:t.fontSize,onFocus:n,onChange:s=>e({fontSize:Number(s)}),size:"xs",min:8,max:200})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"정렬"}),w.jsx(z.SegmentedControl,{value:t.align,onChange:s=>{n(),e({align:s})},fullWidth:!0,size:"xs",data:[{value:"left",label:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"format_align_left"})},{value:"center",label:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"format_align_center"})},{value:"right",label:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"format_align_right"})}]})]})]}),q9=({element:t,onUpdate:e,onStartEdit:n})=>{const s=t.shapeType!=="line"&&t.shapeType!=="arrow";return w.jsxs(z.Stack,{gap:"md",children:[w.jsx(_f,{color:t.fill,onChange:i=>e({fill:i}),label:"채우기 색상",onStartEdit:n}),w.jsx(_f,{color:t.stroke,onChange:i=>e({stroke:i}),label:"외곽선 색상",onStartEdit:n}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["외곽선 두께: ",t.strokeWidth,"px"]}),w.jsx(z.Slider,{value:t.strokeWidth,onChange:i=>e({strokeWidth:i}),onChangeEnd:n,min:0,max:20,color:"devdive",size:"sm"})]}),t.shapeType==="rect"&&w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["모서리 곡률: ",t.cornerRadius||0,"px"]}),w.jsx(z.Slider,{value:t.cornerRadius||0,onChange:i=>e({cornerRadius:i}),onChangeEnd:n,min:0,max:Math.min(t.width,t.height)/2,color:"devdive",size:"sm"}),w.jsx(z.Group,{gap:4,mt:"xs",children:[0,8,16,24,999].map(i=>w.jsx(z.Button,{variant:(t.cornerRadius||0)===i?"filled":"light",color:(t.cornerRadius||0)===i?"devdive":"gray",size:"xs",flex:1,px:4,onClick:()=>{n(),e({cornerRadius:i===999?Math.min(t.width,t.height)/2:i})},children:i===999?"원형":i},i))})]}),s&&w.jsxs(z.Box,{pt:"md",style:{borderTop:"1px solid var(--devdive-border-light)"},children:[w.jsxs(z.Group,{gap:"xs",mb:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"text_fields"}),w.jsx(z.Text,{size:"xs",fw:600,children:"도형 텍스트"})]}),w.jsx(z.Text,{size:"xs",c:"dimmed",mb:"sm",children:"더블클릭으로 텍스트 편집"}),w.jsx(_f,{color:t.textColor||"#1e293b",onChange:i=>e({textColor:i}),label:"텍스트 색상",onStartEdit:n}),w.jsxs(z.Box,{mb:"sm",children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"텍스트 크기"}),w.jsx(z.NumberInput,{value:t.textSize||16,onFocus:n,onChange:i=>e({textSize:Number(i)}),size:"xs",min:8,max:72})]}),t.text&&w.jsxs(z.Box,{p:"xs",bg:"gray.0",style:{borderRadius:"var(--mantine-radius-md)"},children:[w.jsx(z.Text,{size:"xs",c:"dimmed",mb:2,children:"현재 텍스트"}),w.jsx(z.Text,{size:"sm",truncate:!0,children:t.text})]})]})]})},K9=({element:t,onUpdate:e,onStartEdit:n})=>{const[s,i]=oe.useState(100),c=t.width,d=t.height,h=p=>{i(p);const u=p/100;e({width:Math.round(c*u),height:Math.round(d*u)})};return w.jsxs(z.Stack,{gap:"md",children:[w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"미리보기"}),w.jsx(z.Box,{h:96,bg:"gray.1",style:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--devdive-border-light)",overflow:"hidden"},children:w.jsx("img",{src:t.src,alt:"preview",style:{width:"100%",height:"100%",objectFit:"contain"}})})]}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["크기 비율: ",s,"%"]}),w.jsx(z.Slider,{value:s,onChange:h,onChangeEnd:n,min:10,max:200,color:"devdive",size:"sm"}),w.jsx(z.Group,{gap:4,mt:"xs",children:[50,75,100,125,150].map(p=>w.jsxs(z.Button,{variant:s===p?"filled":"light",color:s===p?"devdive":"gray",size:"xs",flex:1,px:4,onClick:()=>{n(),h(p)},children:[p,"%"]},p))})]}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["모서리 곡률: ",t.cornerRadius||0,"px"]}),w.jsx(z.Slider,{value:t.cornerRadius||0,onChange:p=>e({cornerRadius:p}),onChangeEnd:n,min:0,max:Math.min(t.width,t.height)/2,color:"devdive",size:"sm"}),w.jsx(z.Group,{gap:4,mt:"xs",children:[0,8,16,24,999].map(p=>w.jsx(z.Button,{variant:(t.cornerRadius||0)===p?"filled":"light",color:(t.cornerRadius||0)===p?"devdive":"gray",size:"xs",flex:1,px:4,onClick:()=>{n(),e({cornerRadius:p===999?Math.min(t.width,t.height)/2:p})},children:p===999?"원형":p},p))})]}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["회전: ",Math.round(t.rotation||0),"°"]}),w.jsx(z.Slider,{value:t.rotation||0,onChange:p=>e({rotation:p}),onChangeEnd:n,min:0,max:360,color:"devdive",size:"sm"})]})]})},J9=()=>{const[t,e]=oe.useState(!1),[n,s]=oe.useState([]),[i,c]=oe.useState(""),[d,h]=oe.useState(!1),[p,u]=oe.useState([]),[A,y]=oe.useState(-1),[x,S]=oe.useState({x:0,y:0}),[C,T]=oe.useState(!1),R=oe.useRef({x:0,y:0,posX:0,posY:0}),D=oe.useRef(null),M=oe.useRef(null),P=oe.useRef(null),{generateSlideContent:O}=uA(),I=Ve(J=>J.slides),Y=Ve(J=>J.currentSlideIndex),K=Ve(J=>J.updateElement),q=I[Y];oe.useEffect(()=>{D.current&&t&&D.current.scrollTo({top:D.current.scrollHeight,behavior:"smooth"})},[n,t]),oe.useEffect(()=>{if(q){const J={id:`snapshot-initial-${Y}`,timestamp:new Date,elements:JSON.parse(JSON.stringify(q.elements)),messageId:"initial"};u([J]),y(0),s([]),e(!1)}},[Y]);const Q=oe.useCallback(()=>{setTimeout(()=>{var re;const J=(re=Ve.getState().slides[Y])==null?void 0:re.elements;if(!J)return;const ae={id:`snapshot-after-${Date.now()}`,timestamp:new Date,elements:JSON.parse(JSON.stringify(J)),messageId:"after-change"};u(U=>[...U.slice(0,A+1),ae]),y(U=>U+1)},50)},[Y,A]),V=oe.useCallback(()=>{if(A<=0)return;const J=A-1,ae=p[J];if(!ae)return;ae.elements.forEach(U=>{K(U.id,{...U})}),y(J);const re={id:`undo-${Date.now()}`,role:"assistant",content:"이전 상태로 되돌렸습니다.",timestamp:new Date};s(U=>[...U,re])},[A,p,K]),ge=oe.useCallback(()=>{if(A>=p.length-1)return;const J=A+1,ae=p[J];if(!ae)return;ae.elements.forEach(U=>{K(U.id,{...U})}),y(J);const re={id:`redo-${Date.now()}`,role:"assistant",content:"변경사항을 다시 적용했습니다.",timestamp:new Date};s(U=>[...U,re])},[A,p,K]),X=async()=>{var ae;if(!i.trim()||d)return;t||e(!0);const J={id:`user-${Date.now()}`,role:"user",content:i.trim(),timestamp:new Date};s(re=>[...re,J]),c(""),h(!0);try{const re=q.elements.filter(ot=>ot.type==="text"),U=await O({topic:i.trim(),slideIndex:Y,totalSlides:I.length,layout:"content",purpose:i.trim(),style:"사용자 요청에 맞게 수정",language:"ko"}),ee=`assistant-${Date.now()}`;let Ee=!1;const Te=[];if(U.title&&re.length>0){const ot=re.find(lt=>lt.textStyle==="title");ot&&(K(ot.id,{content:U.title}),Te.push(`제목: "${U.title}"`),Ee=!0)}if(U.subtitle){const ot=re.find(lt=>lt.textStyle==="subtitle");ot&&(K(ot.id,{content:U.subtitle}),Te.push(`부제목: "${U.subtitle}"`),Ee=!0)}if(U.bulletPoints&&U.bulletPoints.length>0){const ot=re.filter(lt=>lt.textStyle==="body");U.bulletPoints.forEach((lt,pt)=>{ot[pt]&&(K(ot[pt].id,{content:lt}),Ee=!0)}),U.bulletPoints.length>0&&Te.push(`불릿포인트 ${U.bulletPoints.length}개 수정`)}Ee&&Q();const Ne=Ee?`수정 완료!
461
+ `,I8={};function AA(t,e,n=I8){if(!j2&&"zIndex"in e&&(console.warn(F8),j2=!0),!G2&&e.draggable){var s=e.x!==void 0||e.y!==void 0,i=e.onDragEnd||e.onDragMove;s&&!i&&(console.warn(z8),G2=!0)}for(var c in n)if(!U2[c]){var d=c.slice(0,2)==="on",h=n[c]!==e[c];if(d&&h){var p=c.substr(2).toLowerCase();p.substr(0,7)==="content"&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),t.off(p,n[c])}var u=!e.hasOwnProperty(c);u&&t.setAttr(c,void 0)}var A=e._useStrictMode,y={},x=!1;const S={};for(var c in e)if(!U2[c]){var d=c.slice(0,2)==="on",C=n[c]!==e[c];if(d&&C){var p=c.substr(2).toLowerCase();p.substr(0,7)==="content"&&(p="content"+p.substr(7,1).toUpperCase()+p.substr(8)),e[c]&&(S[p]=e[c])}!d&&(e[c]!==n[c]||A&&e[c]!==t.getAttr(c))&&(x=!0,y[c]=e[c])}x&&(t.setAttrs(y),Qo(t));for(var p in S)t.on(p+$g,S[p])}function Qo(t){if(!Qe.autoDrawEnabled){var e=t.getLayer()||t.getStage();e&&e.batchDraw()}}var ug=Zg();const n5={},O8={};Pl.Node.prototype._applyProps=AA;function U8(t,e){if(typeof e=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${e}`);return}t.add(e),Qo(t)}function j8(t,e,n){let s=Pl[t];s||(console.error(`Konva has no node with the type ${t}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${t}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),s=Pl.Group);const i={},c={};for(var d in e){var h=d.slice(0,2)==="on";h?c[d]=e[d]:i[d]=e[d]}const p=new s(i);return AA(p,c),p}function G8(t,e,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${t}"`)}function H8(t,e,n){return!1}function X8(t){return t}function W8(){return null}function Q8(){return null}function Y8(t,e,n,s){return O8}function V8(){}function q8(t){}function K8(t,e){return!1}function J8(){return n5}function Z8(){return n5}const $8=setTimeout,e9=clearTimeout,t9=-1;function n9(t,e){return!1}const r9=!1,a9=!0,i9=!0;function s9(t,e){e.parent===t?e.moveToTop():t.add(e),Qo(t)}function o9(t,e){e.parent===t?e.moveToTop():t.add(e),Qo(t)}function r5(t,e,n){e._remove(),t.add(e),e.setZIndex(n.getZIndex()),Qo(t)}function l9(t,e,n){r5(t,e,n)}function c9(t,e){e.destroy(),e.off($g),Qo(t)}function u9(t,e){e.destroy(),e.off($g),Qo(t)}function d9(t,e,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function f9(t,e,n){}function h9(t,e,n,s,i){AA(t,i,s)}function p9(t){t.hide(),Qo(t)}function A9(t){}function m9(t,e){(e.visible==null||e.visible)&&t.show()}function g9(t,e){}function v9(t){}function y9(){}const x9=()=>t5.DefaultEventPriority,b9=Object.freeze(Object.defineProperty({__proto__:null,appendChild:s9,appendChildToContainer:o9,appendInitialChild:U8,cancelTimeout:e9,clearContainer:v9,commitMount:f9,commitTextUpdate:d9,commitUpdate:h9,createInstance:j8,createTextInstance:G8,detachDeletedInstance:y9,finalizeInitialChildren:H8,getChildHostContext:Z8,getCurrentEventPriority:x9,getPublicInstance:X8,getRootHostContext:J8,hideInstance:p9,hideTextInstance:A9,idlePriority:ug.unstable_IdlePriority,insertBefore:r5,insertInContainerBefore:l9,isPrimaryRenderer:r9,noTimeout:t9,now:ug.unstable_now,prepareForCommit:W8,preparePortalMount:Q8,prepareUpdate:Y8,removeChild:c9,removeChildFromContainer:u9,resetAfterCommit:V8,resetTextContent:q8,run:ug.unstable_runWithPriority,scheduleTimeout:$8,shouldDeprioritizeSubtree:K8,shouldSetTextContent:n9,supportsMutation:i9,unhideInstance:m9,unhideTextInstance:g9,warnsIfNotActing:a9},Symbol.toStringTag,{value:"Module"}));var S9=Object.defineProperty,C9=Object.defineProperties,w9=Object.getOwnPropertyDescriptors,H2=Object.getOwnPropertySymbols,_9=Object.prototype.hasOwnProperty,E9=Object.prototype.propertyIsEnumerable,X2=(t,e,n)=>e in t?S9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,W2=(t,e)=>{for(var n in e||(e={}))_9.call(e,n)&&X2(t,n,e[n]);if(H2)for(var n of H2(e))E9.call(e,n)&&X2(t,n,e[n]);return t},T9=(t,e)=>C9(t,w9(e)),Q2,Y2;typeof window<"u"&&((Q2=window.document)!=null&&Q2.createElement||((Y2=window.navigator)==null?void 0:Y2.product)==="ReactNative")?_a.useLayoutEffect:_a.useEffect;function a5(t,e,n){if(!t)return;if(n(t)===!0)return t;let s=t.child;for(;s;){const i=a5(s,e,n);if(i)return i;s=s.sibling}}function i5(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const V2=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=V2;return}return V2.apply(this,arguments)};const ev=i5(_a.createContext(null));class s5 extends _a.Component{render(){return _a.createElement(ev.Provider,{value:this._reactInternals},this.props.children)}}function R9(){const t=_a.useContext(ev);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const e=_a.useId();return _a.useMemo(()=>{for(const s of[t,t==null?void 0:t.alternate]){if(!s)continue;const i=a5(s,!1,c=>{let d=c.memoizedState;for(;d;){if(d.memoizedState===e)return!0;d=d.next}});if(i)return i}},[t,e])}function D9(){const t=R9(),[e]=_a.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==ev&&!e.has(i)&&e.set(i,_a.useContext(i5(i)))}n=n.return}return e}function o5(){const t=D9();return _a.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>s=>_a.createElement(e,null,_a.createElement(n.Provider,T9(W2({},s),{value:t.get(n)}))),e=>_a.createElement(s5,W2({},e))),[t])}function L9(t){const e=oe.useRef({});return oe.useLayoutEffect(()=>{e.current=t}),oe.useLayoutEffect(()=>()=>{e.current={}},[]),e.current}const k9=t=>{const e=oe.useRef(null),n=oe.useRef(null),s=oe.useRef(null),i=L9(t),c=o5(),d=h=>{const{forwardedRef:p}=t;p&&(typeof p=="function"?p(h):p.current=h)};return oe.useLayoutEffect(()=>(n.current=new Pl.Stage({width:t.width,height:t.height,container:e.current}),d(n.current),s.current=vf.createContainer(n.current,t5.LegacyRoot,!1,null),vf.updateContainer(oe.createElement(c,{},t.children),s.current),()=>{Pl.isBrowser&&(d(null),vf.updateContainer(null,s.current,null),n.current.destroy())}),[]),oe.useLayoutEffect(()=>{d(n.current),AA(n.current,t,i),vf.updateContainer(oe.createElement(c,{},t.children),s.current,null)}),oe.createElement("div",{ref:e,id:t.id,accessKey:t.accessKey,className:t.className,role:t.role,style:t.style,tabIndex:t.tabIndex,title:t.title})},l5="Layer",di="Group",Vr="Rect",tv="Ellipse",Uo="Line",nA="Image",Ks="Text",nv="Arrow",rv="Transformer",vf=N8(b9);vf.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:process.env.NODE_ENV!=="production"?1:0,version:oe.version,rendererPackageName:"react-konva"});const c5=oe.forwardRef((t,e)=>oe.createElement(s5,{},oe.createElement(k9,{...t,forwardedRef:e}))),Vp=960,qp=540,u5=(t,e,n)=>{if(!n.enabled)return{x:t.x,y:t.y,guides:[]};let s=t.x,i=t.y;const c=[],d=Math.max(n.threshold,15),h=t.x,p=t.x+t.width,u=t.x+t.width/2,A=t.y,y=t.y+t.height,x=t.y+t.height/2,S=Vp/2,C=qp/2;if(n.snapToCenter&&(Math.abs(u-S)<d?(s=S-t.width/2,c.push({type:"vertical",position:S,isCenter:!0})):Math.abs(h-S)<d?(s=S,c.push({type:"vertical",position:S,isCenter:!0})):Math.abs(p-S)<d&&(s=S-t.width,c.push({type:"vertical",position:S,isCenter:!0})),Math.abs(x-C)<d?(i=C-t.height/2,c.push({type:"horizontal",position:C,isCenter:!0})):Math.abs(A-C)<d?(i=C,c.push({type:"horizontal",position:C,isCenter:!0})):Math.abs(y-C)<d&&(i=C-t.height,c.push({type:"horizontal",position:C,isCenter:!0}))),n.snapToEdges&&(Math.abs(h)<d&&(s=0,c.push({type:"vertical",position:0})),Math.abs(p-Vp)<d&&(s=Vp-t.width,c.push({type:"vertical",position:Vp})),Math.abs(A)<d&&(i=0,c.push({type:"horizontal",position:0})),Math.abs(y-qp)<d&&(i=qp-t.height,c.push({type:"horizontal",position:qp}))),n.snapToElements)for(const T of e){const R=T.x,D=T.x+T.width,M=T.x+T.width/2,P=T.y,O=T.y+T.height,I=T.y+T.height/2;Math.abs(h-R)<d&&(s=R,c.push({type:"vertical",position:R})),Math.abs(p-D)<d&&(s=D-t.width,c.push({type:"vertical",position:D})),Math.abs(u-M)<d&&(s=M-t.width/2,c.push({type:"vertical",position:M})),Math.abs(A-P)<d&&(i=P,c.push({type:"horizontal",position:P})),Math.abs(y-O)<d&&(i=O-t.height,c.push({type:"horizontal",position:O})),Math.abs(x-I)<d&&(i=I-t.height/2,c.push({type:"horizontal",position:I}))}return{x:s,y:i,guides:c}};var vu={},q2;function N9(){if(q2)return vu;q2=1;var t=Z2;if(process.env.NODE_ENV==="production")vu.createRoot=t.createRoot,vu.hydrateRoot=t.hydrateRoot;else{var e=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;vu.createRoot=function(n,s){e.usingClientEntryPoint=!0;try{return t.createRoot(n,s)}finally{e.usingClientEntryPoint=!1}},vu.hydrateRoot=function(n,s,i){e.usingClientEntryPoint=!0;try{return t.hydrateRoot(n,s,i)}finally{e.usingClientEntryPoint=!1}}}return vu}var B9=N9();const M9=lA(B9);var P9=function(t,e){var n={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&Object.prototype.propertyIsEnumerable.call(t,s[i])&&(n[s[i]]=t[s[i]]);return n};const z9=t=>{const e=window.getComputedStyle(t).position;return!(e==="absolute"||e==="relative")};function F9(t=()=>{}){const e=oe.useRef(t);return e.current=t,oe.useCallback((...n)=>e.current.apply(null,n),[])}const Fg=({children:t,groupProps:e,divProps:n,transform:s,transformFunc:i,parentNodeFunc:c})=>{const d=o5(),h=oe.useRef(null),[p]=oe.useState(()=>document.createElement("div")),u=oe.useMemo(()=>M9.createRoot(p),[p]),A=s??!0,y=F9(()=>{if(A&&h.current){let R=h.current.getAbsoluteTransform().decompose();i&&(R=i(R)),p.style.position="absolute",p.style.zIndex="10",p.style.top="0px",p.style.left="0px",p.style.transform=`translate(${R.x}px, ${R.y}px) rotate(${R.rotation}deg) scaleX(${R.scaleX}) scaleY(${R.scaleY})`,p.style.transformOrigin="top left"}else p.style.position="",p.style.zIndex="",p.style.top="",p.style.left="",p.style.transform="",p.style.transformOrigin="";const x=n||{},{style:S}=x,C=P9(x,["style"]);Object.assign(p.style,S),Object.assign(p,C)});return oe.useLayoutEffect(()=>{var x;const S=h.current;if(!S)return;const C=c?c({stage:S.getStage()}):(x=S.getStage())===null||x===void 0?void 0:x.container();if(C)return C.appendChild(p),A&&z9(C)&&(C.style.position="relative"),S.on("absoluteTransformChange",y),y(),()=>{var T;S.off("absoluteTransformChange",y),(T=p.parentNode)===null||T===void 0||T.removeChild(p)}},[A,c]),oe.useLayoutEffect(()=>{y()},[n,i]),oe.useLayoutEffect(()=>{queueMicrotask(()=>{Z2.flushSync(()=>{u.render(oe.createElement(d,null,t))})})}),oe.useLayoutEffect(()=>()=>{setTimeout(()=>{u.unmount()})},[]),oe.createElement(di,Object.assign({ref:h},e))};var dg,K2;function I9(){if(K2)return dg;K2=1;var t=oe;return dg=function(n,s,i){const c=t.useRef("loading"),d=t.useRef(),[h,p]=t.useState(0),u=t.useRef(),A=t.useRef(),y=t.useRef();return(u.current!==n||A.current!==s||y.current!==i)&&(c.current="loading",d.current=void 0,u.current=n,A.current=s,y.current=i),t.useLayoutEffect(function(){if(!n)return;var x=document.createElement("img");function S(){x.decode().catch(()=>{}).finally(()=>{c.current="loaded",d.current=x,p(Math.random())})}function C(){c.current="failed",d.current=void 0,p(Math.random())}return x.addEventListener("load",S),x.addEventListener("error",C),s&&(x.crossOrigin=s),i&&(x.referrerPolicy=i),x.src=n,function(){x.removeEventListener("load",S),x.removeEventListener("error",C)}},[n,s,i]),[d.current,c.current]},dg}var O9=I9();const U9=lA(O9),d5=({element:t,isSelected:e,onSelect:n,onChange:s,onDragStart:i,onDragEnd:c})=>{const d=oe.useRef(null),h=oe.useRef(null),p=oe.useRef(null),[u,A]=oe.useState(!1),[y,x]=oe.useState(t.fontSize*2);oe.useEffect(()=>{var M;e&&!u&&p.current&&d.current&&(p.current.nodes([d.current]),(M=p.current.getLayer())==null||M.batchDraw())},[e,u]),oe.useEffect(()=>{h.current&&x(h.current.height())},[t.content,t.fontSize,t.width]);const S=oe.useCallback(()=>{A(!0)},[]),C=oe.useCallback(M=>{s({content:M}),A(!1)},[s]),T=M=>{const P=M.target;s({x:P.x()-P.offsetX(),y:P.y()-P.offsetY()},!0)},R=M=>{const P=M.target;s({x:P.x()-P.offsetX(),y:P.y()-P.offsetY()}),c==null||c()},D=()=>{const M=d.current;if(!M)return;const P=M.scaleX(),O=Math.max(50,t.width*P);M.scaleX(1),M.scaleY(1),M.offsetX(O/2),s({x:M.x()-O/2,y:M.y()-M.offsetY(),width:O,rotation:M.rotation()})};return w.jsxs(w.Fragment,{children:[w.jsx(di,{ref:d,x:t.x+t.width/2,y:t.y+y/2,offsetX:t.width/2,offsetY:y/2,rotation:t.rotation,draggable:!u,onClick:n,onTap:n,onDblClick:S,onDblTap:S,onDragStart:()=>i==null?void 0:i(),onDragMove:T,onDragEnd:R,onTransformStart:()=>i==null?void 0:i(),onTransformEnd:D,children:w.jsx(Ks,{ref:h,x:0,y:0,width:t.width,text:t.content,fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontWeight==="700"||t.fontWeight==="800"?"bold":"normal",fill:t.fill,align:t.align,lineHeight:t.lineHeight||1.2,opacity:u?0:1})}),e&&!u&&w.jsx(rv,{ref:p,flipEnabled:!1,enabledAnchors:["middle-left","middle-right"],rotateEnabled:!0,rotateAnchorOffset:20,rotateAnchorCursor:"grab",anchorSize:10,anchorCornerRadius:5,anchorFill:"#ffffff",anchorStroke:"#5B6EF7",anchorStrokeWidth:2,borderStroke:"#5B6EF7",borderStrokeWidth:2,rotationSnaps:[0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345],rotationSnapTolerance:5,boundBoxFunc:(M,P)=>Math.abs(P.width)<50?M:P}),u&&w.jsx(Fg,{groupProps:{x:t.x,y:t.y},divProps:{style:{opacity:1}},children:w.jsx(G9,{element:t,onComplete:C,onCancel:()=>A(!1)})})]})},j9=t=>{let e=t.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const n=parseInt(e.substring(0,2),16),s=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16);return(n*299+s*587+i*114)/1e3>180},G9=({element:t,onComplete:e,onCancel:n})=>{const s=oe.useRef(null),[i,c]=oe.useState(t.content),d=j9(t.fill)?"#1e293b":t.fill;oe.useEffect(()=>{const u=s.current;u&&requestAnimationFrame(()=>{u.focus(),u.select()})},[]);const h=u=>{u.key==="Escape"?n():u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),e(i))},p=()=>{setTimeout(()=>{e(i)},100)};return w.jsx("textarea",{ref:s,value:i,onChange:u=>c(u.target.value),onKeyDown:h,onBlur:p,style:{width:`${t.width}px`,minHeight:"60px",padding:"8px",fontSize:`${t.fontSize}px`,fontFamily:t.fontFamily,color:d,textAlign:t.align,border:"2px solid #5B6EF7",borderRadius:"8px",outline:"none",resize:"vertical",backgroundColor:"white",boxShadow:"0 4px 20px rgba(0,0,0,0.15)",lineHeight:t.lineHeight||1.2},placeholder:"텍스트를 입력하세요... (마크다운 지원: **굵게**, *기울임*)"})},f5=({element:t,isSelected:e,onSelect:n,onChange:s,onDragStart:i,onDragEnd:c,onReplaceWithImage:d})=>{const h=oe.useRef(null),p=oe.useRef(null),u=oe.useRef(null),[A,y]=oe.useState(!1);oe.useEffect(()=>{var q;e&&!A&&p.current&&h.current&&(p.current.nodes([h.current]),(q=p.current.getLayer())==null||q.batchDraw())},[e,A]);const x=q=>{const Q=q.target;s({x:Q.x()-Q.offsetX(),y:Q.y()-Q.offsetY()},!0)},S=q=>{const Q=q.target;s({x:Q.x()-Q.offsetX(),y:Q.y()-Q.offsetY()}),c==null||c()},C=()=>{const q=h.current;if(!q)return;const Q=q.scaleX(),V=q.scaleY(),ge=Math.max(10,t.width*Q),X=Math.max(10,t.height*V);q.scaleX(1),q.scaleY(1),q.offsetX(ge/2),q.offsetY(X/2),s({x:q.x()-ge/2,y:q.y()-X/2,width:ge,height:X,rotation:q.rotation()})},T=oe.useCallback(()=>{t.isImagePlaceholder&&u.current&&u.current.click()},[t.isImagePlaceholder]),R=oe.useCallback(q=>{var ge;const Q=(ge=q.target.files)==null?void 0:ge[0];if(!Q||!d)return;const V=new FileReader;V.onload=X=>{var ne;const se=(ne=X.target)==null?void 0:ne.result,L=new window.Image;L.onload=()=>{const le=L.width/L.height,pe=t.width/t.height;let J=0,ae=0,re=L.width,U=L.height;le>pe?(re=L.height*pe,J=(L.width-re)/2):(U=L.width/pe,ae=(L.height-U)/2),d({src:se,width:t.width,height:t.height,crop:{x:J,y:ae,width:re,height:U}})},L.src=se},V.readAsDataURL(Q),q.target.value=""},[t.width,t.height,d]),D=oe.useCallback(()=>{t.isImagePlaceholder||t.shapeType==="line"||t.shapeType==="arrow"||y(!0)},[t.shapeType,t.isImagePlaceholder]),M=oe.useCallback(q=>{s({text:q}),y(!1)},[s]),P=()=>[t.width/2,0,t.width,t.height,0,t.height],O=()=>[0,0,t.width,t.height],I=()=>{const q={fill:t.fill,stroke:t.stroke,strokeWidth:t.strokeWidth};switch(t.shapeType){case"rect":return w.jsx(Vr,{width:t.width,height:t.height,cornerRadius:t.cornerRadius||0,...q});case"ellipse":return w.jsx(tv,{x:t.width/2,y:t.height/2,radiusX:t.width/2,radiusY:t.height/2,...q});case"triangle":return w.jsx(Uo,{points:P(),closed:!0,...q});case"line":return w.jsx(Uo,{points:O(),stroke:t.stroke,strokeWidth:t.strokeWidth});case"arrow":return w.jsx(nv,{points:O(),stroke:t.stroke,fill:t.stroke,strokeWidth:t.strokeWidth,pointerLength:10,pointerWidth:10});default:return null}},Y=t.shapeType!=="line"&&t.shapeType!=="arrow",K=oe.useCallback(()=>{t.isImagePlaceholder&&T(),n()},[t.isImagePlaceholder,T,n]);return w.jsxs(w.Fragment,{children:[t.isImagePlaceholder&&w.jsx(Fg,{groupProps:{x:0,y:0},divProps:{style:{display:"none"}},children:w.jsx("input",{ref:u,type:"file",accept:"image/*",onChange:R,style:{display:"none"}})}),w.jsxs(di,{ref:h,x:t.x+t.width/2,y:t.y+t.height/2,offsetX:t.width/2,offsetY:t.height/2,rotation:t.rotation,draggable:!A,onClick:K,onTap:K,onDblClick:D,onDblTap:D,onDragStart:()=>i==null?void 0:i(),onDragMove:x,onDragEnd:S,onTransformStart:()=>i==null?void 0:i(),onTransformEnd:C,style:{cursor:t.isImagePlaceholder?"pointer":"move"},children:[I(),Y&&t.text&&!A&&w.jsx(Ks,{x:0,y:0,width:t.width,height:t.height,text:t.text,fontSize:t.textSize||16,fill:t.textColor||"#1e293b",align:"center",verticalAlign:"middle",listening:!1}),A&&w.jsx(Fg,{groupProps:{x:0,y:0},divProps:{style:{opacity:1}},children:w.jsx(X9,{element:t,onComplete:M,onCancel:()=>y(!1)})})]}),e&&!A&&w.jsx(rv,{ref:p,flipEnabled:!1,rotateEnabled:!0,rotateAnchorOffset:20,rotateAnchorCursor:"grab",anchorSize:10,anchorCornerRadius:5,anchorFill:"#ffffff",anchorStroke:"#5B6EF7",anchorStrokeWidth:2,borderStroke:"#5B6EF7",borderStrokeWidth:2,rotationSnaps:[0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345],rotationSnapTolerance:5,boundBoxFunc:(q,Q)=>Math.abs(Q.width)<10||Math.abs(Q.height)<10?q:Q})]})},H9=t=>{let e=t.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const n=parseInt(e.substring(0,2),16),s=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16);return(n*299+s*587+i*114)/1e3>180},X9=({element:t,onComplete:e,onCancel:n})=>{const s=oe.useRef(null),[i,c]=oe.useState(t.text||""),d=t.textColor||"#1e293b",h=H9(d)?"#1e293b":d;oe.useEffect(()=>{s.current&&requestAnimationFrame(()=>{var A,y;(A=s.current)==null||A.focus(),(y=s.current)==null||y.select()})},[]);const p=A=>{A.key==="Escape"?n():A.key==="Enter"&&(A.preventDefault(),e(i))},u=()=>{setTimeout(()=>{e(i)},100)};return w.jsx("input",{ref:s,type:"text",value:i,onChange:A=>c(A.target.value),onKeyDown:p,onBlur:u,style:{width:`${t.width}px`,height:`${t.height}px`,padding:"8px",fontSize:`${t.textSize||16}px`,color:h,textAlign:"center",border:"2px solid #5B6EF7",borderRadius:t.shapeType==="ellipse"?"50%":"8px",outline:"none",backgroundColor:"rgba(255,255,255,0.9)",boxShadow:"0 4px 20px rgba(0,0,0,0.15)"},placeholder:"텍스트 입력..."})},h5=({element:t,isSelected:e,onSelect:n,onChange:s,onDragStart:i,onDragEnd:c})=>{const d=oe.useRef(null),h=oe.useRef(null),p=oe.useRef(null),[u,A]=oe.useState(null),[y,x]=oe.useState(!1),[S,C]=oe.useState({x:0,y:0}),[T,R]=oe.useState(1);oe.useEffect(()=>{const re=new window.Image;re.src=t.src,re.onload=()=>{A(re)}},[t.src]),oe.useEffect(()=>{var re;e&&!y&&h.current&&d.current&&(h.current.nodes([d.current]),(re=h.current.getLayer())==null||re.batchDraw())},[e,y]),oe.useEffect(()=>{y&&(C({x:0,y:0}),R(1))},[y]);const D=oe.useCallback(re=>{if(!t.crop||!u)return;const U=t.crop,ee=T,Ee=Math.max(1,Math.min(3,re)),Te=t.width/2,Ne=t.height/2,Ue=t.width/U.width*ee,ot=t.height/U.height*ee,lt=-U.x*Ue+S.x,pt=-U.y*ot+S.y,Lt=(Te-lt)/Ue,qe=(Ne-pt)/ot,Dt=t.width/U.width*Ee,me=t.height/U.height*Ee,k=Te-Lt*Dt,ce=Ne-qe*me,de=k+U.x*Dt,G=ce+U.y*me,j=u.width*Dt,$=u.height*me,ye=t.width-j,Ce=0,Ae=t.height-$,ze=0,We=Math.max(ye,Math.min(Ce,de)),Ie=Math.max(Ae,Math.min(ze,G));R(Ee),C({x:We,y:Ie})},[t.crop,t.width,t.height,u,T,S]),M=re=>{const U=re.target;s({x:U.x()-t.width/2,y:U.y()-t.height/2},!0)},P=re=>{const U=re.target;s({x:U.x()-t.width/2,y:U.y()-t.height/2}),c==null||c()},O=()=>{const re=d.current;if(!re)return;const U=re.scaleX(),ee=re.scaleY(),Ee=Math.max(20,t.width*U),Te=Math.max(20,t.height*ee);re.scaleX(1),re.scaleY(1),re.offsetX(Ee/2),re.offsetY(Te/2),s({x:re.x()-Ee/2,y:re.y()-Te/2,width:Ee,height:Te,rotation:re.rotation()})},I=oe.useCallback(re=>{const U=t.cornerRadius||0,ee=t.width,Ee=t.height;if(U===0)re.rect(0,0,ee,Ee);else{const Te=Math.min(U,ee/2,Ee/2);re.beginPath(),re.moveTo(Te,0),re.lineTo(ee-Te,0),re.arcTo(ee,0,ee,Te,Te),re.lineTo(ee,Ee-Te),re.arcTo(ee,Ee,ee-Te,Ee,Te),re.lineTo(Te,Ee),re.arcTo(0,Ee,0,Ee-Te,Te),re.lineTo(0,Te),re.arcTo(0,0,Te,0,Te),re.closePath()}},[t.cornerRadius,t.width,t.height]),Y=oe.useCallback(()=>{t.crop&&x(!0)},[t.crop]),K=oe.useCallback(re=>{const U=re.target,ee=t.crop;if(!ee||!u)return;const Ee=t.width/ee.width*T,Te=t.height/ee.height*T,Ne=u.width*Ee,Ue=u.height*Te,ot=-ee.x*Ee,lt=-ee.y*Te,pt=t.width-Ne,Lt=0,qe=t.height-Ue,Dt=0,me=Math.max(pt,Math.min(Lt,U.x())),k=Math.max(qe,Math.min(Dt,U.y()));U.x(me),U.y(k),C({x:me-ot,y:k-lt})},[t.crop,t.width,t.height,u,T]),q=oe.useCallback(()=>{if(!t.crop||!u){x(!1);return}const re=t.crop,U=re.width/t.width/T,ee=re.height/t.height/T,Ee=re.width/T,Te=re.height/T,Ne=Math.max(0,Math.min(u.width-Ee,re.x-S.x*U)),Ue=Math.max(0,Math.min(u.height-Te,re.y-S.y*ee));s({crop:{x:Ne,y:Ue,width:Ee,height:Te}}),x(!1),C({x:0,y:0}),R(1)},[t.crop,t.width,t.height,u,S,T,s]),Q=oe.useCallback(()=>{x(!1),C({x:0,y:0}),R(1)},[]),V=oe.useCallback(()=>{C({x:0,y:0}),R(1)},[]);if(oe.useEffect(()=>{if(!y)return;const re=U=>{U.key==="Escape"?Q():U.key==="Enter"&&q()};return window.addEventListener("keydown",re),()=>window.removeEventListener("keydown",re)},[y,q,Q]),!u)return null;const ge=t.crop,X=ge?t.width/ge.width:1,se=ge?t.height/ge.height:1,L=y?X*T:X,ne=y?se*T:se,le=u.width*L,pe=u.height*ne,J=ge?-ge.x*L:0,ae=ge?-ge.y*ne:0;return w.jsxs(w.Fragment,{children:[y&&ge&&w.jsxs(di,{x:t.x+t.width/2,y:t.y+t.height/2,offsetX:t.width/2,offsetY:t.height/2,rotation:t.rotation,children:[w.jsx(Vr,{x:J+S.x-500,y:ae+S.y-500,width:le+1e3,height:pe+1e3,fill:"rgba(0,0,0,0.5)",listening:!1}),w.jsx(nA,{ref:p,image:u,x:J+S.x,y:ae+S.y,width:le,height:pe,opacity:.7,draggable:!0,onDragMove:K}),w.jsx(di,{clipFunc:re=>re.rect(0,0,t.width,t.height),listening:!1,children:w.jsx(nA,{image:u,x:J+S.x,y:ae+S.y,width:le,height:pe})}),w.jsx(Vr,{x:0,y:0,width:t.width,height:t.height,stroke:"#5B6EF7",strokeWidth:2,fill:"transparent",listening:!1}),[{x:0,y:0},{x:t.width,y:0},{x:0,y:t.height},{x:t.width,y:t.height}].map((re,U)=>w.jsx(Vr,{x:re.x-5,y:re.y-5,width:10,height:10,fill:"#ffffff",stroke:"#5B6EF7",strokeWidth:2,cornerRadius:2,listening:!1},U))]}),!y&&w.jsx(di,{ref:d,x:t.x+t.width/2,y:t.y+t.height/2,offsetX:t.width/2,offsetY:t.height/2,rotation:t.rotation,draggable:!0,onClick:n,onTap:n,onDblClick:Y,onDblTap:Y,onDragStart:()=>i==null?void 0:i(),onDragMove:M,onDragEnd:P,onTransformStart:()=>i==null?void 0:i(),onTransformEnd:O,clipFunc:t.cornerRadius?I:void 0,children:w.jsx(nA,{image:u,x:0,y:0,width:t.width,height:t.height,crop:t.crop})}),y&&w.jsxs(di,{x:t.x,y:t.y-50,children:[w.jsx(Vr,{x:0,y:0,width:390,height:40,fill:"white",cornerRadius:8,shadowColor:"black",shadowBlur:10,shadowOpacity:.15}),w.jsxs(di,{x:10,y:5,onClick:()=>D(T-.25),onTap:()=>D(T-.25),children:[w.jsx(Vr,{width:30,height:30,fill:T<=1?"#e2e8f0":"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"-",x:0,y:0,width:30,height:30,align:"center",verticalAlign:"middle",fill:T<=1?"#94a3b8":"#64748b",fontSize:18,fontFamily:"Inter"})]}),w.jsx(Ks,{text:`${Math.round(T*100)}%`,x:45,y:5,width:50,height:30,align:"center",verticalAlign:"middle",fill:"#334155",fontSize:12,fontFamily:"Inter"}),w.jsxs(di,{x:100,y:5,onClick:()=>D(T+.25),onTap:()=>D(T+.25),children:[w.jsx(Vr,{width:30,height:30,fill:T>=3?"#e2e8f0":"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"+",x:0,y:0,width:30,height:30,align:"center",verticalAlign:"middle",fill:T>=3?"#94a3b8":"#64748b",fontSize:18,fontFamily:"Inter"})]}),w.jsxs(di,{x:140,y:5,onClick:V,onTap:V,children:[w.jsx(Vr,{width:50,height:30,fill:"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"↺",x:0,y:0,width:50,height:30,align:"center",verticalAlign:"middle",fill:"#64748b",fontSize:16,fontFamily:"Inter"})]}),w.jsxs(di,{x:200,y:5,onClick:q,onTap:q,children:[w.jsx(Vr,{width:85,height:30,fill:"#5B6EF7",cornerRadius:6}),w.jsx(Ks,{text:"완료",x:0,y:0,width:85,height:30,align:"center",verticalAlign:"middle",fill:"white",fontSize:13,fontFamily:"Malgun Gothic"})]}),w.jsxs(di,{x:295,y:5,onClick:Q,onTap:Q,children:[w.jsx(Vr,{width:85,height:30,fill:"#f1f5f9",cornerRadius:6}),w.jsx(Ks,{text:"취소",x:0,y:0,width:85,height:30,align:"center",verticalAlign:"middle",fill:"#64748b",fontSize:13,fontFamily:"Malgun Gothic"})]})]}),e&&!y&&w.jsx(rv,{ref:h,flipEnabled:!1,rotateEnabled:!0,rotateAnchorOffset:20,rotateAnchorCursor:"grab",anchorSize:10,anchorCornerRadius:5,anchorFill:"#ffffff",anchorStroke:"#5B6EF7",anchorStrokeWidth:2,borderStroke:"#5B6EF7",borderStrokeWidth:2,rotationSnaps:[0,15,30,45,60,75,90,105,120,135,150,165,180,195,210,225,240,255,270,285,300,315,330,345],rotationSnapTolerance:5,boundBoxFunc:(re,U)=>Math.abs(U.width)<20||Math.abs(U.height)<20?re:U})]})},yu=960,xu=540,p5=()=>{const t=oe.useRef(null),e=oe.useRef(null),[n,s]=oe.useState(1);oe.useEffect(()=>{const me=()=>{if(!e.current)return;const ce=e.current.offsetWidth,de=e.current.offsetHeight,G=48,j=ce-G,$=de-G,ye=j/yu,Ce=$/xu,Ae=Math.min(ye,Ce);s(Ae)};me();const k=new ResizeObserver(me);return e.current&&k.observe(e.current),()=>k.disconnect()},[]);const i=Ve(me=>me.slides),c=Ve(me=>me.currentSlideIndex),d=Ve(me=>me.selectedElementId),h=Ve(me=>me.mode),p=Ve(me=>me.currentShapeType),u=Ve(me=>me.currentTextStyle),A=Ve(me=>me.currentFontFamily),y=Ve(me=>me.addElement),x=Ve(me=>me.updateElement),S=Ve(me=>me.deleteElement),C=Ve(me=>me.selectElement),T=Ve(me=>me.setMode),R=Ve(me=>me.snapSettings),D=Ve(me=>me.commitElementUpdate),M=Ve(me=>me.selectedElementIds),P=Ve(me=>me.selectElements),O=Ve(me=>me.clearSelection),I=i[c],[Y,K]=oe.useState([]),[q,Q]=oe.useState(!1),[V,ge]=oe.useState(null),[X,se]=oe.useState(!1),[L,ne]=oe.useState(null),[le,pe]=oe.useState(!1),[J,ae]=oe.useState(null),[re,U]=oe.useState("default"),ee=oe.useCallback(me=>{if(!d)return{isInZone:!1,element:null,corner:""};const k=I.elements.find(j=>j.id===d);if(!k)return{isInZone:!1,element:null,corner:""};const ce=[{name:"nw",x:k.x,y:k.y,checkX:-1,checkY:-1},{name:"ne",x:k.x+k.width,y:k.y,checkX:1,checkY:-1},{name:"sw",x:k.x,y:k.y+k.height,checkX:-1,checkY:1},{name:"se",x:k.x+k.width,y:k.y+k.height,checkX:1,checkY:1}],de=5,G=40;for(const j of ce){const $=me.x-j.x,ye=me.y-j.y,Ce=Math.sqrt($*$+ye*ye);if(Ce>=de&&Ce<=G){const Ae=j.checkX<0&&$<0||j.checkX>0&&$>0,ze=j.checkY<0&&ye<0||j.checkY>0&&ye>0;if(Ae&&ze)return{isInZone:!0,element:k,corner:j.name};if((Ae||ze)&&Ce<=25)return{isInZone:!0,element:k,corner:j.name}}}return{isInZone:!1,element:null,corner:""}},[d,I.elements]),Ee=oe.useCallback(me=>{var G;const k=t.current;if(!k)return;const ce=k.getPointerPosition();if(!ce)return;if(h==="select"){const j=ee(ce);if(j.isInZone&&j.element){D();const $=j.element,ye=$.x+$.width/2,Ce=$.y+$.height/2,Ae=Math.atan2(ce.y-Ce,ce.x-ye)*(180/Math.PI);pe(!0),ae({elementId:$.id,centerX:ye,centerY:Ce,startAngle:Ae,initialRotation:$.rotation||0});return}}me.target===((G=me.target.getStage())==null?void 0:G.findOne(".background"))&&(h==="select"?(se(!0),ne({startX:ce.x,startY:ce.y,currentX:ce.x,currentY:ce.y})):(h==="text"||h==="shape")&&(Q(!0),ge({startX:ce.x,startY:ce.y,currentX:ce.x,currentY:ce.y})))},[h,O,ee,D]),Te=oe.useCallback(me=>{const k=t.current;if(!k)return;const ce=k.getPointerPosition();if(ce){if(le&&J){const G=Math.atan2(ce.y-J.centerY,ce.x-J.centerX)*(180/Math.PI)-J.startAngle;let j=J.initialRotation+G;const $=15,ye=5,Ce=Math.round(j/$)*$;Math.abs(j-Ce)<ye&&(j=Ce),j=(j%360+360)%360,x(J.elementId,{rotation:j});return}if(h==="select"&&!X&&!q){const de=ee(ce);de.isInZone?U({nw:"nwse-resize",ne:"nesw-resize",sw:"nesw-resize",se:"nwse-resize"}[de.corner]||"grab"):U("default")}if(X&&L){ne({...L,currentX:ce.x,currentY:ce.y});return}q&&V&&ge({...V,currentX:ce.x,currentY:ce.y})}},[q,V,X,L,le,J,h,ee,x]),Ne=oe.useCallback(me=>{const k=Math.min(me.startX,me.currentX),ce=Math.min(me.startY,me.currentY),de=Math.abs(me.currentX-me.startX),G=Math.abs(me.currentY-me.startY);return de<5&&G<5?[]:I.elements.filter(j=>{const $=j.x+j.width,ye=j.y+j.height,Ce=k+de,Ae=ce+G;return j.x<Ce&&$>k&&j.y<Ae&&ye>ce}).map(j=>j.id)},[I.elements]),Ue=oe.useCallback(()=>{if(le){pe(!1),ae(null),U("default");return}if(X&&L){const ye=Ne(L);ye.length>0?P(ye):O(),se(!1),ne(null);return}if(!q||!V)return;const me=Math.min(V.startX,V.currentX),k=Math.min(V.startY,V.currentY),ce=Math.abs(V.currentX-V.startX),de=Math.abs(V.currentY-V.startY),G=20,j=Math.max(ce,G),$=Math.max(de,G);if(h==="text"){const ye=Eu[u],Ce={id:fi(),type:"text",x:me,y:k,width:j<100?u==="title"?600:300:j,height:$<50?ye.fontSize*2:$,rotation:0,content:u==="title"?"제목을 입력하세요":u==="subtitle"?"소제목을 입력하세요":"텍스트를 입력하세요",fontSize:ye.fontSize,fontFamily:A,fill:"#1e293b",align:u==="title"||u==="subtitle"?"center":"left",textStyle:u,fontWeight:ye.fontWeight,lineHeight:ye.lineHeight};y(Ce)}else if(h==="shape"){const ye={id:fi(),type:"shape",x:me,y:k,width:j,height:$,rotation:0,shapeType:p,fill:"#5B6EF7",stroke:"#4338ca",strokeWidth:2};y(ye)}Q(!1),ge(null),T("select")},[q,V,h,p,u,A,y,T,X,L,Ne,P,O,le]),ot=()=>{if(!X||!L)return null;const me=Math.min(L.startX,L.currentX),k=Math.min(L.startY,L.currentY),ce=Math.abs(L.currentX-L.startX),de=Math.abs(L.currentY-L.startY);return w.jsx(Vr,{x:me,y:k,width:ce,height:de,fill:"rgba(91, 110, 247, 0.1)",stroke:"#5B6EF7",strokeWidth:1,dash:[4,4]})},lt=()=>{if(!q||!V)return null;const me=Math.min(V.startX,V.currentX),k=Math.min(V.startY,V.currentY),ce=Math.abs(V.currentX-V.startX),de=Math.abs(V.currentY-V.startY);if(h==="text")return w.jsx(Vr,{x:me,y:k,width:ce||100,height:de||40,fill:"rgba(91, 110, 247, 0.1)",stroke:"#5B6EF7",strokeWidth:1,dash:[5,5]});if(h==="shape"){const G={fill:"rgba(91, 110, 247, 0.3)",stroke:"#5B6EF7",strokeWidth:2};switch(p){case"rect":return w.jsx(Vr,{x:me,y:k,width:ce,height:de,...G});case"ellipse":return w.jsx(tv,{x:me+ce/2,y:k+de/2,radiusX:ce/2,radiusY:de/2,...G});case"triangle":return w.jsx(Uo,{points:[me+ce/2,k,me+ce,k+de,me,k+de],closed:!0,...G});case"line":return w.jsx(Uo,{points:[V.startX,V.startY,V.currentX,V.currentY],stroke:"#5B6EF7",strokeWidth:2});case"arrow":return w.jsx(nv,{points:[V.startX,V.startY,V.currentX,V.currentY],stroke:"#5B6EF7",fill:"#5B6EF7",strokeWidth:2,pointerLength:10,pointerWidth:10});default:return null}}return null},pt=oe.useCallback((me,k,ce=!1)=>{if(ce&&R.enabled&&"x"in k&&"y"in k){const de=I.elements.find(G=>G.id===me);if(de){const G="width"in k?k.width:de.width,j="height"in k?k.height:de.height,$=I.elements.filter(Ce=>Ce.id!==me),ye=u5({x:k.x,y:k.y,width:G,height:j},$,R);K(ye.guides),x(me,{...k,x:ye.x,y:ye.y});return}}K([]),x(me,k)},[x,R,I.elements]),Lt=oe.useCallback(()=>{K([])},[]),qe=oe.useCallback((me,k)=>{const ce={id:fi(),type:"image",x:me.x,y:me.y,width:me.width,height:me.height,rotation:me.rotation,src:k.src,crop:k.crop};S(me.id),y(ce)},[S,y]),Dt=()=>Y.length===0?null:Y.map((me,k)=>{const ce=me.isCenter,de=ce?"#5B6EF7":"#ef4444",G=ce?2:1,j=ce?[8,4]:[4,4];return me.type==="vertical"?w.jsx(Uo,{points:[me.position,0,me.position,xu],stroke:de,strokeWidth:G,dash:j},`guide-${k}`):w.jsx(Uo,{points:[0,me.position,yu,me.position],stroke:de,strokeWidth:G,dash:j},`guide-${k}`)});return w.jsx(z.Center,{ref:e,w:"100%",h:"100%",children:w.jsx(z.Box,{style:{width:yu*n,height:xu*n},children:w.jsx(z.Box,{bg:"white",style:{width:yu,height:xu,transform:`scale(${n})`,transformOrigin:"top left",borderRadius:"var(--mantine-radius-md)",overflow:"hidden",boxShadow:"0 20px 70px rgba(0, 0, 0, 0.12)"},children:w.jsx(c5,{ref:t,width:yu,height:xu,onMouseDown:Ee,onMouseMove:Te,onMouseUp:Ue,onMouseLeave:Ue,style:{cursor:h!=="select"?"crosshair":le?"grabbing":re},children:w.jsxs(l5,{children:[w.jsx(Vr,{name:"background",x:0,y:0,width:yu,height:xu,fill:I.background}),I.elements.map(me=>{const k=d===me.id||M.includes(me.id);return me.type==="text"?w.jsx(d5,{element:me,isSelected:k,onSelect:()=>C(me.id),onChange:(ce,de)=>pt(me.id,ce,de),onDragStart:D,onDragEnd:Lt},me.id):me.type==="shape"?w.jsx(f5,{element:me,isSelected:k,onSelect:()=>C(me.id),onChange:(ce,de)=>pt(me.id,ce,de),onDragStart:D,onDragEnd:Lt,onReplaceWithImage:ce=>qe(me,ce)},me.id):me.type==="image"?w.jsx(h5,{element:me,isSelected:k,onSelect:()=>C(me.id),onChange:(ce,de)=>pt(me.id,ce,de),onDragStart:D,onDragEnd:Lt},me.id):null}),Dt(),lt(),ot()]})})})})})},oA=142,Ig=80,W9=960,nn=oA/W9,Q9=({element:t,scale:e})=>{const[n]=U9(t.src);return n?w.jsx(nA,{image:n,x:t.x*e,y:t.y*e,width:t.width*e,height:t.height*e,rotation:t.rotation}):null},Y9=({slide:t})=>{const e=oe.useMemo(()=>t.elements.map(n=>{if(n.type==="text"){const s=n;return w.jsx(Ks,{x:s.x*nn,y:s.y*nn,width:s.width*nn,height:s.height*nn,text:a6(s.content),fontSize:s.fontSize*nn,fontFamily:s.fontFamily,fill:s.fill,align:s.align,rotation:s.rotation},n.id)}else if(n.type==="shape"){const s=n,i={x:s.x*nn,y:s.y*nn,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth*nn,rotation:s.rotation};switch(s.shapeType){case"rect":return w.jsx(Vr,{width:s.width*nn,height:s.height*nn,...i},n.id);case"ellipse":return w.jsx(tv,{x:(s.x+s.width/2)*nn,y:(s.y+s.height/2)*nn,radiusX:s.width/2*nn,radiusY:s.height/2*nn,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth*nn,rotation:s.rotation},n.id);case"triangle":return w.jsx(Uo,{points:[(s.x+s.width/2)*nn,s.y*nn,(s.x+s.width)*nn,(s.y+s.height)*nn,s.x*nn,(s.y+s.height)*nn],closed:!0,fill:s.fill,stroke:s.stroke,strokeWidth:s.strokeWidth*nn},n.id);case"line":return w.jsx(Uo,{points:[s.x*nn,s.y*nn,(s.x+s.width)*nn,(s.y+s.height)*nn],stroke:s.stroke,strokeWidth:s.strokeWidth*nn},n.id);case"arrow":return w.jsx(nv,{points:[s.x*nn,s.y*nn,(s.x+s.width)*nn,(s.y+s.height)*nn],stroke:s.stroke,fill:s.stroke,strokeWidth:s.strokeWidth*nn,pointerLength:5,pointerWidth:5},n.id);default:return null}}else if(n.type==="image")return w.jsx(Q9,{element:n,scale:nn},n.id);return null}),[t.elements]);return w.jsx(c5,{width:oA,height:Ig,children:w.jsxs(l5,{children:[w.jsx(Vr,{x:0,y:0,width:oA,height:Ig,fill:t.background}),e]})})},A5=()=>{const t=Ve(p=>p.slides),e=Ve(p=>p.currentSlideIndex),n=Ve(p=>p.selectSlide),s=Ve(p=>p.addSlide),i=Ve(p=>p.deleteSlide),[c,d]=oe.useState(null),h=(p,u)=>{p.stopPropagation(),t.length>1&&i(u)};return w.jsx(z.Box,{h:128,bg:"white",px:"md",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.ScrollArea,{h:"100%",type:"auto",scrollbarSize:6,children:w.jsxs(z.Group,{gap:"md",h:128,align:"center",wrap:"nowrap",children:[t.map((p,u)=>w.jsxs(z.Box,{pos:"relative",style:{flexShrink:0},onMouseEnter:()=>d(u),onMouseLeave:()=>d(null),children:[w.jsxs(z.Badge,{size:"xs",color:e===u?"devdive":"gray",pos:"absolute",top:-8,left:8,style:{zIndex:10},children:["#",u+1]}),c===u&&t.length>1&&w.jsx(z.ActionIcon,{variant:"filled",color:"red",size:"xs",radius:"xl",pos:"absolute",top:-6,right:-6,style:{zIndex:20},onClick:A=>h(A,u),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:12},children:"close"})}),w.jsx(z.UnstyledButton,{onClick:()=>n(u),style:{borderRadius:"var(--mantine-radius-lg)",overflow:"hidden",border:e===u?"2px solid var(--devdive-primary)":"1px solid var(--devdive-border-light)",boxShadow:e===u?"0 0 0 4px rgba(91, 110, 247, 0.1), 0 4px 6px rgba(0, 0, 0, 0.1)":void 0,transition:"all 150ms ease"},children:w.jsx(Y9,{slide:p})})]},p.id)),w.jsx(z.ActionIcon,{variant:"outline",color:"gray",size:Ig,w:oA,radius:"lg",onClick:s,style:{flexShrink:0,borderStyle:"dashed",borderWidth:2},children:w.jsxs(z.Box,{ta:"center",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:20},children:"add"}),w.jsx(z.Box,{fz:9,fw:700,tt:"uppercase",lts:"0.05em",children:"Add"})]})})]})})})},m5=()=>{const[t,e]=oe.useState(!1),n=Ve(R=>R.slides),s=Ve(R=>R.currentSlideIndex),i=Ve(R=>R.selectedElementId),c=Ve(R=>R.updateElement),d=Ve(R=>R.updateSlideBackground),h=Ve(R=>R.bringToFront),p=Ve(R=>R.sendToBack),u=Ve(R=>R.bringForward),A=Ve(R=>R.sendBackward),y=Ve(R=>R.copyElement),x=Ve(R=>R.commitElementUpdate),S=n[s],C=i?S.elements.find(R=>R.id===i):null;if(t)return w.jsx(z.Box,{w:40,bg:"white",py:"md",style:{borderLeft:"1px solid var(--devdive-border-light)"},children:w.jsx(z.Stack,{align:"center",children:w.jsx(z.Tooltip,{label:"속성 패널 펼치기",position:"left",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",onClick:()=>e(!1),children:w.jsx("span",{className:"material-symbols-outlined",children:"chevron_left"})})})})});if(!C)return w.jsxs(z.Box,{w:256,p:"md",bg:"white",style:{borderLeft:"1px solid var(--devdive-border-light)",overflowY:"auto"},children:[w.jsxs(z.Group,{justify:"space-between",mb:"md",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{color:"var(--devdive-primary)",fontSize:18},children:"palette"}),w.jsx(z.Text,{size:"sm",fw:700,children:"슬라이드 설정"})]}),w.jsx(z.Tooltip,{label:"패널 접기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>e(!0),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"chevron_right"})})})]}),w.jsx(_f,{color:S.background,onChange:R=>d(R),label:"배경 색상"}),w.jsxs(z.Box,{mt:"xl",pt:"md",ta:"center",c:"dimmed",style:{borderTop:"1px solid var(--devdive-border-light)"},children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:32,marginBottom:4},children:"touch_app"}),w.jsxs(z.Text,{size:"xs",children:["요소를 선택하면",w.jsx("br",{}),"속성을 편집할 수 있습니다"]}),w.jsxs(z.Text,{size:"xs",c:"dimmed",mt:"sm",children:["하단 입력창에서 AI로",w.jsx("br",{}),"슬라이드 내용을 수정하세요"]})]})]});const T=R=>{c(i,R)};return w.jsxs(z.Box,{w:256,p:"md",bg:"white",style:{borderLeft:"1px solid var(--devdive-border-light)",overflowY:"auto"},children:[w.jsxs(z.Group,{justify:"space-between",mb:"md",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{color:"var(--devdive-primary)",fontSize:18},children:"tune"}),w.jsx(z.Text,{size:"sm",fw:700,children:"속성"})]}),w.jsx(z.Tooltip,{label:"패널 접기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>e(!0),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"chevron_right"})})})]}),w.jsxs(z.Box,{mb:"md",pb:"md",style:{borderBottom:"1px solid var(--devdive-border-light)"},children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"레이어 순서"}),w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Tooltip,{label:"맨 뒤로 (Ctrl+[)",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:p,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"vertical_align_bottom"})})}),w.jsx(z.Tooltip,{label:"한 단계 뒤로",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:A,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"arrow_downward"})})}),w.jsx(z.Tooltip,{label:"한 단계 앞으로",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:u,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"arrow_upward"})})}),w.jsx(z.Tooltip,{label:"맨 앞으로 (Ctrl+])",children:w.jsx(z.ActionIcon,{variant:"light",color:"gray",onClick:h,flex:1,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"vertical_align_top"})})})]}),w.jsx(z.Button,{variant:"light",color:"gray",size:"xs",fullWidth:!0,mt:"xs",leftSection:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"content_copy"}),onClick:y,children:"복사"})]}),w.jsx(V9,{element:C,onUpdate:T,onStartEdit:x}),C.type==="text"&&w.jsx(q9,{element:C,onUpdate:T,onStartEdit:x}),C.type==="shape"&&w.jsx(K9,{element:C,onUpdate:T,onStartEdit:x}),C.type==="image"&&w.jsx(J9,{element:C,onUpdate:T,onStartEdit:x})]})},V9=({element:t,onUpdate:e,onStartEdit:n})=>{const[s,i]=oe.useState(Math.round(t.width)),[c,d]=oe.useState(Math.round(t.height)),[h,p]=oe.useState(!0),u=t.width/t.height;oe.useEffect(()=>{i(Math.round(t.width)),d(Math.round(t.height))},[t.width,t.height]);const A=x=>{const S=Number(x);if(i(S),h){const C=Math.round(S/u);d(C),e({width:S,height:C})}else e({width:S})},y=x=>{const S=Number(x);if(d(S),h){const C=Math.round(S*u);i(C),e({width:C,height:S})}else e({height:S})};return w.jsxs(z.Box,{mb:"md",pb:"md",style:{borderBottom:"1px solid var(--devdive-border-light)"},children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"크기"}),w.jsxs(z.Group,{gap:"xs",align:"flex-end",children:[w.jsxs(z.Box,{flex:1,children:[w.jsx(z.Text,{size:"xs",c:"dimmed",mb:2,children:"너비"}),w.jsx(z.NumberInput,{value:s,onFocus:n,onChange:A,size:"xs",min:10})]}),w.jsx(z.Tooltip,{label:h?"비율 잠금 해제":"비율 잠금",children:w.jsx(z.ActionIcon,{variant:h?"light":"subtle",color:h?"devdive":"gray",onClick:()=>p(!h),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:h?"link":"link_off"})})}),w.jsxs(z.Box,{flex:1,children:[w.jsx(z.Text,{size:"xs",c:"dimmed",mb:2,children:"높이"}),w.jsx(z.NumberInput,{value:c,onFocus:n,onChange:y,size:"xs",min:10})]})]})]})},_f=({color:t,onChange:e,label:n,onStartEdit:s})=>{const[i,c]=oe.useState(!1),[d,h]=oe.useState(t);oe.useEffect(()=>{h(t)},[t]);const p=["#5B6EF7","#ef4444","#f97316","#eab308","#22c55e","#06b6d4","#8b5cf6","#ec4899","#1e293b","#64748b","#e2e8f0","#ffffff"];return w.jsxs(z.Box,{mb:"sm",children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:n}),w.jsxs(z.Group,{gap:"xs",children:[w.jsxs(z.Popover,{opened:i,onChange:c,position:"bottom-start",radius:"lg",shadow:"xl",children:[w.jsx(z.Popover.Target,{children:w.jsx(z.ActionIcon,{variant:"outline",size:"lg",onClick:()=>{i||s==null||s(),c(!i)},style:{backgroundColor:d,borderColor:"var(--devdive-border-light)"}})}),w.jsx(z.Popover.Dropdown,{p:"sm",children:w.jsxs(z.Stack,{gap:"sm",children:[w.jsx(bx,{color:d,onChange:u=>{h(u),e(u)}}),w.jsx(z.Box,{pt:"sm",style:{borderTop:"1px solid var(--devdive-border-light)"},children:w.jsx(z.SimpleGrid,{cols:4,spacing:6,children:p.map(u=>w.jsx(z.ActionIcon,{size:"sm",variant:"outline",onClick:()=>{h(u),e(u)},style:{backgroundColor:u,borderColor:"var(--devdive-border-light)"}},u))})})]})})]}),w.jsx(z.NumberInput,{value:d,onChange:u=>{const A=String(u);h(A),/^#[0-9A-Fa-f]{6}$/.test(A)&&e(A)},hideControls:!0,size:"xs",flex:1,styles:{input:{fontFamily:"monospace"}}})]})]})},q9=({element:t,onUpdate:e,onStartEdit:n})=>w.jsxs(z.Stack,{gap:"md",children:[w.jsx(_f,{color:t.fill,onChange:s=>e({fill:s}),label:"텍스트 색상",onStartEdit:n}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"폰트 크기"}),w.jsx(z.NumberInput,{value:t.fontSize,onFocus:n,onChange:s=>e({fontSize:Number(s)}),size:"xs",min:8,max:200})]}),w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"정렬"}),w.jsx(z.SegmentedControl,{value:t.align,onChange:s=>{n(),e({align:s})},fullWidth:!0,size:"xs",data:[{value:"left",label:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"format_align_left"})},{value:"center",label:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"format_align_center"})},{value:"right",label:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16},children:"format_align_right"})}]})]})]}),K9=({element:t,onUpdate:e,onStartEdit:n})=>{const s=t.shapeType!=="line"&&t.shapeType!=="arrow";return w.jsxs(z.Stack,{gap:"md",children:[w.jsx(_f,{color:t.fill,onChange:i=>e({fill:i}),label:"채우기 색상",onStartEdit:n}),w.jsx(_f,{color:t.stroke,onChange:i=>e({stroke:i}),label:"외곽선 색상",onStartEdit:n}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["외곽선 두께: ",t.strokeWidth,"px"]}),w.jsx(z.Slider,{value:t.strokeWidth,onChange:i=>e({strokeWidth:i}),onChangeEnd:n,min:0,max:20,color:"devdive",size:"sm"})]}),t.shapeType==="rect"&&w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["모서리 곡률: ",t.cornerRadius||0,"px"]}),w.jsx(z.Slider,{value:t.cornerRadius||0,onChange:i=>e({cornerRadius:i}),onChangeEnd:n,min:0,max:Math.min(t.width,t.height)/2,color:"devdive",size:"sm"}),w.jsx(z.Group,{gap:4,mt:"xs",children:[0,8,16,24,999].map(i=>w.jsx(z.Button,{variant:(t.cornerRadius||0)===i?"filled":"light",color:(t.cornerRadius||0)===i?"devdive":"gray",size:"xs",flex:1,px:4,onClick:()=>{n(),e({cornerRadius:i===999?Math.min(t.width,t.height)/2:i})},children:i===999?"원형":i},i))})]}),s&&w.jsxs(z.Box,{pt:"md",style:{borderTop:"1px solid var(--devdive-border-light)"},children:[w.jsxs(z.Group,{gap:"xs",mb:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"text_fields"}),w.jsx(z.Text,{size:"xs",fw:600,children:"도형 텍스트"})]}),w.jsx(z.Text,{size:"xs",c:"dimmed",mb:"sm",children:"더블클릭으로 텍스트 편집"}),w.jsx(_f,{color:t.textColor||"#1e293b",onChange:i=>e({textColor:i}),label:"텍스트 색상",onStartEdit:n}),w.jsxs(z.Box,{mb:"sm",children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"텍스트 크기"}),w.jsx(z.NumberInput,{value:t.textSize||16,onFocus:n,onChange:i=>e({textSize:Number(i)}),size:"xs",min:8,max:72})]}),t.text&&w.jsxs(z.Box,{p:"xs",bg:"gray.0",style:{borderRadius:"var(--mantine-radius-md)"},children:[w.jsx(z.Text,{size:"xs",c:"dimmed",mb:2,children:"현재 텍스트"}),w.jsx(z.Text,{size:"sm",truncate:!0,children:t.text})]})]})]})},J9=({element:t,onUpdate:e,onStartEdit:n})=>{const[s,i]=oe.useState(100),c=t.width,d=t.height,h=p=>{i(p);const u=p/100;e({width:Math.round(c*u),height:Math.round(d*u)})};return w.jsxs(z.Stack,{gap:"md",children:[w.jsxs(z.Box,{children:[w.jsx(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:"미리보기"}),w.jsx(z.Box,{h:96,bg:"gray.1",style:{borderRadius:"var(--mantine-radius-md)",border:"1px solid var(--devdive-border-light)",overflow:"hidden"},children:w.jsx("img",{src:t.src,alt:"preview",style:{width:"100%",height:"100%",objectFit:"contain"}})})]}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["크기 비율: ",s,"%"]}),w.jsx(z.Slider,{value:s,onChange:h,onChangeEnd:n,min:10,max:200,color:"devdive",size:"sm"}),w.jsx(z.Group,{gap:4,mt:"xs",children:[50,75,100,125,150].map(p=>w.jsxs(z.Button,{variant:s===p?"filled":"light",color:s===p?"devdive":"gray",size:"xs",flex:1,px:4,onClick:()=>{n(),h(p)},children:[p,"%"]},p))})]}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["모서리 곡률: ",t.cornerRadius||0,"px"]}),w.jsx(z.Slider,{value:t.cornerRadius||0,onChange:p=>e({cornerRadius:p}),onChangeEnd:n,min:0,max:Math.min(t.width,t.height)/2,color:"devdive",size:"sm"}),w.jsx(z.Group,{gap:4,mt:"xs",children:[0,8,16,24,999].map(p=>w.jsx(z.Button,{variant:(t.cornerRadius||0)===p?"filled":"light",color:(t.cornerRadius||0)===p?"devdive":"gray",size:"xs",flex:1,px:4,onClick:()=>{n(),e({cornerRadius:p===999?Math.min(t.width,t.height)/2:p})},children:p===999?"원형":p},p))})]}),w.jsxs(z.Box,{children:[w.jsxs(z.Text,{size:"xs",fw:500,c:"dimmed",mb:"xs",children:["회전: ",Math.round(t.rotation||0),"°"]}),w.jsx(z.Slider,{value:t.rotation||0,onChange:p=>e({rotation:p}),onChangeEnd:n,min:0,max:360,color:"devdive",size:"sm"})]})]})},Z9=()=>{const[t,e]=oe.useState(!1),[n,s]=oe.useState([]),[i,c]=oe.useState(""),[d,h]=oe.useState(!1),[p,u]=oe.useState([]),[A,y]=oe.useState(-1),[x,S]=oe.useState({x:0,y:0}),[C,T]=oe.useState(!1),R=oe.useRef({x:0,y:0,posX:0,posY:0}),D=oe.useRef(null),M=oe.useRef(null),P=oe.useRef(null),{generateSlideContent:O}=uA(),I=Ve(J=>J.slides),Y=Ve(J=>J.currentSlideIndex),K=Ve(J=>J.updateElement),q=I[Y];oe.useEffect(()=>{D.current&&t&&D.current.scrollTo({top:D.current.scrollHeight,behavior:"smooth"})},[n,t]),oe.useEffect(()=>{if(q){const J={id:`snapshot-initial-${Y}`,timestamp:new Date,elements:JSON.parse(JSON.stringify(q.elements)),messageId:"initial"};u([J]),y(0),s([]),e(!1)}},[Y]);const Q=oe.useCallback(()=>{setTimeout(()=>{var re;const J=(re=Ve.getState().slides[Y])==null?void 0:re.elements;if(!J)return;const ae={id:`snapshot-after-${Date.now()}`,timestamp:new Date,elements:JSON.parse(JSON.stringify(J)),messageId:"after-change"};u(U=>[...U.slice(0,A+1),ae]),y(U=>U+1)},50)},[Y,A]),V=oe.useCallback(()=>{if(A<=0)return;const J=A-1,ae=p[J];if(!ae)return;ae.elements.forEach(U=>{K(U.id,{...U})}),y(J);const re={id:`undo-${Date.now()}`,role:"assistant",content:"이전 상태로 되돌렸습니다.",timestamp:new Date};s(U=>[...U,re])},[A,p,K]),ge=oe.useCallback(()=>{if(A>=p.length-1)return;const J=A+1,ae=p[J];if(!ae)return;ae.elements.forEach(U=>{K(U.id,{...U})}),y(J);const re={id:`redo-${Date.now()}`,role:"assistant",content:"변경사항을 다시 적용했습니다.",timestamp:new Date};s(U=>[...U,re])},[A,p,K]),X=async()=>{var ae;if(!i.trim()||d)return;t||e(!0);const J={id:`user-${Date.now()}`,role:"user",content:i.trim(),timestamp:new Date};s(re=>[...re,J]),c(""),h(!0);try{const re=q.elements.filter(ot=>ot.type==="text"),U=await O({topic:i.trim(),slideIndex:Y,totalSlides:I.length,layout:"content",purpose:i.trim(),style:"사용자 요청에 맞게 수정",language:"ko"}),ee=`assistant-${Date.now()}`;let Ee=!1;const Te=[];if(U.title&&re.length>0){const ot=re.find(lt=>lt.textStyle==="title");ot&&(K(ot.id,{content:U.title}),Te.push(`제목: "${U.title}"`),Ee=!0)}if(U.subtitle){const ot=re.find(lt=>lt.textStyle==="subtitle");ot&&(K(ot.id,{content:U.subtitle}),Te.push(`부제목: "${U.subtitle}"`),Ee=!0)}if(U.bulletPoints&&U.bulletPoints.length>0){const ot=re.filter(lt=>lt.textStyle==="body");U.bulletPoints.forEach((lt,pt)=>{ot[pt]&&(K(ot[pt].id,{content:lt}),Ee=!0)}),U.bulletPoints.length>0&&Te.push(`불릿포인트 ${U.bulletPoints.length}개 수정`)}Ee&&Q();const Ne=Ee?`수정 완료!
462
462
  ${Te.join(`
463
- `)}`:"적용할 텍스트 요소를 찾지 못했습니다.",Ue={id:ee,role:"assistant",content:Ne,timestamp:new Date};s(ot=>[...ot,Ue])}catch(re){console.error("AI 편집 실패:",re);const U={id:`error-${Date.now()}`,role:"assistant",content:"오류가 발생했습니다. 다시 시도해주세요.",timestamp:new Date};s(ee=>[...ee,U])}finally{h(!1),(ae=M.current)==null||ae.focus()}},se=J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),X())},L=oe.useCallback(J=>{J.preventDefault(),T(!0),R.current={x:J.clientX,y:J.clientY,posX:x.x,posY:x.y}},[x]);oe.useEffect(()=>{if(!C)return;const J=re=>{const U=re.clientX-R.current.x,ee=re.clientY-R.current.y;S({x:R.current.posX+U,y:R.current.posY-ee})},ae=()=>{T(!1)};return document.addEventListener("mousemove",J),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",ae)}},[C]);const ne=oe.useCallback(()=>{S({x:0,y:0})},[]),le=A>0,pe=A<p.length-1;return w.jsxs(z.Box,{ref:P,pos:"absolute",bottom:140+x.y,left:"50%",style:{transform:`translateX(calc(-50% + ${x.x}px))`,zIndex:100,width:"100%",maxWidth:600,pointerEvents:"none",transition:C?"none":"bottom 0.1s, transform 0.1s"},children:[w.jsx(z.Collapse,{in:t&&n.length>0,children:w.jsxs(z.Paper,{shadow:"xl",radius:"lg",mb:"xs",style:{pointerEvents:"auto",maxHeight:300,overflow:"hidden",border:"1px solid var(--devdive-border-light)"},children:[w.jsx(z.Box,{px:"sm",py:"xs",bg:"gray.0",style:{borderBottom:"1px solid var(--devdive-border-light)"},children:w.jsxs(z.Group,{justify:"space-between",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--devdive-primary)"},children:"auto_awesome"}),w.jsx(z.Text,{size:"xs",fw:600,children:"AI 편집 히스토리"})]}),w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Tooltip,{label:"되돌리기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xs",disabled:!le,onClick:V,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"undo"})})}),w.jsx(z.Tooltip,{label:"다시실행",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xs",disabled:!pe,onClick:ge,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"redo"})})}),w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xs",onClick:()=>e(!1),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"expand_more"})})]})]})}),w.jsx(z.ScrollArea,{h:200,px:"sm",py:"xs",viewportRef:D,children:w.jsxs(z.Stack,{gap:"xs",children:[n.map(J=>w.jsx(Z9,{message:J},J.id)),d&&w.jsx(z.Box,{children:w.jsx(z.Paper,{px:"xs",py:4,radius:"md",bg:"gray.1",style:{display:"inline-block"},children:w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14,color:"var(--devdive-primary)",animation:"spin 1s linear infinite"},children:"progress_activity"}),w.jsx(z.Text,{size:"xs",c:"dimmed",children:"생성 중..."})]})})})]})})]})}),w.jsx(z.Paper,{shadow:"xl",radius:"xl",px:"md",py:"xs",style:{pointerEvents:"auto",border:"1px solid var(--devdive-border-light)"},children:w.jsxs(z.Group,{gap:"sm",children:[w.jsx(z.Tooltip,{label:"드래그하여 이동 (더블클릭: 초기화)",children:w.jsx(z.Box,{onMouseDown:L,onDoubleClick:ne,style:{cursor:C?"grabbing":"grab",display:"flex",alignItems:"center",padding:"4px 0",flexShrink:0},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18,color:"var(--mantine-color-gray-5)"},children:"drag_indicator"})})}),w.jsx(z.Box,{w:32,h:32,bg:"linear-gradient(135deg, #5B6EF7 0%, #3b82f6 100%)",style:{borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18,color:"white"},children:"auto_awesome"})}),w.jsx(z.TextInput,{ref:M,flex:1,placeholder:"슬라이드 내용을 어떻게 수정할까요? (예: 제목을 더 간결하게)",value:i,onChange:J=>c(J.currentTarget.value),onKeyDown:se,disabled:d,variant:"unstyled",size:"sm",styles:{input:{fontSize:14}}}),n.length>0&&w.jsx(z.Tooltip,{label:t?"채팅 접기":"채팅 보기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>e(!t),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:t?"expand_more":"expand_less"})})}),w.jsx(z.ActionIcon,{variant:"filled",color:"devdive",size:"lg",radius:"xl",disabled:!i.trim()||d,onClick:X,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"send"})})]})}),w.jsx("style",{children:`
463
+ `)}`:"적용할 텍스트 요소를 찾지 못했습니다.",Ue={id:ee,role:"assistant",content:Ne,timestamp:new Date};s(ot=>[...ot,Ue])}catch(re){console.error("AI 편집 실패:",re);const U={id:`error-${Date.now()}`,role:"assistant",content:"오류가 발생했습니다. 다시 시도해주세요.",timestamp:new Date};s(ee=>[...ee,U])}finally{h(!1),(ae=M.current)==null||ae.focus()}},se=J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),X())},L=oe.useCallback(J=>{J.preventDefault(),T(!0),R.current={x:J.clientX,y:J.clientY,posX:x.x,posY:x.y}},[x]);oe.useEffect(()=>{if(!C)return;const J=re=>{const U=re.clientX-R.current.x,ee=re.clientY-R.current.y;S({x:R.current.posX+U,y:R.current.posY-ee})},ae=()=>{T(!1)};return document.addEventListener("mousemove",J),document.addEventListener("mouseup",ae),()=>{document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",ae)}},[C]);const ne=oe.useCallback(()=>{S({x:0,y:0})},[]),le=A>0,pe=A<p.length-1;return w.jsxs(z.Box,{ref:P,pos:"absolute",bottom:140+x.y,left:"50%",style:{transform:`translateX(calc(-50% + ${x.x}px))`,zIndex:100,width:"100%",maxWidth:600,pointerEvents:"none",transition:C?"none":"bottom 0.1s, transform 0.1s"},children:[w.jsx(z.Collapse,{in:t&&n.length>0,children:w.jsxs(z.Paper,{shadow:"xl",radius:"lg",mb:"xs",style:{pointerEvents:"auto",maxHeight:300,overflow:"hidden",border:"1px solid var(--devdive-border-light)"},children:[w.jsx(z.Box,{px:"sm",py:"xs",bg:"gray.0",style:{borderBottom:"1px solid var(--devdive-border-light)"},children:w.jsxs(z.Group,{justify:"space-between",children:[w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--devdive-primary)"},children:"auto_awesome"}),w.jsx(z.Text,{size:"xs",fw:600,children:"AI 편집 히스토리"})]}),w.jsxs(z.Group,{gap:4,children:[w.jsx(z.Tooltip,{label:"되돌리기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xs",disabled:!le,onClick:V,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"undo"})})}),w.jsx(z.Tooltip,{label:"다시실행",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xs",disabled:!pe,onClick:ge,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"redo"})})}),w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xs",onClick:()=>e(!1),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14},children:"expand_more"})})]})]})}),w.jsx(z.ScrollArea,{h:200,px:"sm",py:"xs",viewportRef:D,children:w.jsxs(z.Stack,{gap:"xs",children:[n.map(J=>w.jsx($9,{message:J},J.id)),d&&w.jsx(z.Box,{children:w.jsx(z.Paper,{px:"xs",py:4,radius:"md",bg:"gray.1",style:{display:"inline-block"},children:w.jsxs(z.Group,{gap:"xs",children:[w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:14,color:"var(--devdive-primary)",animation:"spin 1s linear infinite"},children:"progress_activity"}),w.jsx(z.Text,{size:"xs",c:"dimmed",children:"생성 중..."})]})})})]})})]})}),w.jsx(z.Paper,{shadow:"xl",radius:"xl",px:"md",py:"xs",style:{pointerEvents:"auto",border:"1px solid var(--devdive-border-light)"},children:w.jsxs(z.Group,{gap:"sm",children:[w.jsx(z.Tooltip,{label:"드래그하여 이동 (더블클릭: 초기화)",children:w.jsx(z.Box,{onMouseDown:L,onDoubleClick:ne,style:{cursor:C?"grabbing":"grab",display:"flex",alignItems:"center",padding:"4px 0",flexShrink:0},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18,color:"var(--mantine-color-gray-5)"},children:"drag_indicator"})})}),w.jsx(z.Box,{w:32,h:32,bg:"linear-gradient(135deg, #5B6EF7 0%, #3b82f6 100%)",style:{borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18,color:"white"},children:"auto_awesome"})}),w.jsx(z.TextInput,{ref:M,flex:1,placeholder:"슬라이드 내용을 어떻게 수정할까요? (예: 제목을 더 간결하게)",value:i,onChange:J=>c(J.currentTarget.value),onKeyDown:se,disabled:d,variant:"unstyled",size:"sm",styles:{input:{fontSize:14}}}),n.length>0&&w.jsx(z.Tooltip,{label:t?"채팅 접기":"채팅 보기",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"sm",onClick:()=>e(!t),children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:t?"expand_more":"expand_less"})})}),w.jsx(z.ActionIcon,{variant:"filled",color:"devdive",size:"lg",radius:"xl",disabled:!i.trim()||d,onClick:X,children:w.jsx("span",{className:"material-symbols-outlined",style:{fontSize:18},children:"send"})})]})}),w.jsx("style",{children:`
464
464
  @keyframes spin {
465
465
  from { transform: rotate(0deg); }
466
466
  to { transform: rotate(360deg); }
467
467
  }
468
- `})]})},Z9=({message:t})=>{const e=t.role==="user";return w.jsx(z.Box,{style:{textAlign:e?"right":"left"},children:w.jsx(z.Paper,{px:"xs",py:4,radius:"md",bg:e?"var(--devdive-primary)":"gray.1",c:e?"white":"inherit",style:{maxWidth:"85%",display:"inline-block"},children:w.jsx(z.Text,{size:"xs",style:{whiteSpace:"pre-wrap",lineHeight:1.4},children:t.content})})})},$9=()=>{const t=Ve(p=>p.copyElement),e=Ve(p=>p.pasteElement),n=Ve(p=>p.deleteElement),s=Ve(p=>p.selectedElementId),i=Ve(p=>p.bringToFront),c=Ve(p=>p.sendToBack),d=Ve(p=>p.undo),h=Ve(p=>p.redo);oe.useEffect(()=>{const p=u=>{const A=u.target;if(A.tagName==="INPUT"||A.tagName==="TEXTAREA")return;const y=u.ctrlKey||u.metaKey;y&&u.key==="c"&&(u.preventDefault(),t()),y&&u.key==="v"&&(u.preventDefault(),e()),(u.key==="Delete"||u.key==="Backspace")&&s&&(u.preventDefault(),n(s)),y&&u.key==="]"&&(u.preventDefault(),i()),y&&u.key==="["&&(u.preventDefault(),c()),y&&u.key==="z"&&!u.shiftKey&&(u.preventDefault(),d()),(y&&u.key==="z"&&u.shiftKey||y&&u.key==="y")&&(u.preventDefault(),h())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[t,e,n,s,i,c,d,h])},e7=()=>($9(),w.jsxs(z.Flex,{direction:"column",h:"100%",c:"slate.8",children:[w.jsx(mx,{}),w.jsxs(z.Flex,{flex:1,style:{overflow:"hidden"},children:[w.jsxs(z.Box,{component:"main",flex:1,pos:"relative",className:"dot-grid",style:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[w.jsx(Sx,{}),w.jsx(z.Box,{flex:1,style:{overflow:"hidden"},children:w.jsx(p5,{})}),w.jsx(J9,{})]}),w.jsx(m5,{})]}),w.jsx(A5,{})]})),J2={position:"fixed",top:"50%",transform:"translateY(-50%)",zIndex:30,width:48,height:48,borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.8)",backdropFilter:"blur(12px)",border:"1px solid var(--devdive-border-light)",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.1)"},t7=()=>{const t=Ve(h=>h.slides),e=Ve(h=>h.currentSlideIndex),n=Ve(h=>h.selectSlide),s=e>0,i=e<t.length-1,c=()=>{s&&n(e-1)},d=()=>{i&&n(e+1)};return w.jsxs(w.Fragment,{children:[w.jsx(z.Tooltip,{label:"이전 슬라이드",position:"right",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xl",onClick:c,disabled:!s,style:{...J2,left:24},children:w.jsx("span",{className:"material-symbols-outlined",children:"chevron_left"})})}),w.jsx(z.Tooltip,{label:"다음 슬라이드",position:"left",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xl",onClick:d,disabled:!i,style:{...J2,right:24},children:w.jsx("span",{className:"material-symbols-outlined",children:"chevron_right"})})})]})};exports.Editor=e7;exports.FloatingToolbar=Sx;exports.Header=mx;exports.ImageNode=h5;exports.LAYOUT_TEMPLATES=Og;exports.PropertiesPanel=m5;exports.ShapeNode=f5;exports.SlideCanvas=p5;exports.SlideNavigation=t7;exports.SlideThumbnails=A5;exports.TEXT_STYLE_PRESETS=Eu;exports.THEME_PRESETS=fs;exports.TemplateGallery=px;exports.TextNode=d5;exports.calculateSnap=u5;exports.devdiveTheme=eS;exports.generateId=fi;exports.generatePptx=hx;exports.getLayoutTemplate=hg;exports.themeVars=tS;exports.useEditorStore=Ve;
468
+ `})]})},$9=({message:t})=>{const e=t.role==="user";return w.jsx(z.Box,{style:{textAlign:e?"right":"left"},children:w.jsx(z.Paper,{px:"xs",py:4,radius:"md",bg:e?"var(--devdive-primary)":"gray.1",c:e?"white":"inherit",style:{maxWidth:"85%",display:"inline-block"},children:w.jsx(z.Text,{size:"xs",style:{whiteSpace:"pre-wrap",lineHeight:1.4},children:t.content})})})},e7=()=>{const t=Ve(p=>p.copyElement),e=Ve(p=>p.pasteElement),n=Ve(p=>p.deleteElement),s=Ve(p=>p.selectedElementId),i=Ve(p=>p.bringToFront),c=Ve(p=>p.sendToBack),d=Ve(p=>p.undo),h=Ve(p=>p.redo);oe.useEffect(()=>{const p=u=>{const A=u.target;if(A.tagName==="INPUT"||A.tagName==="TEXTAREA")return;const y=u.ctrlKey||u.metaKey;y&&u.key==="c"&&(u.preventDefault(),t()),y&&u.key==="v"&&(u.preventDefault(),e()),(u.key==="Delete"||u.key==="Backspace")&&s&&(u.preventDefault(),n(s)),y&&u.key==="]"&&(u.preventDefault(),i()),y&&u.key==="["&&(u.preventDefault(),c()),y&&u.key==="z"&&!u.shiftKey&&(u.preventDefault(),d()),(y&&u.key==="z"&&u.shiftKey||y&&u.key==="y")&&(u.preventDefault(),h())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[t,e,n,s,i,c,d,h])},t7=()=>(e7(),w.jsxs(z.Flex,{direction:"column",h:"100%",c:"slate.8",children:[w.jsx(mx,{}),w.jsxs(z.Flex,{flex:1,style:{overflow:"hidden"},children:[w.jsxs(z.Box,{component:"main",flex:1,pos:"relative",className:"dot-grid",style:{display:"flex",flexDirection:"column",overflow:"hidden"},children:[w.jsx(Sx,{}),w.jsx(z.Box,{flex:1,style:{overflow:"hidden"},children:w.jsx(p5,{})}),w.jsx(Z9,{})]}),w.jsx(m5,{})]}),w.jsx(A5,{})]})),J2={position:"fixed",top:"50%",transform:"translateY(-50%)",zIndex:30,width:48,height:48,borderRadius:"50%",backgroundColor:"rgba(255, 255, 255, 0.8)",backdropFilter:"blur(12px)",border:"1px solid var(--devdive-border-light)",boxShadow:"0 10px 25px rgba(0, 0, 0, 0.1)"},n7=()=>{const t=Ve(h=>h.slides),e=Ve(h=>h.currentSlideIndex),n=Ve(h=>h.selectSlide),s=e>0,i=e<t.length-1,c=()=>{s&&n(e-1)},d=()=>{i&&n(e+1)};return w.jsxs(w.Fragment,{children:[w.jsx(z.Tooltip,{label:"이전 슬라이드",position:"right",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xl",onClick:c,disabled:!s,style:{...J2,left:24},children:w.jsx("span",{className:"material-symbols-outlined",children:"chevron_left"})})}),w.jsx(z.Tooltip,{label:"다음 슬라이드",position:"left",children:w.jsx(z.ActionIcon,{variant:"subtle",color:"gray",size:"xl",onClick:d,disabled:!i,style:{...J2,right:24},children:w.jsx("span",{className:"material-symbols-outlined",children:"chevron_right"})})})]})};exports.Editor=t7;exports.FloatingToolbar=Sx;exports.Header=mx;exports.ImageNode=h5;exports.LAYOUT_TEMPLATES=Og;exports.PropertiesPanel=m5;exports.ShapeNode=f5;exports.SlideCanvas=p5;exports.SlideNavigation=n7;exports.SlideThumbnails=A5;exports.TEXT_STYLE_PRESETS=Eu;exports.THEME_PRESETS=fs;exports.TemplateGallery=px;exports.TextNode=d5;exports.calculateSnap=u5;exports.devdiveTheme=eS;exports.generateId=fi;exports.generatePptx=hx;exports.getLayoutTemplate=hg;exports.themeVars=tS;exports.useEditorStore=Ve;
469
469
  //# sourceMappingURL=devdive-slide.cjs.js.map