polotno-node 2.11.3 → 2.11.4
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.
|
@@ -315,7 +315,7 @@ https://polotno.com/docs/server-api`;e.URLS={unsplashList:({query:y,page:b=1})=>
|
|
|
315
315
|
}`}));return E("style",{},ee.join(`
|
|
316
316
|
`))}catch(N){return console.error("Error embedding Google Font:",N),E("defs",{},E("style",{type:"text/css",innerHTML:`@import url('${z}');`.replace(/&/g,"&")}))}}}))}async function m({json:R,elementHook:B}){const X=await Promise.all(R.pages.map(q=>T({page:q,store:R,elementHook:B}))),Y=[];(0,e.forEveryChild)({children:R.pages},q=>{q.type==="text"&&Y.indexOf(q.fontFamily)===-1&&Y.push(q.fontFamily)});const Q=await I(Y,R.fonts);return E("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:`0 0 ${R.width} ${R.height}`,width:R.width,height:R.height},...Q,...X)}const A=(R,B)=>typeof B=="object"?`${R}="${Object.keys(B).map(X=>`${X}:${B[X]};`).join(" ")}"`:B==null||B===""?"":`${R}="${B}"`,L=({dom:R,nestLevel:B=0})=>{if(typeof R=="string")return R;if(!R)return"";const X=R.props,{innerHTML:Y}=X,Q=a(X,["innerHTML"]),q=" ".repeat(B);return`${q}<${R.type} ${Object.keys(Q).map(z=>A(z,Q[z])).join(" ")}>${Y||`
|
|
317
317
|
`+R.children.map(z=>L({dom:z,nestLevel:B+1})).join("")}${q}</${R.type}>
|
|
318
|
-
`};async function k({json:R,elementHook:B}){const X=await m({json:R,elementHook:B});return L({dom:X})}}(xo)),xo}var bg={},p3;function O_(){return p3||(p3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Page=void 0;const i=eo,t=Gp,n=Td(),a=zv(),l=Td(),s=Hd();e.Page=i.types.model("Page",{id:i.types.identifier,children:i.types.array(i.types.late(()=>n.ElementTypes)),width:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),height:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),background:"white",bleed:0,custom:i.types.frozen(),duration:5e3,_exporting:!1,_rendering:!1,_forceMount:!1}).postProcessSnapshot(c=>{const d=Object.assign({},c),w={};for(var _ in d)_[0]!=="_"&&(w[_]=c[_]);return w}).views(c=>({get store(){return(0,i.getParentOfType)(c,a.Store)}})).views(c=>({get startTime(){let d=0;for(const w of c.store.pages){if(w.id===c.id)return d;d+=w.duration}return d},get _exportingOrRendering(){return c._exporting||c._rendering}})).views(c=>({get computedWidth(){return c.width==="auto"?c.store.width:c.width},get computedHeight(){return c.height==="auto"?c.store.height:c.height}})).actions(c=>({toJSON:()=>JSON.parse(JSON.stringify((0,i.getSnapshot)(c))),_forEachElementUp(d,w){const _=d.map(E=>({id:E,index:c.children.findIndex(O=>O.id===E)}));_.sort((E,O)=>O.index-E.index);for(const{index:E}of _){if(E==-1)continue;const O=E<c.children.length-1&&c.children[E+1],v=d.indexOf(O==null?void 0:O.id)>=0;E===c.children.length-1||v||w(E)}},_forEachElementDown(d,w){const _=d.map(E=>({id:E,index:c.children.findIndex(O=>O.id===E)}));_.sort((E,O)=>E.index-O.index);for(const{index:E}of _){if(E==-1)continue;const O=E>0&&c.children[E-1],v=d.indexOf(O==null?void 0:O.id)>=0;E===0||v||w(E)}return!1}})).actions(c=>({clone(d={}){const w=c.toJSON();w.children.forEach(v=>{v.id=(0,t.nanoid)(10),(0,l.forEveryChild)(v,S=>{S.id=(0,t.nanoid)(10)})});const _=Object.assign(Object.assign(Object.assign({},w),{id:(0,t.nanoid)(10)}),d),E=c.store.addPage(_),O=c.store.pages.indexOf(c);E.setZIndex(O+1),E.select()},setZIndex(d){c.store.setPageZIndex(c.id,d)},set(d){Object.assign(c,d)},select(){c.store.selectPage(c.id)},addElement(d,{skipSelect:w=!1}={}){const _=l.TYPES_MAP[d.type];if(!_)return void console.error("Can not find model with type "+d.type);"children"in d&&Array.isArray(d.children)&&d.children.forEach(O=>{O.id=(0,t.nanoid)(10)});const E=_.create(Object.assign({id:(0,t.nanoid)(10)},d));return c.children.push(E),E.selectable&&!w&&c.store.selectElements([E.id]),E},canMoveElementsUp(d){let w=!1;return c._forEachElementUp(d,()=>{w=w||!0}),w},moveElementsUp(d){c._forEachElementUp(d,w=>{const _=c.children[w];(0,i.detach)(_),c.children.splice(w+1,0,_)})},canMoveElementsTop(d){return this.canMoveElementsUp(d)},moveElementsTop(d){const w=[],_=[];c.children.forEach(E=>{d.indexOf(E.id)>=0?w.push(E):_.push(E)}),c.children.replace(_.concat(w))},canMoveElementsDown(d){let w=!1;return c._forEachElementDown(d,()=>{w=w||!0}),w},moveElementsDown(d){c._forEachElementDown(d,w=>{const _=c.children[w];(0,i.detach)(_),c.children.splice(w-1,0,_)})},canMoveElementsBottom(d){return this.canMoveElementsDown(d)},moveElementsBottom(d){const w=[],_=[];c.children.forEach(E=>{d.indexOf(E.id)>=0?w.push(E):_.push(E)}),c.children.replace(w.concat(_))},setElementZIndex(d,w){const _=c.children.find(E=>E.id===d);_&&((0,i.detach)(_),c.children.remove(_),c.children.splice(w,0,_))},setSize({width:d,height:w,useMagic:_,softChange:E}){if(_){const O=[],v=k=>k.type==="image"&&k.x<1&&k.y<1&&k.width>=c.computedWidth-2&&k.height>=c.computedHeight-2;(0,l.forEveryChild)(c,k=>{k.type!=="group"&&(v(k)||O.push(k))});const S=O.length?(0,s.getTotalClientRect)(O):{x:0,y:0,width:c.computedWidth,height:c.computedHeight},p=1/4,h=Math.max(0,Math.min(S.x,c.computedWidth-S.x-S.width)),P=c.computedWidth*p,g=Math.max(0,h-P),y=Math.max(0,Math.min(S.y,c.computedHeight-S.y-S.height)),b=c.computedHeight*p,x=Math.max(0,y-b),M=c.computedWidth-2*g,T=c.computedHeight-2*x,j=d/M,I=w/T,m=Math.min(j,I),A=(d-M*m)/2-g*m,L=(w-T*m)/2-x*m;(0,l.forEveryChild)(c,k=>{k.type!=="group"&&(v(k)?k.set({x:k.x*m,y:k.y*m,width:k.width*j,height:k.height*I,cropX:0,cropY:0,cropWidth:1,cropHeight:1}):(k.set({x:A+k.x*m,y:L+k.y*m,width:k.width*m,height:k.height*m}),k.type==="text"?k.set({fontSize:k.fontSize*m}):k.type==="figure"&&k.set({strokeWidth:k.strokeWidth*m})))})}E||(c.width=d),E||(c.height=w)}})).actions(c=>({moveElementUp(d){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),c.moveElementsUp([d])},moveElementDown(d){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),c.moveElementsDown([d])},moveElementTop(d){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),c.moveElementsTop([d])},moveElementBottom(d){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),c.moveElementsBottom([d])},play(){c.store.play({startTime:c.startTime,endTime:c.startTime+c.duration})}}))}(bg)),bg}var _g={},g3;function qx(){return g3||(g3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Audio=void 0;const i=eo;e.Audio=i.types.model("Audio",{id:i.types.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0}).actions(t=>({toJSON:()=>Object.assign({},(0,i.getSnapshot)(t))})).actions(t=>({set(n){Object.assign(t,n)}}))}(_g)),_g}var v3;function zv(){return v3||(v3=1,function(e){var i=Ai&&Ai.__createBinding||(Object.create?function(I,m,A,L){L===void 0&&(L=A);var k=Object.getOwnPropertyDescriptor(m,A);k&&!("get"in k?!m.__esModule:k.writable||k.configurable)||(k={enumerable:!0,get:function(){return m[A]}}),Object.defineProperty(I,L,k)}:function(I,m,A,L){L===void 0&&(L=A),I[L]=m[A]}),t=Ai&&Ai.__setModuleDefault||(Object.create?function(I,m){Object.defineProperty(I,"default",{enumerable:!0,value:m})}:function(I,m){I.default=m}),n=Ai&&Ai.__importStar||function(){var I=function(m){return I=Object.getOwnPropertyNames||function(A){var L=[];for(var k in A)Object.prototype.hasOwnProperty.call(A,k)&&(L[L.length]=k);return L},I(m)};return function(m){if(m&&m.__esModule)return m;var A={};if(m!=null)for(var L=I(m),k=0;k<L.length;k++)L[k]!=="default"&&i(A,m,L[k]);return t(A,m),A}}(),a=Ai&&Ai.__rest||function(I,m){var A={};for(var L in I)Object.prototype.hasOwnProperty.call(I,L)&&m.indexOf(L)<0&&(A[L]=I[L]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function"){var k=0;for(L=Object.getOwnPropertySymbols(I);k<L.length;k++)m.indexOf(L[k])<0&&Object.prototype.propertyIsEnumerable.call(I,L[k])&&(A[L[k]]=I[L[k]])}return A},l=Ai&&Ai.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(e,"__esModule",{value:!0}),e.Store=e.Font=void 0,e.createStore=j;const s=eo,c=Ix(),d=Gp,w=l(Ji()),_=Dx(),E=jx(),O=Fx(),v=jv(),S=n(Bd()),p=Ks(),h=Fv(),P=S_(),g=zx(),y=Bx(),b=Ux(),x=O_(),M=Td(),T=qx();function j({key:I,showCredit:m}={key:"",showCredit:!1}){return e.Store.create({_forceShowCredit:m,_key:I})}(0,s.setLivelinessChecking)("ignore"),e.Font=s.types.model("Font",{fontFamily:s.types.string,url:s.types.optional(s.types.string,""),styles:s.types.frozen()}).preProcessSnapshot(I=>Object.assign(Object.assign({},I),{fontFamily:I.fontFamily||I.name})),e.Store=s.types.model("Store",{role:"",pages:s.types.array(x.Page),fonts:s.types.array(e.Font),audios:s.types.array(T.Audio),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:"px",dpi:72,bleedVisible:!1,rulesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:s.types.frozen(),selectedElementsIds:s.types.array(s.types.string),animatedElementsIds:s.types.array(s.types.string),history:s.types.optional(c.UndoManager,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,window.devicePixelRatio||1),_activePageId:"",_forceShowCredit:!1,_key:"",_validated:!1}).views(I=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),I.bleedVisible},get selectedElements(){return I.selectedElementsIds.map(m=>{for(const A of I.pages)for(const L of A.children)if(L.id===m)return L}).filter(m=>!!m)},get children(){return I.pages},get selectedShapes(){const m=[];return(0,M.forEveryChild)({children:I.selectedElements},A=>{A.type!=="group"&&m.push(A)}),m},get activePage(){return I.pages.slice().find(m=>m.id===I._activePageId)||(I.pages.length?I.pages[0]:null)},get duration(){let m=0;return I.pages.forEach(A=>{m+=A.duration}),m},get _hasCroppedImages(){return I.find(m=>m.type==="image"&&m._cropModeEnabled)},find(m){let A;return(0,M.forEveryChild)({children:I.pages},L=>{if(!A&&m(L))return A=L,!0}),A},getElementById:m=>I.find(A=>A.id===m)})).actions(I=>{let m=0,A=null,L=!1;return{afterCreate(){I.history.canUndo},setCurrentTime(k){I.currentTime=k},_togglePlaying(k=!I.isPlaying){I.isPlaying=k},play({animatedElementsIds:k=[],startTime:R=0,currentTime:B=0,endTime:X=I.duration,repeat:Y=!1}={}){B&&(console.warn("currentTime property of store.play() is deprecated. Please use startTime instead."),R=B),I.animatedElementsIds=(0,s.cast)(k),I.currentTime=R,I.isPlaying=!0,m=Date.now(),A=X,L=Y,requestAnimationFrame(I.seek)},checkActivePage(){let k=0;for(const R of I.pages){if(I.currentTime>=R.startTime&&I.currentTime<R.startTime+R.duration){I.selectPage(R.id);break}k+=R.duration}},seek(){if(!I.isPlaying)return;const k=Date.now(),R=k-m;m=k,I.currentTime+=R,I.checkActivePage();const B=A||I.duration;I.isPlaying&&I.currentTime<B?requestAnimationFrame(I.seek):I.isPlaying&&L?(I.currentTime=0,requestAnimationFrame(I.seek)):I.stop()},stop(){I.isPlaying=!1,I.currentTime=0,I.animatedElementsIds=(0,s.cast)([]),I.checkActivePage()}}}).actions(I=>({__(){I._validated||((0,v.validateKey)(I._key,I._forceShowCredit),I._validated=!0)},set(m){Object.assign(I,m)},setUnit({unit:m,dpi:A}){I.unit=m||I.unit,I.dpi=A||I.dpi},setRole(m){I.role=m},addPage(m){const A=x.Page.create(Object.assign({id:(0,d.nanoid)(10)},m));return I.pages.push(A),I._activePageId=A.id,A},selectPage(m){I._activePageId=m},selectElements(m){const A=m.map(L=>I.getElementById(L)).sort((L,k)=>L.page.children.indexOf(L)-L.page.children.indexOf(k)).filter(L=>!!L).map(L=>L.id);I.selectedElementsIds=(0,s.cast)(A)},toggleBleed(m){I.bleedVisible=m??!I.bleedVisible},toggleRulers(m){I.rulesVisible=m??!I.rulesVisible},openSidePanel(m){I.openedSidePanel!==m&&(I.previousOpenedSidePanel=I.openedSidePanel,I.openedSidePanel=m)},setScale(m){I.scale=m},_setScaleToFit(m){I.scaleToFit=m},setElementsPixelRatio(m){I._elementsPixelRatio=m},setSize(m,A,L){I.pages.forEach(k=>{k.setSize({width:m,height:A,useMagic:L,softChange:!0})}),I.width=m,I.height=A},setPageZIndex(m,A){const L=I.pages.find(k=>k.id===m);L&&((0,s.detach)(L),I.pages.remove(L),I.pages.splice(A,0,L))},deletePages(m){const A=I.pages.indexOf(I.activePage);m.forEach(R=>{const B=I.pages.find(X=>X.id===R);(0,s.destroy)(B)});const L=Math.min(I.pages.length-1,A),k=I.pages[L];k&&(I._activePageId=k.id),I.selectedElementsIds=(0,s.cast)(I.selectedElementsIds.filter(R=>I.getElementById(R)))},groupElements(m){const A=m.map(R=>I.getElementById(R));A.forEach(R=>{R&&(0,s.detach)(R)});const L=I.activePage,k={id:(0,d.nanoid)(10),children:A,type:"group"};return L.children.push(k),I.selectedElementsIds=(0,s.cast)([k.id]),L.children.find(R=>R.id===k.id)},ungroupElements(m){const A=m.map(k=>I.getElementById(k)),L=[];A.forEach(k=>{if(k&&k.type==="group"){const R=k.page,B=R.children.indexOf(k);k.children.forEach(X=>{L.push(X.id)}),k.children.forEach(X=>{(0,s.detach)(X),R.children.push(X)}),R.children.splice(B,1)}}),I.selectedElementsIds=(0,s.cast)(L)},deleteElements(m){const A=[];I.find(L=>(m.includes(L.id)&&A.push(L),!1)),A.forEach(L=>{(0,s.destroy)(L)}),I.selectedElementsIds=(0,s.cast)(I.selectedElementsIds.filter(L=>I.getElementById(L)))},on(m,A){if(m==="change"){let L=I.toJSON();return(0,s.onSnapshot)(I,k=>{const R=I.toJSON();!(0,P.deepEqual)(L,R)&&(L=R,A(R))})}},async _toCanvas({pixelRatio:m,ignoreBackground:A,pageId:L,mimeType:k,includeBleed:R,_skipTimeout:B,quickMode:X=!1}={}){var Y;const Q=m||1;L=L||((Y=I.pages[0])===null||Y===void 0?void 0:Y.id);const q=I.pages.find(_e=>_e.id===L);if(!q)throw new Error(`No page for export with id ${L}`);X?q==null||q.set({_forceMount:!0}):q==null||q.set({_exporting:!0});const z=await(0,g.waitTillAvailable)(()=>w.default.stages.find(_e=>_e.getAttr("pageId")===L));if(!z)throw q==null||q.set({_forceMount:!1,_exporting:!1}),new Error(`Export is failed. Can not find stage for page ${L}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);const N=!!z.findOne(".page-container"),U=I._elementsPixelRatio;Q>I._elementsPixelRatio&&I.setElementsPixelRatio(Q),await I.waitLoading({_skipTimeout:B});const $=z.findOne(".page-container");if(!$)throw I.setElementsPixelRatio(U),q==null||q.set({_forceMount:!1,_exporting:!1}),new Error(`Export is failed. Can't find page container. ${N}`);z.find("Transformer").forEach(_e=>_e.visible(!1)),$.find(".page-background").forEach(_e=>_e.shadowEnabled(!1)),$.find(".page-background").forEach(_e=>_e.strokeEnabled(!1)),$.find(".highlighter").forEach(_e=>_e.visible(!1));const ee=$.findOne(".page-background-group"),G=ee.clip();ee.clip({x:null,y:null,width:null,height:null});const Z=$.findOne(".elements-container"),W=Z.clip();Z.clip({x:null,y:null,width:null,height:null});const te=$.find(_e=>_e.getAttr("hideInExport"));te.forEach(_e=>{_e.setAttr("oldVisible",_e.visible()),_e.hide()});const re=$.find(_e=>!_e.visible()&&_e.getAttr("editModeEnabled"));re.forEach(_e=>{_e.setAttr("oldVisible",_e.visible()),_e.show()}),A&&$.find(".page-background").forEach(_e=>_e.hide());const ie=R?q.bleed:0;let ae=ie;!I.bleedVisible&&R||(I.bleedVisible||R?I.bleedVisible&&R?ae=0:I.bleedVisible&&!R&&(ae=-q.bleed):ae=0);const se=document.createElement("canvas");se.width=Math.round((q.computedWidth+2*ie)*Q),se.height=Math.round((q.computedHeight+2*ie)*Q);const de=se.getContext("2d");k==="image/jpeg"&&(de.fillStyle="white",de.fillRect(0,0,se.width,se.height));const he=$.scale();$.scale({x:1,y:1});const Oe=$.toCanvas({x:$.x()-ae,y:$.y()-ae,width:q.computedWidth+2*ie,height:q.computedHeight+2*ie,pixelRatio:Q});return $.scale(he),de.drawImage(Oe,0,0,se.width,se.height),w.default.Util.releaseCanvas(Oe),A&&$.find(".page-background").forEach(_e=>_e.show()),te.forEach(_e=>{_e.visible(_e.getAttr("oldVisible"))}),re.forEach(_e=>{_e.visible(_e.getAttr("oldVisible"))}),$.find(".page-background").forEach(_e=>_e.shadowEnabled(!0)),$.find(".page-background").forEach(_e=>_e.strokeEnabled(!0)),z.find("Transformer").forEach(_e=>_e.visible(!0)),$.find(".highlighter").forEach(_e=>_e.visible(!0)),ee.clip(G),Z.clip(W),I.setElementsPixelRatio(U),q==null||q.set({_exporting:!1,_forceMount:!1}),se},async toDataURL(m={}){var{mimeType:A,quality:L}=m,k=a(m,["mimeType","quality"]);const R=await I._toCanvas(Object.assign({mimeType:A},k)),B=R.toDataURL(A,L);return w.default.Util.releaseCanvas(R),B},async toBlob(m={}){var{mimeType:A,quality:L}=m,k=a(m,["mimeType","quality"]);const R=await I._toCanvas(Object.assign({mimeType:A},k)),B=await new Promise(X=>{R.toBlob(X,A,L)});return w.default.Util.releaseCanvas(R),B},async saveAsImage(m={}){var{fileName:A}=m,L=a(m,["fileName"]);const k=L.mimeType||"image/png",R=k.split("/")[1];(0,_.downloadFile)(await I.toDataURL(L),A||"polotno."+R,k)},async _toPDF(m){const A=m.dpi||I.dpi,L=m.parallel||1,k=m.unit||(I.unit==="px"?"mm":I.unit),R=m.pixelRatio||1,B=m.pageIds||I.pages.map(te=>te.id),X=I.pages.filter(te=>B.includes(te.id)),Y=await(0,E.getJsPDF)(),Q=te=>(0,h.pxToUnit)({px:te,unit:k,dpi:A}),q=m.cropMarkSize||0,z=Q(q),N=X[0]||{},U=m.includeBleed?N.bleed:0,$=Q(N.computedWidth+2*U+2*z),ee=Q(N.computedHeight+2*U+2*z);var G=new Y({unit:k,orientation:$>ee?"landscape":"portrait",format:[$,ee],compress:!0,putOnlyUsedFonts:!0});G.deletePage(1);const Z=((te,re)=>{for(var ie=[],ae=0;ae<te.length;ae+=re)ie.push(te.slice(ae,ae+re));return ie})(X,L);let W=0;for(const te of Z){const re=te.map(async ie=>{const ae=m.includeBleed?ie.bleed:0,se=ie.computedWidth+2*ae+2*q,de=ie.computedHeight+2*ae+2*q,he=Q(se),Oe=Q(de);let _e=0,Ae=R;for(;_e<10;){_e+=1,_e===2&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const ce=await I.toDataURL(Object.assign(Object.assign({},m),{pageId:ie.id,pixelRatio:Ae}));if(ce.length>20)return m.onProgress&&m.onProgress(++W/B.length*.9),{url:ce,width:he,height:Oe,widthPx:se,heightPx:de};Ae*=.8}});(await Promise.all(re)).forEach(({url:ie,width:ae,height:se,widthPx:de,heightPx:he})=>{G.addPage([ae,se],ae>se?"landscape":"portrait");const Oe=G.getCurrentPageInfo();var _e;switch(k){case"pt":_e=1;break;case"mm":_e=72/25.4;break;case"cm":_e=72/2.54;break;case"in":_e=72;break;case"px":_e=.75;break;case"pc":case"em":_e=12;break;case"ex":_e=6;break;default:throw"Invalid unit: "+k}if(Oe.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:ae*_e,topRightY:se*_e},Oe.pageContext.artBox={bottomLeftX:Q(q+U)*_e,bottomLeftY:Q(q+U)*_e,topRightX:Q(de-q-U)*_e,topRightY:Q(he-q-U)*_e},Oe.pageContext.bleedBox={bottomLeftX:Q(q+U)*_e,bottomLeftY:Q(q+U)*_e,topRightX:Q(de-q-U)*_e,topRightY:Q(he-q-U)*_e},z){G.setLineWidth(Q(1));const Ae=z+Q(U);G.line(Ae,0,Ae,z),G.line(0,Ae,z,Ae),G.line(ae-Ae,0,ae-Ae,z),G.line(ae,Ae,ae-z,Ae),G.line(0,se-Ae,z,se-Ae),G.line(Ae,se,Ae,se-z),G.line(ae,se-Ae,ae-z,se-Ae),G.line(ae-Ae,se,ae-Ae,se-z)}G.addImage(ie,z,z,ae-2*z,se-2*z,void 0,"FAST")})}return G},toPDFDataURL:async m=>(await I._toPDF(Object.assign({mimeType:"image/jpeg"},m))).output("datauristring"),async toGIFDataURL(m={}){const A=m.pixelRatio||1,L=await(0,O.createGIF)({width:I.width*A,height:I.height*A}),k=1e3/(m.fps||10),R=I.duration/k;for(let B=0;B<R-1;B++){const X=B*k||1;I.setCurrentTime(X);let Y=0,Q="";for(const z of I.pages)if(Y+=z.duration,z.set({_rendering:Y>X}),Y>X){Q=z.id;break}const q=await I._toCanvas({pixelRatio:A,pageId:Q,_skipTimeout:!0});L.addFrame(q.getContext("2d"),{delay:k,copy:!0})}for(const B of I.pages)B.set({_rendering:!1});return I.stop(),L.render(),new Promise(B=>{L.on("finished",function(X){(function(Y,Q){var q=new FileReader;q.onload=function(z){Q(z.target.result)},q.readAsDataURL(Y)})(X,B)})})},async saveAsGIF(m={}){var{fileName:A}=m,L=a(m,["fileName"]);const k=await I.toGIFDataURL(L);(0,_.downloadFile)(k,A||"polotno.gif")},async toHTML({elementHook:m}={elementHook:void 0}){const A=I.toJSON();return(0,y.jsonToHTML)({json:A,elementHook:m})},async saveAsHTML({fileName:m}={}){const A=await I.toHTML(),L="data:text/html;base64,"+window.btoa(unescape(encodeURIComponent(A)));(0,_.downloadFile)(L,m||"polotno.html")},async toSVG({elementHook:m,pageId:A}={elementHook:void 0,pageId:void 0}){var L;const k=I.toJSON();A=A||((L=k.pages[0])===null||L===void 0?void 0:L.id);const R=k.pages.find(B=>B.id===A);return(0,b.jsonToSVG)({json:Object.assign(Object.assign({},k),{pages:R?[R]:[]}),elementHook:m})},async saveAsSVG({fileName:m,elementHook:A,pageId:L}={}){const k=await I.toSVG({elementHook:A,pageId:L}),R="data:text/svg;base64,"+window.btoa(unescape(encodeURIComponent(k)));(0,_.downloadFile)(R,m||"polotno.svg")},async saveAsPDF(m={}){var{fileName:A}=m,L=a(m,["fileName"]);(await I._toPDF(Object.assign({mimeType:"image/jpeg"},L))).save(A||"polotno.pdf")},async waitLoading({_skipTimeout:m=!1}={}){m||await new Promise(A=>setTimeout(A,50)),await(0,p.whenLoaded)()},toJSON:()=>({width:I.width,height:I.height,fonts:(0,s.getSnapshot)(I.fonts),pages:(0,s.getSnapshot)(I.pages),audios:(0,s.getSnapshot)(I.audios),unit:I.unit,dpi:I.dpi,custom:I.custom}),loadJSON(m,A=!1){var L;const k=Object.assign({},m),R=I.pages.indexOf(I.activePage);let B=(L=k.pages[R]||k.pages[0])===null||L===void 0?void 0:L.id;k._activePageId=B;const X=Object.assign({},(0,s.getSnapshot)(I));Object.assign(X,k),X.history=A?I.history.toJSON():{history:[],undoIdx:-1},(0,s.applySnapshot)(I,X)},clear({keepHistory:m=!1}={}){const A=I.pages.map(L=>L.id);I.deletePages(A),I.custom=null,m||I.history.clear()},addFont(m){I.removeFont(m.fontFamily),I.fonts.push(m),I.loadFont(m.fontFamily)},removeFont(m){I.fonts.filter(A=>A.fontFamily===m).forEach(A=>(0,s.destroy)(A))},addAudio(m){const A=T.Audio.create(Object.assign({id:(0,d.nanoid)(10)},m));I.audios.push(A)},removeAudio(m){const A=I.audios.find(L=>L.id===m);A&&I.audios.remove(A)},async loadFont(m){const A=I.fonts.find(k=>k.fontFamily===m)||S.globalFonts.find(k=>k.fontFamily===m);let L=[{fontStyle:"normal",fontWeight:"normal"}];return A?(A.styles&&(L=A.styles.map(k=>({fontStyle:k.fontStyle||"normal",fontWeight:k.fontWeight||"normal"}))),S.injectCustomFont(A)):S.injectGoogleFont(m),Promise.all(L.map(k=>S.loadFont(m,k.fontStyle,k.fontWeight)))},validate:m=>e.Store.validate(m,[{path:"",type:e.Store}]).map(A=>({path:"store"+A.context.map(L=>L.path).join("."),message:A.message}))})),e.default=j}(Ai)),Ai}var m3;function x_(){return m3||(m3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Node=void 0;const i=eo,t=Gp,n=zv(),a=O_(),l=Td();e.Node=i.types.model("Node",{id:i.types.identifier,type:"none",name:"",opacity:1,custom:i.types.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(s=>{for(var c in s)s[c]===null&&(s[c]=void 0);return s}).postProcessSnapshot(s=>{const c=Object.assign({},s),d={};for(var w in c)w[0]!=="_"&&(d[w]=s[w]);return d}).views(s=>({get locked(){return!(s.draggable||s.contentEditable||s.styleEditable||s.resizable)},get page(){return(0,i.getParentOfType)(s,a.Page)},get store(){return(0,i.getParentOfType)(s,n.Store)},get top(){let c=s;for(;;){if(!(0,i.hasParentOfType)(c,l.GroupElement))return c;c=(0,i.getParentOfType)(c,l.GroupElement)}},get parent(){return(0,i.hasParentOfType)(s,l.GroupElement)?(0,i.getParentOfType)(s,l.GroupElement):(0,i.hasParentOfType)(s,a.Page)?(0,i.getParentOfType)(s,a.Page):(0,i.hasParentOfType)(s,n.Store)?(0,i.getParentOfType)(s,n.Store):null},get zIndex(){return s.parent.children.indexOf(s)}})).actions(s=>({toJSON:()=>Object.assign({},(0,i.getSnapshot)(s))})).actions(s=>({clone(c={},{skipSelect:d=!1}={}){const w=JSON.parse(JSON.stringify(s.toJSON()));return c.id=c.id||(0,t.nanoid)(10),(0,l.forEveryChild)(w,_=>{_.id=(0,t.nanoid)(10)}),Object.assign(w,c),s.page.addElement(w,{skipSelect:d})},set(c){Object.assign(s,c)},moveUp(){s.page.moveElementsUp([s.id])},moveTop(){s.page.moveElementsTop([s.id])},moveDown(){s.page.moveElementsDown([s.id])},moveBottom(){s.page.moveElementsBottom([s.id])},setZIndex(c){s.parent.setElementZIndex(s.id,c)},beforeDestroy(){}}))}(cg)),cg}var wg={},Sg={},y3;function Hx(){return y3||(y3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.registerAnimation=e.animate=e.animations=void 0;const i=Hd(),t={right:{from:{x:-200},to:{x:0}},left:{from:{x:200},to:{x:0}},up:{from:{y:200},to:{y:0}},down:{from:{y:-200},to:{y:0}},"bottom-right":{from:{x:-200,y:-200},to:{x:0,y:0}},"bottom-left":{from:{x:200,y:-200},to:{x:0,y:0}},"top-right":{from:{x:-200,y:200},to:{x:0,y:0}},"top-left":{from:{x:200,y:200},to:{x:0,y:0}}};e.animations={fade:({dTime:l,element:s,animation:c})=>{const d=l/c.duration;return c.type==="enter"?{opacity:d*s.opacity}:{opacity:(1-d)*s.opacity}},rotate:({dTime:l,element:s,animation:c})=>{const d=l/c.duration*360;return(0,i.rotateAroundCenter)({x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation},d)},blink:({dTime:l,element:s,animation:c})=>{const d=c.duration,w=l%d/(d/2),_=w<=1?w:2-w;return{opacity:s.opacity*_}},bounce:({dTime:l,element:s,animation:c})=>{const d=c.duration,w=d/2,_={},E={x:s.x+s.width/3,y:s.y+s.height/3,width:s.width/3,height:s.height/3,fontSize:s.fontSize/3},O={x:s.x,y:s.y,width:s.width,height:s.height,fontSize:s.fontSize},v=l%d/w,S=v<=1?v:2-v;for(let p in E){const h=E[p],P=O[p]-h;_[p]=h+S*P}return _},move:({dTime:l,element:s,animation:c})=>{const d=t[c.data.direction]||t.right,w={};for(var _ in d.from){let E=d.from[_],O=d.to[_];c.type==="exit"&&(E=d.to[_],O=-d.from[_]);const v=s[_]+E,S=s[_]+O-v;w[_]=v+l/c.duration*S}return w},zoom:({dTime:l,element:s,animation:c})=>{const d={},w=((c.data.direction||"in")==="in"?1:-1)>0?.75:1.25,_=s.rotation*Math.PI/180,E=Math.cos(_),O=Math.sin(_),v=s.width*(1-w),S=s.height*(1-w),p=(v*E-S*O)/2,h=(v*O+S*E)/2,P={x:s.x+p,y:s.y+h,width:s.width*w,height:s.height*w,fontSize:s.fontSize*w},g={x:s.x,y:s.y,width:s.width,height:s.height,fontSize:s.fontSize};for(var y in P){let b=P[y],x=g[y];if(c.type==="exit"){const T=b;b=x,x=T}const M=x-b;d[y]=b+l/c.duration*M}return d}};const n=({element:l,dTime:s,animation:c})=>{const d=e.animations[c.name];return d?d({element:l,dTime:s,animation:c}):(console.error("Can not find animation type: "+c.name),{})};e.animate=n;const a=(l,s)=>{};e.registerAnimation=a}(Sg)),Sg}var b3;function Ec(){return b3||(b3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.ShapeFilter=e.getDiff=e.Animation=void 0;const i=eo,t=Hx(),n=No,a=x_();e.Animation=i.types.model("Animation",{delay:0,duration:500,enabled:!0,type:i.types.enumeration("Type",["enter","exit","loop"]),name:"none",data:i.types.frozen({})});const l=(s,c)=>{const d={};for(const w in c)if(typeof s[w]=="number"&&typeof c[w]=="number"){const _=c[w]-s[w];_!==0&&(d[w]=_)}return d};e.getDiff=l,e.ShapeFilter=i.types.model("ShapeFilter",{intensity:1}),e.Shape=a.Node.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:i.types.array(e.Animation),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:i.types.map(e.ShapeFilter),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(s=>{const c=Object.assign(Object.assign({},s),{x:s.x||0,y:s.y||0});return"width"in s&&(c.width=c.width||1),"height"in s&&(c.height=c.height||1),s.locked&&(c.draggable=!1,c.contentEditable=!1,c.styleEditable=!1,c.resizable=!1,c.removable=!1),c}).views(s=>{const c=(0,n.observable)({x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation,opacity:s.opacity,color:s.color,fontSize:s.fontSize}),d=(0,n.action)(_=>{Object.assign(c,_)}),w=(0,n.action)(_=>{for(const E in _)typeof c[E]=="number"&&(c[E]=c[E]+_[E])});return{get a(){const{currentTime:_}=s.store;if(d({x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation,opacity:s.opacity,color:s.color,fontSize:s.fontSize}),_===0)return c;const E=_-s.page.startTime;if(E>s.page.duration||E<0)return c;const O=s.store.animatedElementsIds;if(O.length&&!O.includes(s.id))return c;const v=s.animations.find(g=>g.type==="enter"),S=(v==null?void 0:v.enabled)&&E<v.delay;S&&d({opacity:0});const p=(v==null?void 0:v.enabled)&&E>=v.delay&&E<=v.delay+v.duration;if(p){const g=E-v.delay,y=(0,t.animate)({element:s,animation:v,dTime:g}),b=(0,e.getDiff)(s,y);w(b)}const h=s.animations.find(g=>g.type==="exit");if(!S&&!p&&(h!=null&&h.enabled)&&E>=s.page.duration-h.duration-h.delay&&E<=s.page.duration-h.delay){const g=E-(s.page.duration-h.duration-h.delay),y=(0,t.animate)({element:s,animation:h,dTime:g}),b=(0,e.getDiff)(s,y);w(b)}h!=null&&h.enabled&&E>=s.page.duration-h.delay&&d({opacity:0});const P=s.animations.find(g=>g.type==="loop");if(P!=null&&P.enabled){const g=E,y=(0,t.animate)({element:s,animation:P,dTime:g}),b=(0,e.getDiff)(s,y);w(b)}return c},animated:_=>s.a[_]}}).actions(s=>({setAnimation(c,d){const w=s.animations.find(_=>_.type===c);w?Object.assign(w,d):s.animations.push(Object.assign({type:c},d))},setFilter(c,d){s.filters.clear(),d!==0&&s.filters.set(c,{intensity:d})}}))}(wg)),wg}var Eg={},_3;function Gx(){return _3||(_3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TextElement=void 0;const i=eo,t=Ec();e.TextElement=t.Shape.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:i.types.optional(i.types.union(i.types.number,i.types.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:"#7ED321",backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5}).preProcessSnapshot(n=>Object.assign({},n)).actions(n=>({toggleEditMode(a){n._editModeEnabled=a??!n._editModeEnabled,n._editModeEnabled?n.store.history.startTransaction():n.store.history.endTransaction()}}))}(Eg)),Eg}var Og={},w3;function P_(){return w3||(w3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImageElement=void 0;const i=Ec();e.ImageElement=i.Shape.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,keepRatio:!1,_cropModeEnabled:!1}).actions(t=>({toggleCropMode(n){t._cropModeEnabled=n??!t._cropModeEnabled,t._cropModeEnabled?t.store.history.startTransaction():t.store.history.endTransaction()},beforeDestroy(){t._cropModeEnabled&&t.store.history.endTransaction()}}))}(Og)),Og}var xg={},S3;function Vx(){return S3||(S3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VideoElement=void 0;const i=P_();e.VideoElement=i.ImageElement.named("Video").props({type:"video",duration:0,startTime:0,endTime:1,volume:1})}(xg)),xg}var Pg={},E3;function $x(){return E3||(E3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LineElement=void 0;const i=eo,t=Ec();e.LineElement=t.Shape.named("Line").props({type:"line",width:400,height:10,color:"black",dash:i.types.array(i.types.number),startHead:"",endHead:""}).actions(n=>({}))}(Pg)),Pg}var Cg={},O3;function Wx(){return O3||(O3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SVGElement=void 0;const i=eo,t=Ec();e.SVGElement=t.Shape.named("SVG").props({type:"svg",src:"",maskSrc:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:i.types.map(i.types.string)}).preProcessSnapshot(n=>Object.assign(Object.assign({},n),{src:n.src||n.svgSource})).actions(n=>({replaceColor(a,l){n.colorsReplace.set(a,l)}}))}(Cg)),Cg}var kg={},x3;function Yx(){return x3||(x3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FigureElement=void 0;const i=eo,t=Ec();e.FigureElement=t.Shape.named("Figure").props({type:"figure",subType:"rect",fill:"rgb(0, 161, 255)",dash:i.types.array(i.types.number),strokeWidth:0,stroke:"rgba(98, 197, 255, 1)",cornerRadius:0})}(kg)),kg}var P3;function Td(){return P3||(P3=1,function(e){var i=md&&md.__rest||function(h,P){var g={};for(var y in h)Object.prototype.hasOwnProperty.call(h,y)&&P.indexOf(y)<0&&(g[y]=h[y]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var b=0;for(y=Object.getOwnPropertySymbols(h);b<y.length;b++)P.indexOf(y[b])<0&&Object.prototype.propertyIsEnumerable.call(h,y[b])&&(g[y[b]]=h[y[b]])}return g};Object.defineProperty(e,"__esModule",{value:!0}),e.TYPES_MAP=e.GroupElement=e.ElementTypes=e.forEveryChild=void 0,e.registerShapeModel=p;const t=eo,n=Gp,a=x_(),l=Ec(),s=Gx(),c=P_(),d=Vx(),w=$x(),_=Wx(),E=Yx(),O=(h,P)=>{if(h.children)for(const g of h.children){if(P(g)===!0)break;(0,e.forEveryChild)(g,P)}};e.forEveryChild=O;const v=[...new Array(20)].map((h,P)=>t.types.late(()=>S[P]));e.ElementTypes=t.types.union({dispatcher:h=>{const P=e.TYPES_MAP[h.type];if(!P)throw new Error(`Unknown element type: "${h.type}"`);return P}},_.SVGElement,s.TextElement,c.ImageElement,w.LineElement,d.VideoElement,E.FigureElement,t.types.late(()=>e.GroupElement),...v),e.GroupElement=a.Node.named("Group").props({type:"group",children:t.types.array(e.ElementTypes)}).views(h=>({get draggable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.draggable||(P=!1)}),P},get resizable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.resizable||(P=!1)}),P},get contentEditable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.contentEditable||(P=!1)}),P},get styleEditable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.styleEditable||(P=!1)}),P},get locked(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.locked||(P=!1)}),P}})).actions(h=>({set(P){var{draggable:g,contentEditable:y,styleEditable:b,resizable:x}=P,M=i(P,["draggable","contentEditable","styleEditable","resizable"]);g!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({draggable:g})}),y!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({contentEditable:y})}),b!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({styleEditable:b})}),x!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({resizable:x})}),Object.assign(h,M)},addElement(P,{skipSelect:g=!1}={}){const y=e.TYPES_MAP[P.type];if(!y)return void console.error("Can not find model with type "+P.type);P.children&&P.children.forEach(x=>{x.id=(0,n.nanoid)(10)});const b=y.create(Object.assign({id:(0,n.nanoid)(10)},P));return h.children.push(b),b.selectable&&!g&&h.store.selectElements([b.id]),b},setElementZIndex(P,g){const y=h.children.find(b=>b.id===P);y&&((0,t.detach)(y),h.children.remove(y),h.children.splice(g,0,y))}}));const S=[];function p(h,P){const g=h.type;if(!g)throw new Error('You must pass "type" attribute to custom model.');let y=l.Shape.named(g).props(h);P&&(y=P(y)),e.TYPES_MAP[g]=y,S.push(y)}e.TYPES_MAP={svg:_.SVGElement,text:s.TextElement,image:c.ImageElement,group:e.GroupElement,line:w.LineElement,video:d.VideoElement,figure:E.FigureElement}}(md)),md}var C3;function Kx(){return C3||(C3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isClipboardEmpty=e.paste=e.cut=e.copy=void 0;const i=Td();let t=[],n="";const a="polotno_clipboard",l=E=>{t=JSON.parse(JSON.stringify(E));try{localStorage.setItem(a,JSON.stringify(E))}catch{}},s=()=>{try{const E=localStorage.getItem(a);if(E)return JSON.parse(E)}catch{}return t},c=E=>{var O;n=(O=E.activePage)===null||O===void 0?void 0:O.id,l(E.selectedElements.map(v=>v.toJSON()))};e.copy=c;const d=E=>{var O;n=(O=E.activePage)===null||O===void 0?void 0:O.id,l(E.selectedElements.map(S=>S.toJSON()));let v=E.selectedElements.filter(S=>S.removable).map(S=>S.id);E.deleteElements(v)};e.cut=d;const w=E=>{var O,v;let S=0;n===((O=E.activePage)===null||O===void 0?void 0:O.id)&&(S=E.width/20),n=(v=E.activePage)===null||v===void 0?void 0:v.id,E.history.transaction(()=>{const p=[],h=s();(0,i.forEveryChild)({children:h},P=>{delete P.id,P.type!=="group"&&(P.x+=S,P.y+=S)}),h.forEach(P=>{var g;const y=(g=E.activePage)===null||g===void 0?void 0:g.addElement(P);y&&p.push(y.id)}),l(h),E.selectElements(p)})};e.paste=w;const _=()=>s().length===0;e.isClipboardEmpty=_}(ug)),ug}var k3;function Xx(){return k3||(k3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.handleHotkey=t;const i=Kx();function t(n,a){var l,s,c,d;if(((l=document.activeElement)===null||l===void 0?void 0:l.tagName)==="INPUT"||((s=document.activeElement)===null||s===void 0?void 0:s.tagName)==="TEXTAREA"||((c=document.activeElement)===null||c===void 0?void 0:c.contentEditable)==="true")return;const w=a.selectedElements.filter(O=>O.removable).map(O=>O.id);n.keyCode!==46&&n.keyCode!==8||a.deleteElements(w);const _=n.ctrlKey||n.metaKey,E=n.shiftKey;if(_&&!E&&n.code==="KeyZ"&&(n.preventDefault(),a.history.undo()),_&&E&&n.code==="KeyZ"&&(n.preventDefault(),a.history.redo()),_&&n.code==="KeyA"){n.preventDefault();const O=(d=a.activePage)===null||d===void 0?void 0:d.children.filter(S=>S.selectable),v=(O==null?void 0:O.map(S=>S.id))||[];a.selectElements(v)}_&&n.code==="KeyC"&&(n.preventDefault(),(0,i.copy)(a)),_&&n.code==="KeyX"&&(n.preventDefault(),(0,i.cut)(a)),_&&n.code==="KeyV"&&(n.preventDefault(),(0,i.paste)(a)),n.code==="ArrowDown"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({y:O.y+1})})),n.code==="ArrowUp"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({y:O.y-1})})),n.code==="ArrowLeft"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({x:O.x-1})})),n.code==="ArrowRight"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({x:O.x+1})}))}}(sg)),sg}var Ag={},A3;function Zx(){return A3||(A3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.t=e.getTranslations=e.setTranslations=void 0;const i=No,t=(0,i.observable)({toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",textBackground:"Background",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",textStroke:"Text Stroke",shadow:"Shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",position:"Position",layering:"Layering",toForward:"To forward",up:"Up",down:"Down",toBottom:"To bottom",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",colorPicker:{solid:"Solid",linear:"Linear"},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",lines:"Lines",upload:"Upload",uploadImage:"Upload Image",uploadTip:"Do you want to upload your own images?",background:"Background",resize:"Resize",layers:"Layers",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",clipImage:"Mask image",width:"Width",height:"Height",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio"},contextMenu:{duplicate:"Duplicate",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}});function n(_,E){var O,v=E.split("."),S=_;for(O=0;O<v.length;++O){if(S[v[O]]==null)return;S=S[v[O]]}return S}const a=_=>_&&typeof _=="object";function l(_,E){Object.keys(E).forEach(O=>{const v=_[O],S=E[O];a(S)&&a(v)?l(v,S):_[O]=S})}function s(_,E,O=""){Object.keys(E).forEach(v=>{const S=E[v],p=O?`${O}.${v}`:v;a(S)?a(_[v])?s(_[v],S,p):console.warn(`Missing nested translation object at '${p}'`):_[v]===void 0&&console.warn(`Missing translation '${p}'`)})}e.setTranslations=(0,i.action)((_,{validate:E=!1}={})=>{E&&s(_,t),l(t,_)});const c=()=>(0,i.toJS)(t);e.getTranslations=c;const d={},w=_=>{const E=n(t,_);if(E!==void 0)return E;d[_]||(d[_]=!0,console.warn(`Missing translation '${_}'`));const O=_.split("."),v=O[O.length-1]||" ";return v.charAt(0).toUpperCase()+v.slice(1)};e.t=w}(Ag)),Ag}var T3;function Qx(){return T3||(T3=1,function(e){var i=vf&&vf.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceCanvas=void 0;const t=i(Tn()),n=Qi,a=i(kx()),l=Ax(),s=Tx(),c=Xx(),d=Zx(),w=`Polotno warning: <Workspace /> component can not automatically detect its size.
|
|
318
|
+
`};async function k({json:R,elementHook:B}){const X=await m({json:R,elementHook:B});return L({dom:X})}}(xo)),xo}var bg={},p3;function O_(){return p3||(p3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Page=void 0;const i=eo,t=Gp,n=Td(),a=zv(),l=Td(),s=Hd();e.Page=i.types.model("Page",{id:i.types.identifier,children:i.types.array(i.types.late(()=>n.ElementTypes)),width:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),height:i.types.optional(i.types.union(i.types.number,i.types.literal("auto")),"auto"),background:"white",bleed:0,custom:i.types.frozen(),duration:5e3,_exporting:!1,_rendering:!1,_forceMount:!1}).postProcessSnapshot(c=>{const d=Object.assign({},c),w={};for(var _ in d)_[0]!=="_"&&(w[_]=c[_]);return w}).views(c=>({get store(){return(0,i.getParentOfType)(c,a.Store)}})).views(c=>({get startTime(){let d=0;for(const w of c.store.pages){if(w.id===c.id)return d;d+=w.duration}return d},get _exportingOrRendering(){return c._exporting||c._rendering}})).views(c=>({get computedWidth(){return c.width==="auto"?c.store.width:c.width},get computedHeight(){return c.height==="auto"?c.store.height:c.height}})).actions(c=>({toJSON:()=>JSON.parse(JSON.stringify((0,i.getSnapshot)(c))),_forEachElementUp(d,w){const _=d.map(E=>({id:E,index:c.children.findIndex(O=>O.id===E)}));_.sort((E,O)=>O.index-E.index);for(const{index:E}of _){if(E==-1)continue;const O=E<c.children.length-1&&c.children[E+1],v=d.indexOf(O==null?void 0:O.id)>=0;E===c.children.length-1||v||w(E)}},_forEachElementDown(d,w){const _=d.map(E=>({id:E,index:c.children.findIndex(O=>O.id===E)}));_.sort((E,O)=>E.index-O.index);for(const{index:E}of _){if(E==-1)continue;const O=E>0&&c.children[E-1],v=d.indexOf(O==null?void 0:O.id)>=0;E===0||v||w(E)}return!1}})).actions(c=>({clone(d={}){const w=c.toJSON();w.children.forEach(v=>{v.id=(0,t.nanoid)(10),(0,l.forEveryChild)(v,S=>{S.id=(0,t.nanoid)(10)})});const _=Object.assign(Object.assign(Object.assign({},w),{id:(0,t.nanoid)(10)}),d),E=c.store.addPage(_),O=c.store.pages.indexOf(c);E.setZIndex(O+1),E.select()},setZIndex(d){c.store.setPageZIndex(c.id,d)},set(d){Object.assign(c,d)},select(){c.store.selectPage(c.id)},addElement(d,{skipSelect:w=!1}={}){const _=l.TYPES_MAP[d.type];if(!_)return void console.error("Can not find model with type "+d.type);"children"in d&&Array.isArray(d.children)&&d.children.forEach(O=>{O.id=(0,t.nanoid)(10)});const E=_.create(Object.assign({id:(0,t.nanoid)(10)},d));return c.children.push(E),E.selectable&&!w&&c.store.selectElements([E.id]),E},canMoveElementsUp(d){let w=!1;return c._forEachElementUp(d,()=>{w=w||!0}),w},moveElementsUp(d){c._forEachElementUp(d,w=>{const _=c.children[w];(0,i.detach)(_),c.children.splice(w+1,0,_)})},canMoveElementsTop(d){return this.canMoveElementsUp(d)},moveElementsTop(d){const w=[],_=[];c.children.forEach(E=>{d.indexOf(E.id)>=0?w.push(E):_.push(E)}),c.children.replace(_.concat(w))},canMoveElementsDown(d){let w=!1;return c._forEachElementDown(d,()=>{w=w||!0}),w},moveElementsDown(d){c._forEachElementDown(d,w=>{const _=c.children[w];(0,i.detach)(_),c.children.splice(w-1,0,_)})},canMoveElementsBottom(d){return this.canMoveElementsDown(d)},moveElementsBottom(d){const w=[],_=[];c.children.forEach(E=>{d.indexOf(E.id)>=0?w.push(E):_.push(E)}),c.children.replace(w.concat(_))},setElementZIndex(d,w){const _=c.children.find(E=>E.id===d);_&&((0,i.detach)(_),c.children.remove(_),c.children.splice(w,0,_))},setSize({width:d,height:w,useMagic:_,softChange:E}){if(_){const O=[],v=k=>k.type==="image"&&k.x<1&&k.y<1&&k.width>=c.computedWidth-2&&k.height>=c.computedHeight-2;(0,l.forEveryChild)(c,k=>{k.type!=="group"&&(v(k)||O.push(k))});const S=O.length?(0,s.getTotalClientRect)(O):{x:0,y:0,width:c.computedWidth,height:c.computedHeight},p=1/4,h=Math.max(0,Math.min(S.x,c.computedWidth-S.x-S.width)),P=c.computedWidth*p,g=Math.max(0,h-P),y=Math.max(0,Math.min(S.y,c.computedHeight-S.y-S.height)),b=c.computedHeight*p,x=Math.max(0,y-b),M=c.computedWidth-2*g,T=c.computedHeight-2*x,j=d/M,I=w/T,m=Math.min(j,I),A=(d-M*m)/2-g*m,L=(w-T*m)/2-x*m;(0,l.forEveryChild)(c,k=>{k.type!=="group"&&(v(k)?k.set({x:k.x*m,y:k.y*m,width:k.width*j,height:k.height*I,cropX:0,cropY:0,cropWidth:1,cropHeight:1}):(k.set({x:A+k.x*m,y:L+k.y*m,width:k.width*m,height:k.height*m}),k.type==="text"?k.set({fontSize:k.fontSize*m}):k.type==="figure"&&k.set({strokeWidth:k.strokeWidth*m})))})}E||(c.width=d),E||(c.height=w)}})).actions(c=>({moveElementUp(d){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),c.moveElementsUp([d])},moveElementDown(d){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),c.moveElementsDown([d])},moveElementTop(d){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),c.moveElementsTop([d])},moveElementBottom(d){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),c.moveElementsBottom([d])},play(){c.store.play({startTime:c.startTime,endTime:c.startTime+c.duration})}}))}(bg)),bg}var _g={},g3;function qx(){return g3||(g3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Audio=void 0;const i=eo;e.Audio=i.types.model("Audio",{id:i.types.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0}).actions(t=>({toJSON:()=>Object.assign({},(0,i.getSnapshot)(t))})).actions(t=>({set(n){Object.assign(t,n)}}))}(_g)),_g}var v3;function zv(){return v3||(v3=1,function(e){var i=Ai&&Ai.__createBinding||(Object.create?function(I,m,A,L){L===void 0&&(L=A);var k=Object.getOwnPropertyDescriptor(m,A);k&&!("get"in k?!m.__esModule:k.writable||k.configurable)||(k={enumerable:!0,get:function(){return m[A]}}),Object.defineProperty(I,L,k)}:function(I,m,A,L){L===void 0&&(L=A),I[L]=m[A]}),t=Ai&&Ai.__setModuleDefault||(Object.create?function(I,m){Object.defineProperty(I,"default",{enumerable:!0,value:m})}:function(I,m){I.default=m}),n=Ai&&Ai.__importStar||function(){var I=function(m){return I=Object.getOwnPropertyNames||function(A){var L=[];for(var k in A)Object.prototype.hasOwnProperty.call(A,k)&&(L[L.length]=k);return L},I(m)};return function(m){if(m&&m.__esModule)return m;var A={};if(m!=null)for(var L=I(m),k=0;k<L.length;k++)L[k]!=="default"&&i(A,m,L[k]);return t(A,m),A}}(),a=Ai&&Ai.__rest||function(I,m){var A={};for(var L in I)Object.prototype.hasOwnProperty.call(I,L)&&m.indexOf(L)<0&&(A[L]=I[L]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function"){var k=0;for(L=Object.getOwnPropertySymbols(I);k<L.length;k++)m.indexOf(L[k])<0&&Object.prototype.propertyIsEnumerable.call(I,L[k])&&(A[L[k]]=I[L[k]])}return A},l=Ai&&Ai.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(e,"__esModule",{value:!0}),e.Store=e.Font=void 0,e.createStore=j;const s=eo,c=Ix(),d=Gp,w=l(Ji()),_=Dx(),E=jx(),O=Fx(),v=jv(),S=n(Bd()),p=Ks(),h=Fv(),P=S_(),g=zx(),y=Bx(),b=Ux(),x=O_(),M=Td(),T=qx();function j({key:I,showCredit:m}={key:"",showCredit:!1}){return e.Store.create({_forceShowCredit:m,_key:I})}(0,s.setLivelinessChecking)("ignore"),e.Font=s.types.model("Font",{fontFamily:s.types.string,url:s.types.optional(s.types.string,""),styles:s.types.frozen()}).preProcessSnapshot(I=>Object.assign(Object.assign({},I),{fontFamily:I.fontFamily||I.name})),e.Store=s.types.model("Store",{role:"",pages:s.types.array(x.Page),fonts:s.types.array(e.Font),audios:s.types.array(T.Audio),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:"px",dpi:72,bleedVisible:!1,rulesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:s.types.frozen(),selectedElementsIds:s.types.array(s.types.string),animatedElementsIds:s.types.array(s.types.string),history:s.types.optional(c.UndoManager,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,window.devicePixelRatio||1),_activePageId:"",_forceShowCredit:!1,_key:"",_validated:!1}).views(I=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),I.bleedVisible},get selectedElements(){return I.selectedElementsIds.map(m=>{for(const A of I.pages)for(const L of A.children)if(L.id===m)return L}).filter(m=>!!m)},get children(){return I.pages},get selectedShapes(){const m=[];return(0,M.forEveryChild)({children:I.selectedElements},A=>{A.type!=="group"&&m.push(A)}),m},get activePage(){return I.pages.slice().find(m=>m.id===I._activePageId)||(I.pages.length?I.pages[0]:null)},get duration(){let m=0;return I.pages.forEach(A=>{m+=A.duration}),m},get _hasCroppedImages(){return I.find(m=>m.type==="image"&&m._cropModeEnabled)},find(m){let A;return(0,M.forEveryChild)({children:I.pages},L=>{if(!A&&m(L))return A=L,!0}),A},getElementById:m=>I.find(A=>A.id===m)})).actions(I=>{let m=0,A=null,L=!1;return{afterCreate(){I.history.canUndo},setCurrentTime(k){I.currentTime=k},_togglePlaying(k=!I.isPlaying){I.isPlaying=k},play({animatedElementsIds:k=[],startTime:R=0,currentTime:B=0,endTime:X=I.duration,repeat:Y=!1}={}){B&&(console.warn("currentTime property of store.play() is deprecated. Please use startTime instead."),R=B),I.animatedElementsIds=(0,s.cast)(k),I.currentTime=R,I.isPlaying=!0,m=Date.now(),A=X,L=Y,requestAnimationFrame(I.seek)},checkActivePage(){let k=0;for(const R of I.pages){if(I.currentTime>=R.startTime&&I.currentTime<R.startTime+R.duration){I.selectPage(R.id);break}k+=R.duration}},seek(){if(!I.isPlaying)return;const k=Date.now(),R=k-m;m=k,I.currentTime+=R,I.checkActivePage();const B=A||I.duration;I.isPlaying&&I.currentTime<B?requestAnimationFrame(I.seek):I.isPlaying&&L?(I.currentTime=0,requestAnimationFrame(I.seek)):I.stop()},stop(){I.isPlaying=!1,I.currentTime=0,I.animatedElementsIds=(0,s.cast)([]),I.checkActivePage()}}}).actions(I=>({__(){I._validated||((0,v.validateKey)(I._key,I._forceShowCredit),I._validated=!0)},set(m){Object.assign(I,m)},setUnit({unit:m,dpi:A}){I.unit=m||I.unit,I.dpi=A||I.dpi},setRole(m){I.role=m},addPage(m){const A=x.Page.create(Object.assign({id:(0,d.nanoid)(10)},m));return I.pages.push(A),I._activePageId=A.id,A},selectPage(m){I._activePageId=m},selectElements(m){const A=m.map(L=>I.getElementById(L)).sort((L,k)=>L.page.children.indexOf(L)-L.page.children.indexOf(k)).filter(L=>!!L).map(L=>L.id);I.selectedElementsIds=(0,s.cast)(A)},toggleBleed(m){I.bleedVisible=m??!I.bleedVisible},toggleRulers(m){I.rulesVisible=m??!I.rulesVisible},openSidePanel(m){I.openedSidePanel!==m&&(I.previousOpenedSidePanel=I.openedSidePanel,I.openedSidePanel=m)},setScale(m){I.scale=m},_setScaleToFit(m){I.scaleToFit=m},setElementsPixelRatio(m){I._elementsPixelRatio=m},setSize(m,A,L){I.pages.forEach(k=>{k.setSize({width:m,height:A,useMagic:L,softChange:!0})}),I.width=m,I.height=A},setPageZIndex(m,A){const L=I.pages.find(k=>k.id===m);L&&((0,s.detach)(L),I.pages.remove(L),I.pages.splice(A,0,L))},deletePages(m){const A=I.pages.indexOf(I.activePage);m.forEach(R=>{const B=I.pages.find(X=>X.id===R);(0,s.destroy)(B)});const L=Math.min(I.pages.length-1,A),k=I.pages[L];k&&(I._activePageId=k.id),I.selectedElementsIds=(0,s.cast)(I.selectedElementsIds.filter(R=>I.getElementById(R)))},groupElements(m){const A=m.map(R=>I.getElementById(R));A.forEach(R=>{R&&(0,s.detach)(R)});const L=I.activePage,k={id:(0,d.nanoid)(10),children:A,type:"group"};return L.children.push(k),I.selectedElementsIds=(0,s.cast)([k.id]),L.children.find(R=>R.id===k.id)},ungroupElements(m){const A=m.map(k=>I.getElementById(k)),L=[];A.forEach(k=>{if(k&&k.type==="group"){const R=k.page,B=R.children.indexOf(k);k.children.forEach(X=>{L.push(X.id)}),k.children.forEach(X=>{(0,s.detach)(X),R.children.push(X)}),R.children.splice(B,1)}}),I.selectedElementsIds=(0,s.cast)(L)},deleteElements(m){const A=[];I.find(L=>(m.includes(L.id)&&A.push(L),!1)),A.forEach(L=>{(0,s.destroy)(L)}),I.selectedElementsIds=(0,s.cast)(I.selectedElementsIds.filter(L=>I.getElementById(L)))},on(m,A){if(m==="change"){let L=I.toJSON();return(0,s.onSnapshot)(I,k=>{const R=I.toJSON();!(0,P.deepEqual)(L,R)&&(L=R,A(R))})}},async _toCanvas({pixelRatio:m,ignoreBackground:A,pageId:L,mimeType:k,includeBleed:R,_skipTimeout:B,quickMode:X=!1}={}){var Y;const Q=m||1;L=L||((Y=I.pages[0])===null||Y===void 0?void 0:Y.id);const q=I.pages.find(_e=>_e.id===L);if(!q)throw new Error(`No page for export with id ${L}`);X?q==null||q.set({_forceMount:!0}):q==null||q.set({_exporting:!0});const z=await(0,g.waitTillAvailable)(()=>w.default.stages.find(_e=>_e.getAttr("pageId")===L));if(!z)throw q==null||q.set({_forceMount:!1,_exporting:!1}),new Error(`Export is failed. Can not find stage for page ${L}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);const N=!!z.findOne(".page-container"),U=I._elementsPixelRatio;Q>I._elementsPixelRatio&&I.setElementsPixelRatio(Q),await I.waitLoading({_skipTimeout:B});const $=z.findOne(".page-container");if(!$)throw I.setElementsPixelRatio(U),q==null||q.set({_forceMount:!1,_exporting:!1}),new Error(`Export is failed. Can't find page container. ${N}`);z.find("Transformer").forEach(_e=>_e.visible(!1)),$.find(".page-background").forEach(_e=>_e.shadowEnabled(!1)),$.find(".page-background").forEach(_e=>_e.strokeEnabled(!1)),$.find(".highlighter").forEach(_e=>_e.visible(!1));const ee=$.findOne(".page-background-group"),G=ee.clip();ee.clip({x:null,y:null,width:null,height:null});const Z=$.findOne(".elements-container"),W=Z.clip();Z.clip({x:null,y:null,width:null,height:null});const te=$.find(_e=>_e.getAttr("hideInExport"));te.forEach(_e=>{_e.setAttr("oldVisible",_e.visible()),_e.hide()});const re=$.find(_e=>!_e.visible()&&_e.getAttr("editModeEnabled"));re.forEach(_e=>{_e.setAttr("oldVisible",_e.visible()),_e.show()}),A&&$.find(".page-background").forEach(_e=>_e.hide());const ie=R?q.bleed:0;let ae=ie;!I.bleedVisible&&R||(I.bleedVisible||R?I.bleedVisible&&R?ae=0:I.bleedVisible&&!R&&(ae=-q.bleed):ae=0);const se=document.createElement("canvas");se.width=Math.round((q.computedWidth+2*ie)*Q),se.height=Math.round((q.computedHeight+2*ie)*Q);const de=se.getContext("2d");k==="image/jpeg"&&(de.fillStyle="white",de.fillRect(0,0,se.width,se.height));const he=$.scale();$.scale({x:1,y:1});const Oe=$.toCanvas({x:$.x()-ae,y:$.y()-ae,width:q.computedWidth+2*ie,height:q.computedHeight+2*ie,pixelRatio:Q});return $.scale(he),de.drawImage(Oe,0,0,se.width,se.height),w.default.Util.releaseCanvas(Oe),A&&$.find(".page-background").forEach(_e=>_e.show()),te.forEach(_e=>{_e.visible(_e.getAttr("oldVisible"))}),re.forEach(_e=>{_e.visible(_e.getAttr("oldVisible"))}),$.find(".page-background").forEach(_e=>_e.shadowEnabled(!0)),$.find(".page-background").forEach(_e=>_e.strokeEnabled(!0)),z.find("Transformer").forEach(_e=>_e.visible(!0)),$.find(".highlighter").forEach(_e=>_e.visible(!0)),ee.clip(G),Z.clip(W),I.setElementsPixelRatio(U),q==null||q.set({_exporting:!1,_forceMount:!1}),se},async toDataURL(m={}){var{mimeType:A,quality:L}=m,k=a(m,["mimeType","quality"]);const R=await I._toCanvas(Object.assign({mimeType:A},k)),B=R.toDataURL(A,L);return w.default.Util.releaseCanvas(R),B},async toBlob(m={}){var{mimeType:A,quality:L}=m,k=a(m,["mimeType","quality"]);const R=await I._toCanvas(Object.assign({mimeType:A},k)),B=await new Promise(X=>{R.toBlob(X,A,L)});return w.default.Util.releaseCanvas(R),B},async saveAsImage(m={}){var{fileName:A}=m,L=a(m,["fileName"]);const k=L.mimeType||"image/png",R=k.split("/")[1];(0,_.downloadFile)(await I.toDataURL(L),A||"polotno."+R,k)},async _toPDF(m){const A=m.dpi||I.dpi,L=m.parallel||1,k=m.unit||(I.unit==="px"?"mm":I.unit),R=m.pixelRatio||1,B=m.pageIds||I.pages.map(te=>te.id),X=I.pages.filter(te=>B.includes(te.id)),Y=await(0,E.getJsPDF)(),Q=te=>(0,h.pxToUnit)({px:te,unit:k,dpi:A}),q=m.cropMarkSize||0,z=Q(q),N=X[0]||{},U=m.includeBleed?N.bleed:0,$=Q(N.computedWidth+2*U+2*z),ee=Q(N.computedHeight+2*U+2*z);var G=new Y({unit:k,orientation:$>ee?"landscape":"portrait",format:[$,ee],compress:!0,putOnlyUsedFonts:!0});G.deletePage(1);const Z=((te,re)=>{for(var ie=[],ae=0;ae<te.length;ae+=re)ie.push(te.slice(ae,ae+re));return ie})(X,L);let W=0;for(const te of Z){const re=te.map(async ie=>{const ae=m.includeBleed?ie.bleed:0,se=ie.computedWidth+2*ae+2*q,de=ie.computedHeight+2*ae+2*q,he=Q(se),Oe=Q(de);let _e=0,Ae=R;for(;_e<10;){_e+=1,_e===2&&console.error("Polotno can not export PDF with current settings. Quality is automatically reduced.");const ce=await I.toDataURL(Object.assign(Object.assign({},m),{pageId:ie.id,pixelRatio:Ae}));if(ce.length>20)return m.onProgress&&m.onProgress(++W/B.length*.9),{url:ce,width:he,height:Oe,widthPx:se,heightPx:de};Ae*=.8}});(await Promise.all(re)).forEach(({url:ie,width:ae,height:se,widthPx:de,heightPx:he})=>{G.addPage([ae,se],ae>se?"landscape":"portrait");const Oe=G.getCurrentPageInfo();var _e;switch(k){case"pt":_e=1;break;case"mm":_e=72/25.4;break;case"cm":_e=72/2.54;break;case"in":_e=72;break;case"px":_e=.75;break;case"pc":case"em":_e=12;break;case"ex":_e=6;break;default:throw"Invalid unit: "+k}if(Oe.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:ae*_e,topRightY:se*_e},Oe.pageContext.artBox={bottomLeftX:Q(q+U)*_e,bottomLeftY:Q(q+U)*_e,topRightX:Q(de-q-U)*_e,topRightY:Q(he-q-U)*_e},Oe.pageContext.bleedBox={bottomLeftX:Q(q+U)*_e,bottomLeftY:Q(q+U)*_e,topRightX:Q(de-q-U)*_e,topRightY:Q(he-q-U)*_e},z){G.setLineWidth(Q(1));const Ae=z+Q(U);G.line(Ae,0,Ae,z),G.line(0,Ae,z,Ae),G.line(ae-Ae,0,ae-Ae,z),G.line(ae,Ae,ae-z,Ae),G.line(0,se-Ae,z,se-Ae),G.line(Ae,se,Ae,se-z),G.line(ae,se-Ae,ae-z,se-Ae),G.line(ae-Ae,se,ae-Ae,se-z)}G.addImage(ie,z,z,ae-2*z,se-2*z,void 0,"FAST")})}return G},toPDFDataURL:async m=>(await I._toPDF(Object.assign({mimeType:"image/jpeg"},m))).output("datauristring"),async toGIFDataURL(m={}){const A=m.pixelRatio||1,L=await(0,O.createGIF)({width:I.width*A,height:I.height*A}),k=1e3/(m.fps||10),R=I.duration/k;for(let B=0;B<R-1;B++){const X=B*k||1;I.setCurrentTime(X);let Y=0,Q="";for(const z of I.pages)if(Y+=z.duration,z.set({_rendering:Y>X}),Y>X){Q=z.id;break}const q=await I._toCanvas({pixelRatio:A,pageId:Q,_skipTimeout:!0});L.addFrame(q.getContext("2d"),{delay:k,copy:!0})}for(const B of I.pages)B.set({_rendering:!1});return I.stop(),L.render(),new Promise(B=>{L.on("finished",function(X){(function(Y,Q){var q=new FileReader;q.onload=function(z){Q(z.target.result)},q.readAsDataURL(Y)})(X,B)})})},async saveAsGIF(m={}){var{fileName:A}=m,L=a(m,["fileName"]);const k=await I.toGIFDataURL(L);(0,_.downloadFile)(k,A||"polotno.gif")},async toHTML({elementHook:m}={elementHook:void 0}){const A=I.toJSON();return(0,y.jsonToHTML)({json:A,elementHook:m})},async saveAsHTML({fileName:m}={}){const A=await I.toHTML(),L="data:text/html;base64,"+window.btoa(unescape(encodeURIComponent(A)));(0,_.downloadFile)(L,m||"polotno.html")},async toSVG({elementHook:m,pageId:A}={elementHook:void 0,pageId:void 0}){var L;const k=I.toJSON();A=A||((L=k.pages[0])===null||L===void 0?void 0:L.id);const R=k.pages.find(B=>B.id===A);return(0,b.jsonToSVG)({json:Object.assign(Object.assign({},k),{pages:R?[R]:[]}),elementHook:m})},async saveAsSVG({fileName:m,elementHook:A,pageId:L}={}){const k=await I.toSVG({elementHook:A,pageId:L}),R="data:text/svg;base64,"+window.btoa(unescape(encodeURIComponent(k)));(0,_.downloadFile)(R,m||"polotno.svg")},async saveAsPDF(m={}){var{fileName:A}=m,L=a(m,["fileName"]);(await I._toPDF(Object.assign({mimeType:"image/jpeg"},L))).save(A||"polotno.pdf")},async waitLoading({_skipTimeout:m=!1}={}){m||await new Promise(A=>setTimeout(A,50)),await(0,p.whenLoaded)()},toJSON:()=>({width:I.width,height:I.height,fonts:(0,s.getSnapshot)(I.fonts),pages:(0,s.getSnapshot)(I.pages),audios:(0,s.getSnapshot)(I.audios),unit:I.unit,dpi:I.dpi,custom:I.custom}),loadJSON(m,A=!1){var L;const k=Object.assign({},m),R=I.pages.indexOf(I.activePage);let B=(L=k.pages[R]||k.pages[0])===null||L===void 0?void 0:L.id;k._activePageId=B;const X=Object.assign({},(0,s.getSnapshot)(I));Object.assign(X,k),X.history=A?I.history.toJSON():{history:[],undoIdx:-1},(0,s.applySnapshot)(I,X)},clear({keepHistory:m=!1}={}){const A=I.pages.map(L=>L.id);I.deletePages(A),I.custom=null,m||I.history.clear()},addFont(m){I.removeFont(m.fontFamily),I.fonts.push(m),I.loadFont(m.fontFamily)},removeFont(m){I.fonts.filter(A=>A.fontFamily===m).forEach(A=>(0,s.destroy)(A))},addAudio(m){const A=T.Audio.create(Object.assign({id:(0,d.nanoid)(10)},m));I.audios.push(A)},removeAudio(m){const A=I.audios.find(L=>L.id===m);A&&I.audios.remove(A)},async loadFont(m){const A=I.fonts.find(k=>k.fontFamily===m)||S.globalFonts.find(k=>k.fontFamily===m);let L=[{fontStyle:"normal",fontWeight:"normal"}];return A?(A.styles&&(L=A.styles.map(k=>({fontStyle:k.fontStyle||"normal",fontWeight:k.fontWeight||"normal"}))),S.injectCustomFont(A)):S.injectGoogleFont(m),Promise.all(L.map(k=>S.loadFont(m,k.fontStyle,k.fontWeight)))},validate:m=>e.Store.validate(m,[{path:"",type:e.Store}]).map(A=>({path:"store"+A.context.map(L=>L.path).join("."),message:A.message}))})),e.default=j}(Ai)),Ai}var m3;function x_(){return m3||(m3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Node=void 0;const i=eo,t=Gp,n=zv(),a=O_(),l=Td();e.Node=i.types.model("Node",{id:i.types.identifier,type:"none",name:"",opacity:1,custom:i.types.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(s=>{for(var c in s)s[c]===null&&(s[c]=void 0);return s}).postProcessSnapshot(s=>{const c=Object.assign({},s),d={};for(var w in c)w[0]!=="_"&&(d[w]=s[w]);return d}).views(s=>({get locked(){return!(s.draggable||s.contentEditable||s.styleEditable||s.resizable)},get page(){return(0,i.getParentOfType)(s,a.Page)},get store(){return(0,i.getParentOfType)(s,n.Store)},get top(){let c=s;for(;;){if(!(0,i.hasParentOfType)(c,l.GroupElement))return c;c=(0,i.getParentOfType)(c,l.GroupElement)}},get parent(){return(0,i.hasParentOfType)(s,l.GroupElement)?(0,i.getParentOfType)(s,l.GroupElement):(0,i.hasParentOfType)(s,a.Page)?(0,i.getParentOfType)(s,a.Page):(0,i.hasParentOfType)(s,n.Store)?(0,i.getParentOfType)(s,n.Store):null},get zIndex(){return s.parent.children.indexOf(s)}})).actions(s=>({toJSON:()=>Object.assign({},(0,i.getSnapshot)(s))})).actions(s=>({clone(c={},{skipSelect:d=!1}={}){const w=JSON.parse(JSON.stringify(s.toJSON()));return c.id=c.id||(0,t.nanoid)(10),(0,l.forEveryChild)(w,_=>{_.id=(0,t.nanoid)(10)}),Object.assign(w,c),s.page.addElement(w,{skipSelect:d})},set(c){Object.assign(s,c)},moveUp(){s.page.moveElementsUp([s.id])},moveTop(){s.page.moveElementsTop([s.id])},moveDown(){s.page.moveElementsDown([s.id])},moveBottom(){s.page.moveElementsBottom([s.id])},setZIndex(c){s.parent.setElementZIndex(s.id,c)},beforeDestroy(){}}))}(cg)),cg}var wg={},Sg={},y3;function Hx(){return y3||(y3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.registerAnimation=e.animate=e.animations=void 0;const i=Hd(),t={right:{from:{x:-200},to:{x:0}},left:{from:{x:200},to:{x:0}},up:{from:{y:200},to:{y:0}},down:{from:{y:-200},to:{y:0}},"bottom-right":{from:{x:-200,y:-200},to:{x:0,y:0}},"bottom-left":{from:{x:200,y:-200},to:{x:0,y:0}},"top-right":{from:{x:-200,y:200},to:{x:0,y:0}},"top-left":{from:{x:200,y:200},to:{x:0,y:0}}};e.animations={fade:({dTime:l,element:s,animation:c})=>{const d=l/c.duration;return c.type==="enter"?{opacity:d*s.opacity}:{opacity:(1-d)*s.opacity}},rotate:({dTime:l,element:s,animation:c})=>{const d=l/c.duration*360;return(0,i.rotateAroundCenter)({x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation},d)},blink:({dTime:l,element:s,animation:c})=>{const d=c.duration,w=l%d/(d/2),_=w<=1?w:2-w;return{opacity:s.opacity*_}},bounce:({dTime:l,element:s,animation:c})=>{const d=c.duration,w=d/2,_={},E={x:s.x+s.width/3,y:s.y+s.height/3,width:s.width/3,height:s.height/3,fontSize:s.fontSize/3},O={x:s.x,y:s.y,width:s.width,height:s.height,fontSize:s.fontSize},v=l%d/w,S=v<=1?v:2-v;for(let p in E){const h=E[p],P=O[p]-h;_[p]=h+S*P}return _},move:({dTime:l,element:s,animation:c})=>{const d=t[c.data.direction]||t.right,w={};for(var _ in d.from){let E=d.from[_],O=d.to[_];c.type==="exit"&&(E=d.to[_],O=-d.from[_]);const v=s[_]+E,S=s[_]+O-v;w[_]=v+l/c.duration*S}return w},zoom:({dTime:l,element:s,animation:c})=>{const d={},w=((c.data.direction||"in")==="in"?1:-1)>0?.75:1.25,_=s.rotation*Math.PI/180,E=Math.cos(_),O=Math.sin(_),v=s.width*(1-w),S=s.height*(1-w),p=(v*E-S*O)/2,h=(v*O+S*E)/2,P={x:s.x+p,y:s.y+h,width:s.width*w,height:s.height*w,fontSize:s.fontSize*w},g={x:s.x,y:s.y,width:s.width,height:s.height,fontSize:s.fontSize};for(var y in P){let b=P[y],x=g[y];if(c.type==="exit"){const T=b;b=x,x=T}const M=x-b;d[y]=b+l/c.duration*M}return d}};const n=({element:l,dTime:s,animation:c})=>{const d=e.animations[c.name];return d?d({element:l,dTime:s,animation:c}):(console.error("Can not find animation type: "+c.name),{})};e.animate=n;const a=(l,s)=>{};e.registerAnimation=a}(Sg)),Sg}var b3;function Ec(){return b3||(b3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.ShapeFilter=e.getDiff=e.Animation=void 0;const i=eo,t=Hx(),n=No,a=x_();e.Animation=i.types.model("Animation",{delay:0,duration:500,enabled:!0,type:i.types.enumeration("Type",["enter","exit","loop"]),name:"none",data:i.types.frozen({})});const l=(s,c)=>{const d={};for(const w in c)if(typeof s[w]=="number"&&typeof c[w]=="number"){const _=c[w]-s[w];_!==0&&(d[w]=_)}return d};e.getDiff=l,e.ShapeFilter=i.types.model("ShapeFilter",{intensity:1}),e.Shape=a.Node.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:i.types.array(e.Animation),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:i.types.map(e.ShapeFilter),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(s=>{const c=Object.assign(Object.assign({},s),{x:s.x||0,y:s.y||0,filters:Array.isArray(s.filters)?{}:s.filters});return"width"in s&&(c.width=c.width||1),"height"in s&&(c.height=c.height||1),s.locked&&(c.draggable=!1,c.contentEditable=!1,c.styleEditable=!1,c.resizable=!1,c.removable=!1),c}).views(s=>{const c=(0,n.observable)({x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation,opacity:s.opacity,color:s.color,fontSize:s.fontSize}),d=(0,n.action)(_=>{Object.assign(c,_)}),w=(0,n.action)(_=>{for(const E in _)typeof c[E]=="number"&&(c[E]=c[E]+_[E])});return{get a(){const{currentTime:_}=s.store;if(d({x:s.x,y:s.y,width:s.width,height:s.height,rotation:s.rotation,opacity:s.opacity,color:s.color,fontSize:s.fontSize}),_===0)return c;const E=_-s.page.startTime;if(E>s.page.duration||E<0)return c;const O=s.store.animatedElementsIds;if(O.length&&!O.includes(s.id))return c;const v=s.animations.find(g=>g.type==="enter"),S=(v==null?void 0:v.enabled)&&E<v.delay;S&&d({opacity:0});const p=(v==null?void 0:v.enabled)&&E>=v.delay&&E<=v.delay+v.duration;if(p){const g=E-v.delay,y=(0,t.animate)({element:s,animation:v,dTime:g}),b=(0,e.getDiff)(s,y);w(b)}const h=s.animations.find(g=>g.type==="exit");if(!S&&!p&&(h!=null&&h.enabled)&&E>=s.page.duration-h.duration-h.delay&&E<=s.page.duration-h.delay){const g=E-(s.page.duration-h.duration-h.delay),y=(0,t.animate)({element:s,animation:h,dTime:g}),b=(0,e.getDiff)(s,y);w(b)}h!=null&&h.enabled&&E>=s.page.duration-h.delay&&d({opacity:0});const P=s.animations.find(g=>g.type==="loop");if(P!=null&&P.enabled){const g=E,y=(0,t.animate)({element:s,animation:P,dTime:g}),b=(0,e.getDiff)(s,y);w(b)}return c},animated:_=>s.a[_]}}).actions(s=>({setAnimation(c,d){const w=s.animations.find(_=>_.type===c);w?Object.assign(w,d):s.animations.push(Object.assign({type:c},d))},setFilter(c,d){s.filters.clear(),d!==0&&s.filters.set(c,{intensity:d})}}))}(wg)),wg}var Eg={},_3;function Gx(){return _3||(_3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TextElement=void 0;const i=eo,t=Ec();e.TextElement=t.Shape.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:i.types.optional(i.types.union(i.types.number,i.types.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:"#7ED321",backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5}).preProcessSnapshot(n=>Object.assign({},n)).actions(n=>({toggleEditMode(a){n._editModeEnabled=a??!n._editModeEnabled,n._editModeEnabled?n.store.history.startTransaction():n.store.history.endTransaction()}}))}(Eg)),Eg}var Og={},w3;function P_(){return w3||(w3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImageElement=void 0;const i=Ec();e.ImageElement=i.Shape.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,keepRatio:!1,_cropModeEnabled:!1}).actions(t=>({toggleCropMode(n){t._cropModeEnabled=n??!t._cropModeEnabled,t._cropModeEnabled?t.store.history.startTransaction():t.store.history.endTransaction()},beforeDestroy(){t._cropModeEnabled&&t.store.history.endTransaction()}}))}(Og)),Og}var xg={},S3;function Vx(){return S3||(S3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.VideoElement=void 0;const i=P_();e.VideoElement=i.ImageElement.named("Video").props({type:"video",duration:0,startTime:0,endTime:1,volume:1})}(xg)),xg}var Pg={},E3;function $x(){return E3||(E3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LineElement=void 0;const i=eo,t=Ec();e.LineElement=t.Shape.named("Line").props({type:"line",width:400,height:10,color:"black",dash:i.types.array(i.types.number),startHead:"",endHead:""}).actions(n=>({}))}(Pg)),Pg}var Cg={},O3;function Wx(){return O3||(O3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SVGElement=void 0;const i=eo,t=Ec();e.SVGElement=t.Shape.named("SVG").props({type:"svg",src:"",maskSrc:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:i.types.map(i.types.string)}).preProcessSnapshot(n=>Object.assign(Object.assign({},n),{src:n.src||n.svgSource,colorsReplace:Array.isArray(n.colorsReplace)?{}:n.colorsReplace})).actions(n=>({replaceColor(a,l){n.colorsReplace.set(a,l)}}))}(Cg)),Cg}var kg={},x3;function Yx(){return x3||(x3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FigureElement=void 0;const i=eo,t=Ec();e.FigureElement=t.Shape.named("Figure").props({type:"figure",subType:"rect",fill:"rgb(0, 161, 255)",dash:i.types.array(i.types.number),strokeWidth:0,stroke:"rgba(98, 197, 255, 1)",cornerRadius:0})}(kg)),kg}var P3;function Td(){return P3||(P3=1,function(e){var i=md&&md.__rest||function(h,P){var g={};for(var y in h)Object.prototype.hasOwnProperty.call(h,y)&&P.indexOf(y)<0&&(g[y]=h[y]);if(h!=null&&typeof Object.getOwnPropertySymbols=="function"){var b=0;for(y=Object.getOwnPropertySymbols(h);b<y.length;b++)P.indexOf(y[b])<0&&Object.prototype.propertyIsEnumerable.call(h,y[b])&&(g[y[b]]=h[y[b]])}return g};Object.defineProperty(e,"__esModule",{value:!0}),e.TYPES_MAP=e.GroupElement=e.ElementTypes=e.forEveryChild=void 0,e.registerShapeModel=p;const t=eo,n=Gp,a=x_(),l=Ec(),s=Gx(),c=P_(),d=Vx(),w=$x(),_=Wx(),E=Yx(),O=(h,P)=>{if(h.children)for(const g of h.children){if(P(g)===!0)break;(0,e.forEveryChild)(g,P)}};e.forEveryChild=O;const v=[...new Array(20)].map((h,P)=>t.types.late(()=>S[P]));e.ElementTypes=t.types.union({dispatcher:h=>{const P=e.TYPES_MAP[h.type];if(!P)throw new Error(`Unknown element type: "${h.type}"`);return P}},_.SVGElement,s.TextElement,c.ImageElement,w.LineElement,d.VideoElement,E.FigureElement,t.types.late(()=>e.GroupElement),...v),e.GroupElement=a.Node.named("Group").props({type:"group",children:t.types.array(e.ElementTypes)}).views(h=>({get draggable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.draggable||(P=!1)}),P},get resizable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.resizable||(P=!1)}),P},get contentEditable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.contentEditable||(P=!1)}),P},get styleEditable(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.styleEditable||(P=!1)}),P},get locked(){let P=!0;return(0,e.forEveryChild)(h,g=>{g.locked||(P=!1)}),P}})).actions(h=>({set(P){var{draggable:g,contentEditable:y,styleEditable:b,resizable:x}=P,M=i(P,["draggable","contentEditable","styleEditable","resizable"]);g!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({draggable:g})}),y!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({contentEditable:y})}),b!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({styleEditable:b})}),x!==void 0&&(0,e.forEveryChild)(h,T=>{T.set({resizable:x})}),Object.assign(h,M)},addElement(P,{skipSelect:g=!1}={}){const y=e.TYPES_MAP[P.type];if(!y)return void console.error("Can not find model with type "+P.type);P.children&&P.children.forEach(x=>{x.id=(0,n.nanoid)(10)});const b=y.create(Object.assign({id:(0,n.nanoid)(10)},P));return h.children.push(b),b.selectable&&!g&&h.store.selectElements([b.id]),b},setElementZIndex(P,g){const y=h.children.find(b=>b.id===P);y&&((0,t.detach)(y),h.children.remove(y),h.children.splice(g,0,y))}}));const S=[];function p(h,P){const g=h.type;if(!g)throw new Error('You must pass "type" attribute to custom model.');let y=l.Shape.named(g).props(h);P&&(y=P(y)),e.TYPES_MAP[g]=y,S.push(y)}e.TYPES_MAP={svg:_.SVGElement,text:s.TextElement,image:c.ImageElement,group:e.GroupElement,line:w.LineElement,video:d.VideoElement,figure:E.FigureElement}}(md)),md}var C3;function Kx(){return C3||(C3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isClipboardEmpty=e.paste=e.cut=e.copy=void 0;const i=Td();let t=[],n="";const a="polotno_clipboard",l=E=>{t=JSON.parse(JSON.stringify(E));try{localStorage.setItem(a,JSON.stringify(E))}catch{}},s=()=>{try{const E=localStorage.getItem(a);if(E)return JSON.parse(E)}catch{}return t},c=E=>{var O;n=(O=E.activePage)===null||O===void 0?void 0:O.id,l(E.selectedElements.map(v=>v.toJSON()))};e.copy=c;const d=E=>{var O;n=(O=E.activePage)===null||O===void 0?void 0:O.id,l(E.selectedElements.map(S=>S.toJSON()));let v=E.selectedElements.filter(S=>S.removable).map(S=>S.id);E.deleteElements(v)};e.cut=d;const w=E=>{var O,v;let S=0;n===((O=E.activePage)===null||O===void 0?void 0:O.id)&&(S=E.width/20),n=(v=E.activePage)===null||v===void 0?void 0:v.id,E.history.transaction(()=>{const p=[],h=s();(0,i.forEveryChild)({children:h},P=>{delete P.id,P.type!=="group"&&(P.x+=S,P.y+=S)}),h.forEach(P=>{var g;const y=(g=E.activePage)===null||g===void 0?void 0:g.addElement(P);y&&p.push(y.id)}),l(h),E.selectElements(p)})};e.paste=w;const _=()=>s().length===0;e.isClipboardEmpty=_}(ug)),ug}var k3;function Xx(){return k3||(k3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.handleHotkey=t;const i=Kx();function t(n,a){var l,s,c,d;if(((l=document.activeElement)===null||l===void 0?void 0:l.tagName)==="INPUT"||((s=document.activeElement)===null||s===void 0?void 0:s.tagName)==="TEXTAREA"||((c=document.activeElement)===null||c===void 0?void 0:c.contentEditable)==="true")return;const w=a.selectedElements.filter(O=>O.removable).map(O=>O.id);n.keyCode!==46&&n.keyCode!==8||a.deleteElements(w);const _=n.ctrlKey||n.metaKey,E=n.shiftKey;if(_&&!E&&n.code==="KeyZ"&&(n.preventDefault(),a.history.undo()),_&&E&&n.code==="KeyZ"&&(n.preventDefault(),a.history.redo()),_&&n.code==="KeyA"){n.preventDefault();const O=(d=a.activePage)===null||d===void 0?void 0:d.children.filter(S=>S.selectable),v=(O==null?void 0:O.map(S=>S.id))||[];a.selectElements(v)}_&&n.code==="KeyC"&&(n.preventDefault(),(0,i.copy)(a)),_&&n.code==="KeyX"&&(n.preventDefault(),(0,i.cut)(a)),_&&n.code==="KeyV"&&(n.preventDefault(),(0,i.paste)(a)),n.code==="ArrowDown"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({y:O.y+1})})),n.code==="ArrowUp"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({y:O.y-1})})),n.code==="ArrowLeft"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({x:O.x-1})})),n.code==="ArrowRight"&&(n.preventDefault(),a.selectedElements.forEach(O=>{O.draggable&&O.set({x:O.x+1})}))}}(sg)),sg}var Ag={},A3;function Zx(){return A3||(A3=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.t=e.getTranslations=e.setTranslations=void 0;const i=No,t=(0,i.observable)({toolbar:{duration:"Duration",opacity:"Opacity",effects:"Effects",blur:"Blur",textBackground:"Background",backgroundCornerRadius:"Corner radius",backgroundOpacity:"Opacity",backgroundPadding:"Padding",brightness:"Brightness",filters:"Filters",sepia:"Sepia",grayscale:"Grayscale",textStroke:"Text Stroke",shadow:"Shadow",border:"Border",cornerRadius:"Corner Radius",copyStyle:"Copy style",position:"Position",layering:"Layering",toForward:"To forward",up:"Up",down:"Down",toBottom:"To bottom",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignTop:"Align top",alignMiddle:"Align middle",alignBottom:"Align bottom",flip:"Flip",flipHorizontally:"Flip horizontally",flipVertically:"Flip vertically",fitToBackground:"Fit to page",removeBackground:"Remove background",removeBackgroundTitle:"Remove background from image",cancelRemoveBackground:"Cancel",confirmRemoveBackground:"Confirm",crop:"Crop",cropDone:"Done",cropCancel:"Cancel",clip:"Apply mask",removeClip:"Remove mask",removeMask:"Remove mask",transparency:"Transparency",lockedDescription:"Object is locked. Unlock it to allow changes from canvas.",unlockedDescription:"Object is unlocked. Lock it to prevent changes from canvas.",removeElements:"Remove elements",duplicateElements:"Duplicate elements",download:"Download",saveAsImage:"Save as image",saveAsPDF:"Save as PDF",lineHeight:"Line height",letterSpacing:"Letter spacing",offsetX:"Offset X",offsetY:"Offset Y",color:"Color",selectable:"Selectable",draggable:"Draggable",removable:"Removable",resizable:"Resizable",contentEditable:"Can change content",styleEditable:"Can change style",alwaysOnTop:"Always on top",showInExport:"Show in export",ungroupElements:"Ungroup",groupElements:"Group",lineSize:"Line size",fade:"Fade",move:"Move",zoom:"Zoom",animate:"Animate",rotate:"Rotate",none:"None",bounce:"Bounce",blink:"Blink",spaceEvenly:"Space evenly",horizontalDistribution:"Horizontally",verticalDistribution:"Vertically",strokeWidth:"Stroke Width",colorPicker:{solid:"Solid",linear:"Linear"},aiText:{aiWrite:"AI write",rewrite:"Rewrite",shorten:"Shorten",continue:"Continue writing",proofread:"Proofread",tones:"Tones",friendly:"Friendly",professional:"Professional",humorous:"Humorous",formal:"Formal",customPrompt:"Custom prompt",generatedResult:"Generated result",cancel:"Cancel",generate:"Generate",back:"Back",tryAgain:"Try Again",insert:"Insert",promptPlaceholder:"Describe what you want to generate"}},workspace:{noPages:"There are no pages yet...",addPage:"Add page",removePage:"Remove page",duplicatePage:"Duplicate page",moveUp:"Move up",moveDown:"Move down"},scale:{reset:"Reset"},error:{removeBackground:"Ops! Something went wrong. Background can not be removed."},sidePanel:{templates:"Templates",searchTemplatesWithSameSize:"Show templates with the same size",searchPlaceholder:"Search...",otherFormats:"Other formats",noResults:"No results",error:"Loading is failed...",text:"Text",uploadFont:"Upload font",myFonts:"My fonts",photos:"Photos",videos:"Videos",animations:"Animations",effects:"Effects",elements:"Elements",shapes:"Shapes",lines:"Lines",upload:"Upload",uploadImage:"Upload Image",uploadTip:"Do you want to upload your own images?",background:"Background",resize:"Resize",layers:"Layers",layerTypes:{image:"Image",text:"Text",svg:"SVG",line:"Line",figure:"Figure",group:"Group"},layersTip:"Elements on your active page:",noLayers:"No elements on the page...",namePlaceholder:"Type element name...",useMagicResize:"Use magic resize",clipImage:"Mask image",width:"Width",height:"Height",magicResizeDescription:"Magic resize will automatically resize and move all elements on the canvas",headerText:"Header",createHeader:"Create header",subHeaderText:"Sub Header",createSubHeader:"Create sub header",bodyText:"Body text",createBody:"Create body text"},pagesTimeline:{pages:"Pages",removePage:"Remove page",addPage:"Add page",duplicatePage:"Duplicate page",removeAudio:"Remove audio"},contextMenu:{duplicate:"Duplicate",remove:"Remove",lock:"Lock",unlock:"Unlock",copy:"Copy",paste:"Paste",copyStyle:"Copy style",moveUp:"Move up",moveDown:"Move down",moveBack:"Move back",moveForward:"Move forward"}});function n(_,E){var O,v=E.split("."),S=_;for(O=0;O<v.length;++O){if(S[v[O]]==null)return;S=S[v[O]]}return S}const a=_=>_&&typeof _=="object";function l(_,E){Object.keys(E).forEach(O=>{const v=_[O],S=E[O];a(S)&&a(v)?l(v,S):_[O]=S})}function s(_,E,O=""){Object.keys(E).forEach(v=>{const S=E[v],p=O?`${O}.${v}`:v;a(S)?a(_[v])?s(_[v],S,p):console.warn(`Missing nested translation object at '${p}'`):_[v]===void 0&&console.warn(`Missing translation '${p}'`)})}e.setTranslations=(0,i.action)((_,{validate:E=!1}={})=>{E&&s(_,t),l(t,_)});const c=()=>(0,i.toJS)(t);e.getTranslations=c;const d={},w=_=>{const E=n(t,_);if(E!==void 0)return E;d[_]||(d[_]=!0,console.warn(`Missing translation '${_}'`));const O=_.split("."),v=O[O.length-1]||" ";return v.charAt(0).toUpperCase()+v.slice(1)};e.t=w}(Ag)),Ag}var T3;function Qx(){return T3||(T3=1,function(e){var i=vf&&vf.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(e,"__esModule",{value:!0}),e.WorkspaceCanvas=void 0;const t=i(Tn()),n=Qi,a=i(kx()),l=Ax(),s=Tx(),c=Xx(),d=Zx(),w=`Polotno warning: <Workspace /> component can not automatically detect its size.
|
|
319
319
|
Width or height of parent elements is equal 0.
|
|
320
320
|
Please make sure it has non-zero size. You may need to adjust it with your styles. <Workspace /> will automatically fit into parent container.
|
|
321
321
|
For simpler debugging here is the log of the parent element:`,_=(p,h,P,g,y,b)=>{const x=t.default.useRef({width:h,height:P}),M=t.default.useRef({top:0,left:0}),T=t.default.useRef(!1),j=t.default.useRef(y.pages.length);T.current=j.current!==y.pages.length,j.current=y.pages.length,t.default.useEffect(()=>{const I=p.current,m=A=>{M.current={top:I.scrollTop,left:I.scrollLeft}};return I.addEventListener("scroll",m),()=>{I.removeEventListener("scroll",m)}},[]),t.default.useLayoutEffect(()=>{if(!p.current||T.current)return;const I=p.current,m=(M.current.left+I.offsetWidth/2)/x.current.width,A=(M.current.top+I.offsetHeight/2)/x.current.height;b.current=!0,I.scrollLeft=m*h-I.offsetWidth/2,I.scrollTop=A*P-I.offsetHeight/2,x.current={width:h,height:P}},[g,h,P])},E=({element:p,scrollTop:h=0,duration:P=300,onFinish:g=()=>{}})=>{const y=p.scrollTop,b=h-y;let x=0,M=!1;if(P===0)return p.scrollTop=h,()=>{};const T=()=>{if(M)return;x+=20;const I=j(x,y,b,P);p.scrollTop=I,x<P?setTimeout(T,20):g()},j=(I,m,A,L)=>(I/=L/2)<1?A/2*I*I+m:-A/2*(--I*(I-2)-1)+m;return T(),()=>{M=!0}},O=(p,h,P,g,y,b)=>{const x=t.default.useRef(!1),M=t.default.useRef(null),T=t.default.useRef(!1);t.default.useEffect(()=>{const I=p.current,m=()=>{y.current};return I.addEventListener("scroll",m),()=>{I.removeEventListener("scroll",m)}},[]);const j=P.pages.indexOf(P.activePage);return t.default.useLayoutEffect(()=>{if(!P.activePage||!p.current||x.current)return;const I=p.current,m=P.pages.indexOf(P.activePage)*h;let A=()=>{};return(Math.abs(m-I.scrollTop)>.5*h||T.current)&&(T.current=!0,A=E({element:I,scrollTop:m,onFinish:()=>{T.current=!1},duration:P.isPlaying?0:300})),A},[P.activePage,j,P.isPlaying]),{handleScroll:I=>{if(b||T.current)return;x.current=!0,clearTimeout(M.current),M.current=setTimeout(()=>{x.current=!1},300);const m=I.currentTarget.childNodes[0].offsetHeight,A=I.currentTarget.scrollTop,L=Math.floor((A+g.height/3)/m),k=P.pages[L];k&&P.activePage!==k&&k.select()}}},v=({store:p})=>t.default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",textAlign:"center"}},t.default.createElement("p",null,(0,d.t)("workspace.noPages")),t.default.createElement("button",{onClick:()=>{p.addPage()}},(0,d.t)("workspace.addPage"))),S=({width:p,height:h,xPadding:P,yPadding:g,backgroundColor:y})=>t.default.createElement("div",{style:{width:p+"px",height:h+"px",backgroundColor:y,paddingLeft:P+"px",paddingRight:P+"px",paddingTop:g+"px",paddingBottom:g+"px"}},t.default.createElement("div",{style:{width:" 100%",height:"100%",backgroundColor:"white"}}));e.WorkspaceCanvas=(0,n.observer)(({store:p,pageControlsEnabled:h,backgroundColor:P,pageBorderColor:g,activePageBorderColor:y,bleedColor:b,components:x,onKeyDown:M,paddingX:T,paddingY:j,altCloneEnabled:I=!0,visiblePagesOffset:m,renderOnlyActivePage:A})=>{var L;const k=T??20,R=j??55,[B,X]=t.default.useState({width:100,height:100}),Y=t.default.useRef(B),Q=t.default.useRef(null),q=t.default.useRef(null),z=p.bleedVisible?Math.max(0,...p.pages.map(ce=>ce.bleed)):0,N=Math.max(...p.pages.map(ce=>ce.computedWidth)),U=Math.max(...p.pages.map(ce=>ce.computedHeight)),$=((L=p.activePage)===null||L===void 0?void 0:L.computedHeight)||0,ee=N+2*z,G=(A?$:U)+2*z,Z=async({skipTimeout:ce}={skipTimeout:!1})=>{if(ce||await new Promise(at=>setTimeout(at,50)),Q.current===null)return;const pe=Q.current.getBoundingClientRect();pe.width!==0&&pe.height!==0||(console.warn(w),console.log(Q.current));const Ce=q.current.clientWidth||pe.width,Le={width:Ce,height:pe.height};(Y.current.width!==Le.width||Y.current.height!==Le.height)&&(X(Le),Y.current=Le);const ue=(Ce-2*k)/ee,ve=p.pages.length>1?3.1:2,xe=(pe.height-R*ve)/G,je=Math.max(Math.min(ue,xe),.01);p.scaleToFit!==je&&(p.setScale(je),p._setScaleToFit(je))};t.default.useLayoutEffect(()=>{Z({skipTimeout:!0})},[]),t.default.useEffect(()=>{Z()},[ee,G]),t.default.useEffect(()=>{p.__()},[]),t.default.useEffect(()=>{const ce=Q.current;if(window.ResizeObserver){const pe=new ResizeObserver(()=>{Z({skipTimeout:!0})});return pe.observe(ce),()=>pe.unobserve(ce)}{const pe=setInterval(()=>{Z({skipTimeout:!0})},100);return()=>clearInterval(pe)}},[ee,G]);const W=Math.max(k,(B.width-ee*p.scale)/2),te=A?1:p.pages.length,re=G*p.scale*te,ie=Math.max(R,(B.height-re)/te/2);t.default.useEffect(()=>{const ce=pe=>{(M||c.handleHotkey)(pe,p)};return window.addEventListener("keydown",ce),()=>window.removeEventListener("keydown",ce)},[]),t.default.useEffect(()=>{var ce;const pe=Ce=>{if(Ce.ctrlKey||Ce.metaKey){Ce.preventDefault();const xe=Math.max(3,p.scaleToFit),je=Math.min(.1,p.scaleToFit),at=(Le=Ce.deltaY<0?1.05*p.scale:p.scale/1.05,ue=je,ve=xe,Math.max(ue,Math.min(ve,Le)));p.setScale(at)}else var Le,ue,ve};return(ce=q.current)===null||ce===void 0||ce.addEventListener("wheel",pe),()=>{var Ce;return(Ce=q.current)===null||Ce===void 0?void 0:Ce.removeEventListener("wheel",pe)}},[]);const ae=t.default.useRef(!1);_(q,ee*p.scale+2*W,G*p.scale+2*ie,p.scale,p,ae);const{handleScroll:se}=O(q,G*p.scale+2*ie,p,B,ae,A),de=B.width>=ee*p.scale+2*W,he=P||"rgba(232, 232, 232, 0.9)",Oe=p.pages.indexOf(p.activePage),_e=(x==null?void 0:x.NoPages)||v,Ae=m??Math.min(3,Math.max(1,Math.ceil(B.height/2/(G*p.scale))));return t.default.createElement("div",{ref:Q,style:{width:"100%",height:"100%",position:"relative",outline:"none",flex:1,backgroundColor:he},tabIndex:0,className:"polotno-workspace-container"},t.default.createElement("div",{ref:q,onScroll:se,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"auto",overflowX:de?"hidden":"auto"},className:"polotno-workspace-inner"},p.pages.map((ce,pe)=>{const Ce=ce===p.activePage;if(A&&!Ce&&!ce._exportingOrRendering&&!ce._forceMount)return null;if(!(Math.abs(pe-Oe)<=Ae||ce._exportingOrRendering||ce._forceMount))return t.default.createElement(S,{key:ce.id,width:ee*p.scale+2*W,height:G*p.scale+2*ie,backgroundColor:he,xPadding:W,yPadding:ie});const Le=t.default.createElement(a.default,{key:ce.id,page:ce,xPadding:W,yPadding:ie,width:ee*p.scale+2*W,height:G*p.scale+2*ie,store:p,pageControlsEnabled:h,backColor:he,pageBorderColor:g||"lightgrey",activePageBorderColor:y||"rgb(0, 161, 255)",altCloneEnabled:I,bleedColor:b||"rgba(255, 0, 0, 0.1)",components:x});return(ce._exportingOrRendering||ce._forceMount)&&!Ce&&A?t.default.createElement("div",{style:{display:"none"},key:ce.id},Le):Le}),p.rulesVisible&&t.default.createElement(l.TopRules,{store:p,xPadding:W,yPadding:ie,width:ee*p.scale+2*W,height:G*p.scale+2*ie}),p.pages.length===0&&t.default.createElement(_e,{store:p}),p.audios.map(ce=>t.default.createElement(s.AudioElement,{key:ce.id,audio:ce,store:p}))))}),e.default=e.WorkspaceCanvas}(vf)),vf}var Jx=Qx(),eP=zv(),tP=bc(),bd=ts(),Tg=Ks(),nP=Bd();tP.toggleFadeInAnimation(!1);bd.setTextOverflow("change-font-size");const rP=new URLSearchParams(location.search).get("key"),C_=eP.createStore({key:rP});window.store=C_;window.config={addGlobalFont:nP.addGlobalFont,unstable_useHtmlTextRender:bd.useHtmlTextRender,unstable_setTextVerticalResizeEnabled:bd.setTextVerticalResizeEnabled,unstable_setTextOverflow:bd.setTextOverflow,onLoadError:Tg.onLoadError,setAssetLoadTimeout:Tg.setAssetLoadTimeout,setFontLoadTimeout:Tg.setFontLoadTimeout,unstable_setTextSplitAllowed:bd.setTextSplitAllowed};const iP=M3.createRoot(document.getElementById("root"));iP.render(qt.createElement(Jx.WorkspaceCanvas,{visiblePagesOffset:0,store:C_,components:{PageControls:()=>null,Tooltip:()=>null}}));
|
package/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
}
|
|
9
9
|
</style>
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-BCBlQANC.js"></script>
|
|
12
12
|
</head>
|
|
13
13
|
<body>
|
|
14
14
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "polotno-node",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.4",
|
|
4
4
|
"description": "Polotno workflow from NodeJS",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"fluent-ffmpeg": "^2.1.3",
|
|
24
24
|
"pixelmatch": "^6.0.0",
|
|
25
25
|
"pngjs": "^7.0.0",
|
|
26
|
-
"polotno": "^2.
|
|
26
|
+
"polotno": "^2.19.1",
|
|
27
27
|
"react": "^18.3.1",
|
|
28
28
|
"react-dom": "^18.3.1",
|
|
29
29
|
"vite": "^6.0.11"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"author": "Anton Lavrenov",
|
|
32
32
|
"license": "MIT",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@sparticuz/chromium": "^
|
|
34
|
+
"@sparticuz/chromium": "^132.0.0",
|
|
35
35
|
"puppeteer": "^24.1.1",
|
|
36
36
|
"puppeteer-core": "^24.1.1",
|
|
37
37
|
"tmp": "^0.2.3"
|