polotno 2.40.2 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import e from"react";import{observer as t}from"mobx-react-lite";import{Button as l,EditableText as n,Card as i}from"@blueprintjs/core";import{ROLES as a}from"../model/store.js";import{t as r}from"../utils/l10n.js";import{isMobile as o}from"../utils/screen.js";import{ReactSortable as s}from"react-sortablejs";import{removeTags as d}from"../utils/text.js";import{DragHandleVertical as m,Trash as c,Lock as p,Unlock as u,EyeOpen as E,EyeOff as v}from"@blueprintjs/icons";const y=t(({element:t,store:o})=>{const s=o.selectedElements.indexOf(t)>=0,[y,x]=e.useState(!1),g=()=>x(!1),h=y?t.name:t.name||d(t.text)||`#${t.id}`;return e.createElement(i,{onMouseDown:e=>{const l=e.ctrlKey||e.metaKey||e.shiftKey?[...o.selectedElementsIds]:[];l.indexOf(t.id)<0&&l.push(t.id),o.selectElements(l)},className:s?"selected":"",style:{padding:"5px",margin:"0px 1px 5px 1px",backgroundColor:s?"rgb(0, 161, 255, 0.2)":"",display:t.selectable||o.role===a.ADMIN?"auto":"none"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e.createElement("div",{style:{lineHeight:"30px",display:"flex"}},e.createElement("div",{className:"drag-handle",style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"move",height:"30px"}},e.createElement(m,null)),e.createElement("div",{style:{padding:"0 7px",opacity:.5,width:"60px"}},r("sidePanel.layerTypes."+t.type)),e.createElement("div",{style:{maxWidth:"142px"}},e.createElement(n,{minWidth:130,placeholder:r("sidePanel.namePlaceholder"),value:h,maxLines:1,onEdit:()=>x(!0),onCancel:g,onConfirm:g,onChange:e=>{t.set({name:e})}}))),e.createElement("div",null,e.createElement(l,{minimal:!0,icon:(null==t?void 0:t.visible)?e.createElement(E,null):e.createElement(v,null),onClick:()=>{t.set({visible:!t.visible})}}),e.createElement(l,{minimal:!0,icon:(null==t?void 0:t.locked)?e.createElement(p,null):e.createElement(u,null),onClick:()=>{t.set({draggable:t.locked,contentEditable:t.locked,styleEditable:t.locked,resizable:t.locked,removable:t.locked})}}),e.createElement(l,{icon:e.createElement(c,null),minimal:!0,disabled:!t.removable,onClick:()=>{o.deleteElements([t.id])},style:{marginLeft:"auto"}}))))});export const LayersPanel=t(({store:t})=>{var l;const n=(null===(l=t.activePage)||void 0===l?void 0:l.children.map(e=>({id:e.id})))||[];n.reverse();const i=o();return e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement("div",{style:{height:"40px",paddingTop:"5px"}},r("sidePanel.layersTip")),e.createElement("div",null,0===n.length?e.createElement("div",null,r("sidePanel.noLayers")):null,e.createElement(s,{list:n,setList:e=>{const l=e.filter(e=>Boolean(null==e?void 0:e.id));l.forEach(({id:e},n)=>{var i,a;const r=l.length-n-1,o=t.getElementById(e),s=null===(i=t.activePage)||void 0===i?void 0:i.children.indexOf(o);o&&s!==r&&(null===(a=t.activePage)||void 0===a||a.setElementZIndex(o.id,r))})},direction:"horizontal",handle:i?".drag-handle":void 0},n.map(({id:l})=>{const n=t.getElementById(l);return e.createElement(y,{element:n,store:t,key:l})}))))});
1
+ import e from"react";import{observer as t}from"mobx-react-lite";import{Button as l,EditableText as n,Card as i}from"@blueprintjs/core";import{ROLES as a}from"../model/store.js";import{t as r}from"../utils/l10n.js";import{isMobile as o}from"../utils/screen.js";import{ReactSortable as s}from"react-sortablejs";import{removeTags as d}from"../utils/text.js";import{DragHandleVertical as m,Trash as c,Lock as p,Unlock as u,EyeOpen as E,EyeOff as v}from"@blueprintjs/icons";const y=t(({element:t,store:o})=>{const s=o.selectedElements.indexOf(t)>=0,[y,g]=e.useState(!1),x=()=>g(!1),h=y?t.name:t.name||d(t.text)||`#${t.id}`;return e.createElement(i,{onMouseDown:e=>{const l=e.ctrlKey||e.metaKey||e.shiftKey?[...o.selectedElementsIds]:[];l.indexOf(t.id)<0&&l.push(t.id),o.selectElements(l)},className:s?"selected":"",style:{padding:"5px",margin:"0px 1px 5px 1px",backgroundColor:s?"rgb(0, 161, 255, 0.2)":"",display:t.selectable||o.role===a.ADMIN?"auto":"none"}},e.createElement("div",{style:{display:"flex",justifyContent:"space-between"}},e.createElement("div",{style:{lineHeight:"30px",display:"flex"}},e.createElement("div",{className:"drag-handle",style:{display:"flex",justifyContent:"center",alignItems:"center",cursor:"move",height:"30px"}},e.createElement(m,null)),e.createElement("div",{style:{padding:"0 7px",opacity:.5,width:"60px"}},r("sidePanel.layerTypes."+t.type)),e.createElement("div",{style:{maxWidth:"142px"}},e.createElement(n,{minWidth:130,placeholder:r("sidePanel.namePlaceholder"),value:h,maxLines:1,onEdit:()=>g(!0),onCancel:x,onConfirm:x,onChange:e=>{t.set({name:e})}}))),e.createElement("div",null,e.createElement(l,{minimal:!0,icon:(null==t?void 0:t.visible)?e.createElement(E,null):e.createElement(v,null),onClick:()=>{t.set({visible:!t.visible})}}),e.createElement(l,{minimal:!0,icon:(null==t?void 0:t.locked)?e.createElement(p,null):e.createElement(u,null),onClick:()=>{t.set({draggable:t.locked,contentEditable:t.locked,styleEditable:t.locked,resizable:t.locked,removable:t.locked})}}),e.createElement(l,{icon:e.createElement(c,null),minimal:!0,disabled:!t.removable,onClick:()=>{o.deleteElements([t.id])},style:{marginLeft:"auto"}}))))});export const LayersPanel=t(({store:t})=>{var l;const n=(null===(l=t.activePage)||void 0===l?void 0:l.children.map(e=>({id:e.id})))||[];n.reverse();const i=o();return e.createElement("div",{style:{height:"100%",overflow:"auto"}},e.createElement("div",{style:{height:"40px",paddingTop:"5px"}},r("sidePanel.layersTip")),e.createElement("div",null,0===n.length?e.createElement("div",null,r("sidePanel.noLayers")):null,e.createElement(s,{list:n,setList:e=>{const l=e.filter(e=>null!=e&&null!=e.id);l.forEach((e,n)=>{var i,a;const r=l.length-n-1,o=String(e.id),s=t.getElementById(o),d=null===(i=t.activePage)||void 0===i?void 0:i.children.indexOf(s);s&&d!==r&&(null===(a=t.activePage)||void 0===a||a.setElementZIndex(s.id,r))})},direction:"horizontal",handle:i?".drag-handle":void 0},n.map(({id:l})=>{const n=t.getElementById(l);return e.createElement(y,{element:n,store:t,key:l})}))))});
@@ -1 +1 @@
1
- import e from"react";import{observer as t}from"mobx-react-lite";import{Button as l,Menu as o,MenuDivider as n,MenuItem as i,Popover as a,Position as s}from"@blueprintjs/core";import{AlignmentBottom as r,AlignmentHorizontalCenter as c,AlignmentLeft as m,AlignmentRight as d,AlignmentTop as E,AlignmentVerticalCenter as v,ChevronDown as h,ChevronUp as u,DoubleChevronDown as p,DoubleChevronUp as x,HorizontalDistribution as g,Layers as y,VerticalDistribution as b}from"@blueprintjs/icons";import{getClientRect as P}from"../utils/math.js";import{t as f}from"../utils/l10n.js";import{alignBottom as w,alignCenter as D,alignLeft as M,alignMiddle as k,alignRight as C,alignTop as j}from"../utils/alignment.js";const B=e=>{if("group"!==e.type){return P(e)}let t=1/0,l=1/0,o=-1/0,n=-1/0;return e.children.forEach(e=>{const i=B(e);t=Math.min(t,i.x),l=Math.min(l,i.y),o=Math.max(o,i.x+i.width),n=Math.max(n,i.y+i.height)}),{x:t,y:l,width:o-t,height:n-l}},T=(e,t,l)=>{if("group"!==e.type){const o=P(e),n=t-o.x,i=l-o.y;e.set({x:e.x+n,y:e.y+i})}else{const o=t-B(e).x,n=l-B(e).y;e.children.forEach(e=>{const t=B(e);T(e,t.x+o,t.y+n)})}};export const PositionPicker=t(({store:t})=>{var P,F,O,U;const z=t.selectedElements.length>0,H=t.selectedElementsIds,I=t.selectedElements.every(e=>e.draggable),L=I&&t.selectedElements.length>1;return e.createElement(a,{disabled:!z,content:e.createElement(o,{style:{width:"280px"}},e.createElement(n,{title:f("toolbar.layering")}),e.createElement("div",{style:{display:"flex"}},e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(u,null),text:f("toolbar.up"),disabled:!(null===(P=t.activePage)||void 0===P?void 0:P.canMoveElementsUp(H)),onClick:()=>{var e;null===(e=t.activePage)||void 0===e||e.moveElementsUp(H)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(x,null),text:f("toolbar.toForward"),disabled:!(null===(F=t.activePage)||void 0===F?void 0:F.canMoveElementsTop(H)),onClick:()=>{var e;null===(e=t.activePage)||void 0===e||e.moveElementsTop(H)}})),e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(h,null),text:f("toolbar.down"),disabled:!(null===(O=t.activePage)||void 0===O?void 0:O.canMoveElementsDown(H)),onClick:()=>{var e;null===(e=t.activePage)||void 0===e||e.moveElementsDown(H)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(p,null),text:f("toolbar.toBottom"),disabled:!(null===(U=t.activePage)||void 0===U?void 0:U.canMoveElementsBottom(H)),onClick:()=>{var e;null===(e=t.activePage)||void 0===e||e.moveElementsBottom(H)}}))),I&&e.createElement(e.Fragment,null,e.createElement(n,{title:f("toolbar.position")}),e.createElement("div",{style:{display:"flex"}},e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(m,null),text:f("toolbar.alignLeft"),onClick:()=>{M(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(v,null),text:f("toolbar.alignCenter"),onClick:()=>{D(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(d,null),text:f("toolbar.alignRight"),onClick:()=>{C(t)}})),e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(E,null),text:f("toolbar.alignTop"),onClick:()=>{j(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(c,null),text:f("toolbar.alignMiddle"),onClick:()=>{k(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(r,null),text:f("toolbar.alignBottom"),onClick:()=>{w(t)}})))),L&&e.createElement(e.Fragment,null,e.createElement(n,{title:f("toolbar.spaceEvenly")}),e.createElement("div",{style:{display:"flex"}},e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(b,null),text:f("toolbar.verticalDistribution"),onClick:()=>{var e;let l=null===(e=t.activePage)||void 0===e?void 0:e.computedHeight,o=0,n=0;t.selectedElements.forEach(e=>{const t=B(e);l=Math.min(l,t.y),o=Math.max(o,t.y+t.height),n+=t.height});const i=(o-l-n)/(t.selectedElements.length-1),a=t.selectedElements.slice().sort((e,t)=>{const l=B(e),o=B(t);return l.y-o.y});let s=0;a.forEach(e=>{const t=B(e);T(e,t.x,l+s),s+=t.height+i})}})),e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(g,null),text:f("toolbar.horizontalDistribution"),onClick:()=>{var e;let l=null===(e=t.activePage)||void 0===e?void 0:e.computedWidth,o=0,n=0;t.selectedElements.forEach(e=>{const t=B(e);l=Math.min(l,t.x),o=Math.max(o,t.x+t.width),n+=t.width});const i=(o-l-n)/(t.selectedElements.length-1),a=t.selectedElements.slice().sort((e,t)=>{const l=B(e),o=B(t);return l.x-o.x});let s=0;a.forEach(e=>{const t=B(e);T(e,l+s,t.y),s+=t.width+i})}}))))),position:s.BOTTOM},e.createElement(l,{icon:e.createElement(y,null),className:"polotno-position",minimal:!0,text:f("toolbar.position"),disabled:!z}))});
1
+ import e from"react";import{observer as t}from"mobx-react-lite";import{Button as l,Menu as o,MenuDivider as n,MenuItem as i,Popover as s,Position as r}from"@blueprintjs/core";import{AlignmentBottom as c,AlignmentHorizontalCenter as a,AlignmentLeft as m,AlignmentRight as d,AlignmentTop as E,AlignmentVerticalCenter as h,ChevronDown as u,ChevronUp as v,DoubleChevronDown as p,DoubleChevronUp as x,HorizontalDistribution as y,Layers as b,VerticalDistribution as g}from"@blueprintjs/icons";import{getClientRect as f}from"../utils/math.js";import{t as w}from"../utils/l10n.js";import{alignBottom as D,alignCenter as P,alignLeft as M,alignMiddle as k,alignRight as C,alignTop as j}from"../utils/alignment.js";const B=e=>{if("group"!==e.type){return f(e)}let t=1/0,l=1/0,o=-1/0,n=-1/0;return e.children.forEach(e=>{const i=B(e);t=Math.min(t,i.x),l=Math.min(l,i.y),o=Math.max(o,i.x+i.width),n=Math.max(n,i.y+i.height)}),{x:t,y:l,width:o-t,height:n-l}},T=(e,t,l)=>{if("group"!==e.type){const o=f(e),n=t-o.x,i=l-o.y;e.set({x:e.x+n,y:e.y+i})}else{const o=t-B(e).x,n=l-B(e).y;e.children.forEach(e=>{const t=B(e);T(e,t.x+o,t.y+n)})}};export const PositionPicker=t(({store:t})=>{const f=t.selectedElements.length>0,F=t.selectedElements.every(e=>e.draggable),O=F&&t.selectedElements.length>1;return e.createElement(s,{disabled:!f,content:e.createElement(o,{style:{width:"280px"}},e.createElement(n,{title:w("toolbar.layering")}),e.createElement("div",{style:{display:"flex"}},e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(v,null),text:w("toolbar.up"),disabled:!t.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsUp([e.id])}),onClick:()=>t.selectedElements.forEach(e=>e.moveUp())}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(x,null),text:w("toolbar.toForward"),disabled:!t.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsTop([e.id])}),onClick:()=>t.selectedElements.forEach(e=>e.moveTop())})),e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(u,null),text:w("toolbar.down"),disabled:!t.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsDown([e.id])}),onClick:()=>t.selectedElements.forEach(e=>e.moveDown())}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(p,null),text:w("toolbar.toBottom"),disabled:!t.selectedElements.some(e=>{var t;return null===(t=e.parent)||void 0===t?void 0:t.canMoveElementsBottom([e.id])}),onClick:()=>t.selectedElements.forEach(e=>e.moveBottom())}))),F&&e.createElement(e.Fragment,null,e.createElement(n,{title:w("toolbar.position")}),e.createElement("div",{style:{display:"flex"}},e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(m,null),text:w("toolbar.alignLeft"),onClick:()=>{M(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(h,null),text:w("toolbar.alignCenter"),onClick:()=>{P(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(d,null),text:w("toolbar.alignRight"),onClick:()=>{C(t)}})),e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(E,null),text:w("toolbar.alignTop"),onClick:()=>{j(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(a,null),text:w("toolbar.alignMiddle"),onClick:()=>{k(t)}}),e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(c,null),text:w("toolbar.alignBottom"),onClick:()=>{D(t)}})))),O&&e.createElement(e.Fragment,null,e.createElement(n,{title:w("toolbar.spaceEvenly")}),e.createElement("div",{style:{display:"flex"}},e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(g,null),text:w("toolbar.verticalDistribution"),onClick:()=>{var e;let l=null===(e=t.activePage)||void 0===e?void 0:e.computedHeight,o=0,n=0;t.selectedElements.forEach(e=>{const t=B(e);l=Math.min(l,t.y),o=Math.max(o,t.y+t.height),n+=t.height});const i=(o-l-n)/(t.selectedElements.length-1),s=t.selectedElements.slice().sort((e,t)=>{const l=B(e),o=B(t);return l.y-o.y});let r=0;s.forEach(e=>{const t=B(e);T(e,t.x,l+r),r+=t.height+i})}})),e.createElement("div",{style:{width:"50%"}},e.createElement(i,{shouldDismissPopover:!1,icon:e.createElement(y,null),text:w("toolbar.horizontalDistribution"),onClick:()=>{var e;let l=null===(e=t.activePage)||void 0===e?void 0:e.computedWidth,o=0,n=0;t.selectedElements.forEach(e=>{const t=B(e);l=Math.min(l,t.x),o=Math.max(o,t.x+t.width),n+=t.width});const i=(o-l-n)/(t.selectedElements.length-1),s=t.selectedElements.slice().sort((e,t)=>{const l=B(e),o=B(t);return l.x-o.x});let r=0;s.forEach(e=>{const t=B(e);T(e,l+r,t.y),r+=t.width+i})}}))))),position:r.BOTTOM},e.createElement(l,{icon:e.createElement(b,null),className:"polotno-position",minimal:!0,text:w("toolbar.position"),disabled:!f}))});
@@ -1 +1 @@
1
- export function htmlToXhtml(r){const e=(new DOMParser).parseFromString(r,"text/html"),t=new XMLSerializer;let o="";for(const n of Array.from(e.body.childNodes)){o+=t.serializeToString(n)}return o}
1
+ const r=new RegExp("["+String.fromCharCode(0)+"-"+String.fromCharCode(8)+String.fromCharCode(11)+String.fromCharCode(12)+String.fromCharCode(14)+"-"+String.fromCharCode(31)+String.fromCharCode(65534)+String.fromCharCode(65535)+"]","g");export function htmlToXhtml(o){const e=(new DOMParser).parseFromString(o,"text/html"),t=new XMLSerializer;let n="";for(const r of Array.from(e.body.childNodes)){n+=t.serializeToString(r)}return n.replace(r,"")}
@@ -1 +1 @@
1
- import*as e from"mobx";import{getAPI as o}from"./api.js";import{setRemoveBackgroundEnabled as t}from"./flags.js";const n=e.observable({value:!1}),a=e.observable({value:"v1"});export const ___=()=>a.value;const i=e.observable({value:0});export const ____=()=>i.value;export const isCreditVisible=()=>n.value;const r=e.action(()=>{n.value=!0});let s="";export const getKey=()=>s||"";let l="undefined"!=typeof window?window.location.origin:"";const c="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Headless")>-1,d="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Electron")>-1;"file://"===l&&c&&(l="headless"),"file://"===l&&d&&(l="electron");const p=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${l}" here: https://polotno.com/cabinet`;let u=fetch;export const __=e=>{u=e};export async function isKeyPaid(n){for(let s=0;s<5;s++){try{const r=await u(o()+"/validate-key",{method:"POST",body:JSON.stringify({key:n,site:location.host,skdVersion:"2.40.2"})});if(e.runInAction(()=>{a.value=r.headers.get("x-api-version")||""}),!n){return console.error("Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.com/cabinet"),e.runInAction(()=>{i.value=1}),!1}if(200!==r.status){await new Promise(e=>setTimeout(e,3e3));continue}const s=await r.json();return s.is_valid||(console.error("Polotno API key is not valid. Please get new API key here: https://polotno.com/cabinet"),e.runInAction(()=>{i.value=1})),s.is_paid||(console.log("%cPolotno Free Version. For development usage only. https://polotno.com/","background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),e.runInAction(()=>{0===i.value&&(i.value=2)})),s.is_domain_valid||console.log(p,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),t(s.remove_background_enabled),s.is_paid||!1}catch(r){await new Promise(e=>setTimeout(e,3e3))}}return console.error("Can not validate Polotno API key. Please report to anton@polotno.com immediately."),!0}export async function validateKey(e,o){s=e,await isKeyPaid(e)&&!o||r()}
1
+ import*as e from"mobx";import{getAPI as o}from"./api.js";import{setRemoveBackgroundEnabled as t}from"./flags.js";const n=e.observable({value:!1}),a=e.observable({value:"v1"});export const ___=()=>a.value;const i=e.observable({value:0});export const ____=()=>i.value;export const isCreditVisible=()=>n.value;const r=e.action(()=>{n.value=!0});let s="";export const getKey=()=>s||"";let l="undefined"!=typeof window?window.location.origin:"";const c="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Headless")>-1,d="undefined"!=typeof navigator&&navigator.userAgent.indexOf("Electron")>-1;"file://"===l&&c&&(l="headless"),"file://"===l&&d&&(l="electron");const p=`%cPolotno error! Current domain is not allowed. It may lead to unexpected behavior and stop working. Please add "${l}" here: https://polotno.com/cabinet`;let u=fetch;export const __=e=>{u=e};export async function isKeyPaid(n){for(let s=0;s<5;s++){try{const r=await u(o()+"/validate-key",{method:"POST",body:JSON.stringify({key:n,site:location.host,skdVersion:"2.41.0"})});if(e.runInAction(()=>{a.value=r.headers.get("x-api-version")||""}),!n){return console.error("Polotno API is initialized without API key. It may lead to unexpected behavior and stop working. Please create API key here: https://polotno.com/cabinet"),e.runInAction(()=>{i.value=1}),!1}if(200!==r.status){await new Promise(e=>setTimeout(e,3e3));continue}const s=await r.json();return s.is_valid||(console.error("Polotno API key is not valid. Please get new API key here: https://polotno.com/cabinet"),e.runInAction(()=>{i.value=1})),s.is_paid||(console.log("%cPolotno Free Version. For development usage only. https://polotno.com/","background: rgb(0, 161, 255); color: white; padding: 5px; margin: 5px;"),e.runInAction(()=>{0===i.value&&(i.value=2)})),s.is_domain_valid||console.log(p,"background: rgba(247, 101, 68, 1); color: white; padding: 5px; margin: 5px;"),t(s.remove_background_enabled),s.is_paid||!1}catch(r){await new Promise(e=>setTimeout(e,3e3))}}return console.error("Can not validate Polotno API key. Please report to anton@polotno.com immediately."),!0}export async function validateKey(e,o){s=e,await isKeyPaid(e)&&!o||r()}