@chili-publish/studio-sdk 1.34.0 → 1.35.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.
Files changed (73) hide show
  1. package/_bundles/main.es.js +825 -711
  2. package/_bundles/main.es.js.map +1 -1
  3. package/_bundles/main.js +66 -18
  4. package/_bundles/main.js.map +1 -1
  5. package/connector-types/src/Common.d.ts +7 -0
  6. package/connector-types/src/Common.js +9 -0
  7. package/connector-types/src/Common.js.map +1 -0
  8. package/connector-types/src/ComponentConnector.d.ts +28 -0
  9. package/connector-types/src/ComponentConnector.js +3 -0
  10. package/connector-types/src/ComponentConnector.js.map +1 -0
  11. package/connector-types/src/index.d.ts +2 -0
  12. package/connector-types/src/index.js +2 -0
  13. package/connector-types/src/index.js.map +1 -1
  14. package/lib/editor-engine.json +1 -1
  15. package/lib/package.json +1 -1
  16. package/lib/src/controllers/BarcodeController.d.ts +17 -17
  17. package/lib/src/controllers/BarcodeController.js +17 -17
  18. package/lib/src/controllers/ComponentConnectorController.d.ts +64 -0
  19. package/lib/src/controllers/ComponentConnectorController.js +123 -0
  20. package/lib/src/controllers/ComponentConnectorController.js.map +1 -0
  21. package/lib/src/controllers/ComponentController.d.ts +28 -0
  22. package/lib/src/controllers/ComponentController.js +63 -0
  23. package/lib/src/controllers/ComponentController.js.map +1 -0
  24. package/lib/src/controllers/FrameController.d.ts +21 -3
  25. package/lib/src/controllers/FrameController.js +32 -3
  26. package/lib/src/controllers/FrameController.js.map +1 -1
  27. package/lib/src/controllers/LayoutController.d.ts +1 -1
  28. package/lib/src/controllers/LayoutController.js.map +1 -1
  29. package/lib/src/controllers/SubscriberController.js.map +1 -1
  30. package/lib/src/controllers/UtilsController.d.ts +1 -1
  31. package/lib/src/controllers/UtilsController.js.map +1 -1
  32. package/lib/src/index.d.ts +4 -3
  33. package/lib/src/index.js +4 -3
  34. package/lib/src/index.js.map +1 -1
  35. package/lib/src/interactions/Connector.d.ts +1 -1
  36. package/lib/src/interactions/Connector.js +97 -19
  37. package/lib/src/interactions/Connector.js.map +1 -1
  38. package/lib/src/next/types/ConnectorTypes.d.ts +5 -1
  39. package/lib/src/next/types/ConnectorTypes.js +4 -0
  40. package/lib/src/next/types/ConnectorTypes.js.map +1 -1
  41. package/lib/src/sdk.d.ts +8 -1
  42. package/lib/src/sdk.js +10 -1
  43. package/lib/src/sdk.js.map +1 -1
  44. package/lib/src/tests/controllers/ComponentConnectorController.test.js +73 -0
  45. package/lib/src/tests/controllers/ComponentConnectorController.test.js.map +1 -0
  46. package/lib/src/tests/controllers/ComponentController.test.js +52 -0
  47. package/lib/src/tests/controllers/ComponentController.test.js.map +1 -0
  48. package/lib/src/tests/controllers/FrameConstraintController.test.js +32 -8
  49. package/lib/src/tests/controllers/FrameConstraintController.test.js.map +1 -1
  50. package/lib/src/tests/controllers/FrameController.test.js +8 -1
  51. package/lib/src/tests/controllers/FrameController.test.js.map +1 -1
  52. package/lib/src/tests/controllers/LayoutController.test.js +1 -1
  53. package/lib/src/tests/controllers/LayoutController.test.js.map +1 -1
  54. package/lib/src/tests/controllers/UtilsController.test.js +1 -1
  55. package/lib/src/tests/controllers/UtilsController.test.js.map +1 -1
  56. package/lib/src/types/CommonTypes.d.ts +5 -0
  57. package/lib/src/types/CommonTypes.js.map +1 -1
  58. package/lib/src/types/ComponentConnectorTypes.d.ts +9 -0
  59. package/lib/src/types/ComponentConnectorTypes.js +10 -0
  60. package/lib/src/types/ComponentConnectorTypes.js.map +1 -0
  61. package/lib/src/types/ConfigurationTypes.d.ts +2 -2
  62. package/lib/src/types/ConfigurationTypes.js +2 -2
  63. package/lib/src/types/ConfigurationTypes.js.map +1 -1
  64. package/lib/src/types/ConnectorTypes.d.ts +5 -1
  65. package/lib/src/types/ConnectorTypes.js +4 -0
  66. package/lib/src/types/ConnectorTypes.js.map +1 -1
  67. package/lib/src/types/FrameTypes.d.ts +35 -16
  68. package/lib/src/types/FrameTypes.js +5 -0
  69. package/lib/src/types/FrameTypes.js.map +1 -1
  70. package/lib/src/types/LayoutTypes.d.ts +2 -7
  71. package/lib/src/types/LayoutTypes.js +1 -8
  72. package/lib/src/types/LayoutTypes.js.map +1 -1
  73. package/package.json +1 -1
package/_bundles/main.js CHANGED
@@ -1,21 +1,69 @@
1
- (function(h,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(h=typeof globalThis<"u"?globalThis:h||self,D(h.StudioSDK=h.StudioSDK||{}))})(this,function(h){"use strict";var Br=h=>{throw TypeError(h)};var Gr=(h,D,R)=>D.has(h)||Br("Cannot "+R);var a=(h,D,R)=>(Gr(h,D,"read from private field"),R?R.call(h):D.get(h)),g=(h,D,R)=>D.has(h)?Br("Cannot add the same private member more than once"):D instanceof WeakSet?D.add(h):D.set(h,R),y=(h,D,R,oe)=>(Gr(h,D,"write to private field"),oe?oe.call(h,R):D.set(h,R),R);var V,M,z,N,it,B,ot,xt,G,J,Dt,mt,wr,wt,ft,ct,Ht,ht,Kt,lt,St,U,dt,Ot,E,Lt,d,Q,f,$t,X,zt,O,Wt,fr,k,bt,Mt,tt,W,jt,ut,qt,Nt,Yt,Zt,w,Rt,Vt,Sr,gt,et,vt,Tt,ie,yt,Bt,_;const R={current:"2.17.latest"},Se={version:"1.34.0"};var j;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})(j||(j={}));var pt;(function(s){s.Fulfilled="fulfilled",s.Rejected="rejected"})(pt||(pt={}));var Ut;(function(s){s.ConnectionDestroyed="ConnectionDestroyed",s.ConnectionTimeout="ConnectionTimeout",s.NoIframeSrc="NoIframeSrc"})(Ut||(Ut={}));var ce;(function(s){s.DataCloneError="DataCloneError"})(ce||(ce={}));var nt;(function(s){s.Message="message"})(nt||(nt={}));const Jr=(s,o)=>{const t=[];let e=!1;return{destroy(r){e||(e=!0,o(`${s}: Destroying connection`),t.forEach(n=>{n(r)}))},onDestroy(r){e?r():t.push(r)}}},Ur=s=>(...o)=>{s&&console.log("[Penpal]",...o)},kr={"http:":"80","https:":"443"},_r=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,xr=["file:","data:"],Hr=s=>{if(s&&xr.find(u=>s.startsWith(u)))return"null";const o=document.location,t=_r.exec(s);let e,r,n;t?(e=t[1]?t[1]:o.protocol,r=t[2],n=t[4]):(e=o.protocol,r=o.hostname,n=o.port);const c=n&&n!==kr[e]?`:${n}`:"";return`${e}//${r}${c}`},be=({name:s,message:o,stack:t})=>({name:s,message:o,stack:t}),Kr=s=>{const o=new Error;return Object.keys(s).forEach(t=>o[t]=s[t]),o},$r=(s,o,t)=>{const{localName:e,local:r,remote:n,originForSending:c,originForReceiving:u}=s;let l=!1;const C=p=>{if(p.source!==n||p.data.penpal!==j.Call)return;if(p.origin!==u){t(`${e} received message from origin ${p.origin} which did not match expected origin ${u}`);return}const I=p.data,{methodName:b,args:v,id:P}=I;t(`${e}: Received ${b}() call`);const A=S=>x=>{if(t(`${e}: Sending ${b}() reply`),l){t(`${e}: Unable to send ${b}() reply due to destroyed connection`);return}const L={penpal:j.Reply,id:P,resolution:S,returnValue:x};S===pt.Rejected&&x instanceof Error&&(L.returnValue=be(x),L.returnValueIsError=!0);try{n.postMessage(L,c)}catch(F){if(F.name===ce.DataCloneError){const st={penpal:j.Reply,id:P,resolution:pt.Rejected,returnValue:be(F),returnValueIsError:!0};n.postMessage(st,c)}throw F}};new Promise(S=>S(o[b].apply(o,v))).then(A(pt.Fulfilled),A(pt.Rejected))};return r.addEventListener(nt.Message,C),()=>{l=!0,r.removeEventListener(nt.Message,C)}};let zr=0;const Wr=()=>++zr,ve=".",Ie=s=>s?s.split(ve):[],jr=s=>s.join(ve),qr=(s,o)=>{const t=Ie(o||"");return t.push(s),jr(t)},Yr=(s,o,t)=>{const e=Ie(o);return e.reduce((r,n,c)=>(typeof r[n]>"u"&&(r[n]={}),c===e.length-1&&(r[n]=t),r[n]),s),s},Ae=(s,o)=>{const t={};return Object.keys(s).forEach(e=>{const r=s[e],n=qr(e,o);typeof r=="object"&&Object.assign(t,Ae(r,n)),typeof r=="function"&&(t[n]=r)}),t},Zr=s=>{const o={};for(const t in s)Yr(o,t,s[t]);return o},Qr=(s,o,t,e,r)=>{const{localName:n,local:c,remote:u,originForSending:l,originForReceiving:C}=o;let p=!1;r(`${n}: Connecting call sender`);const I=v=>(...P)=>{r(`${n}: Sending ${v}() call`);let A;try{u.closed&&(A=!0)}catch{A=!0}if(A&&e(),p){const S=new Error(`Unable to send ${v}() call due to destroyed connection`);throw S.code=Ut.ConnectionDestroyed,S}return new Promise((S,x)=>{const L=Wr(),F=rt=>{if(rt.source!==u||rt.data.penpal!==j.Reply||rt.data.id!==L)return;if(rt.origin!==C){r(`${n} received message from origin ${rt.origin} which did not match expected origin ${C}`);return}const Gt=rt.data;r(`${n}: Received ${v}() reply`),c.removeEventListener(nt.Message,F);let Jt=Gt.returnValue;Gt.returnValueIsError&&(Jt=Kr(Jt)),(Gt.resolution===pt.Fulfilled?S:x)(Jt)};c.addEventListener(nt.Message,F);const st={penpal:j.Call,id:L,methodName:v,args:P};u.postMessage(st,l)})},b=t.reduce((v,P)=>(v[P]=I(P),v),{});return Object.assign(s,Zr(b)),()=>{p=!0}},Xr=(s,o,t,e,r)=>{const{destroy:n,onDestroy:c}=e;let u,l;const C={};return p=>{if(p.origin!==o){r(`Parent: Handshake - Received ACK message from origin ${p.origin} which did not match expected origin ${o}`);return}r("Parent: Handshake - Received ACK");const I={localName:"Parent",local:window,remote:p.source,originForSending:t,originForReceiving:o};u&&u(),u=$r(I,s,r),c(u),l&&l.forEach(v=>{delete C[v]}),l=p.data.methodNames;const b=Qr(C,I,l,n,r);return c(b),C}},tn=(s,o,t,e)=>r=>{if(r.origin!==t){s(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${t}`);return}s("Parent: Handshake - Received SYN, responding with SYN-ACK");const n={penpal:j.SynAck,methodNames:Object.keys(o)};r.source.postMessage(n,e)},en=6e4,sn=(s,o)=>{const{destroy:t,onDestroy:e}=o,r=setInterval(()=>{s.isConnected||(clearInterval(r),t())},en);e(()=>{clearInterval(r)})},rn=(s,o)=>{let t;return s!==void 0&&(t=window.setTimeout(()=>{const e=new Error(`Connection timed out after ${s}ms`);e.code=Ut.ConnectionTimeout,o(e)},s)),()=>{clearTimeout(t)}},nn=s=>{if(!s.src&&!s.srcdoc){const o=new Error("Iframe must have src or srcdoc property defined.");throw o.code=Ut.NoIframeSrc,o}},an=s=>{let{iframe:o,methods:t={},childOrigin:e,timeout:r,debug:n=!1}=s;const c=Ur(n),u=Jr("Parent",c),{onDestroy:l,destroy:C}=u;e||(nn(o),e=Hr(o.src));const p=e==="null"?"*":e,I=Ae(t),b=tn(c,I,e,p),v=Xr(I,e,p,u,c);return{promise:new Promise((A,S)=>{const x=rn(r,C),L=F=>{if(!(F.source!==o.contentWindow||!F.data)){if(F.data.penpal===j.Syn){b(F);return}if(F.data.penpal===j.Ack){const st=v(F);st&&(x(),A(st));return}}};window.addEventListener(nt.Message,L),c("Parent: Awaiting handshake"),sn(o,u),l(F=>{window.removeEventListener(nt.Message,L),F&&S(F)})}),destroy(){C()}}},on=s=>{const o=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w]+\/$/);let t="";return o.test(s)?t=s:s.indexOf("/index.html")>-1?t=s.replace("/index.html","/"):s.charAt(-1)!=="/"&&(t=`${s}/`),t},cn=(s,o,t)=>{const e=on(o),n=`<html>
2
- <head>
3
- <base href="/" />
1
+ (function(h,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(h=typeof globalThis<"u"?globalThis:h||self,D(h.StudioSDK=h.StudioSDK||{}))})(this,function(h){"use strict";var $r=h=>{throw TypeError(h)};var zr=(h,D,R)=>D.has(h)||$r("Cannot "+R);var a=(h,D,R)=>(zr(h,D,"read from private field"),R?R.call(h):D.get(h)),g=(h,D,R)=>D.has(h)?$r("Cannot add the same private member more than once"):D instanceof WeakSet?D.add(h):D.set(h,R),y=(h,D,R,de)=>(zr(h,D,"write to private field"),de?de.call(h,R):D.set(h,R),R);var V,M,z,N,it,B,ot,Kt,G,J,Ot,wt,Er,mt,ft,ct,$t,ht,zt,lt,St,U,dt,Lt,E,Mt,u,W,f,Wt,X,jt,O,qt,Dr,k,bt,Nt,tt,j,Yt,ut,Zt,Rt,Qt,Xt,m,Vt,Tt,Or,gt,et,vt,Bt,le,yt,Gt,_,It,te,Jt;const R={current:"2.18.latest"},Pe={version:"1.35.0"};var q;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})(q||(q={}));var pt;(function(s){s.Fulfilled="fulfilled",s.Rejected="rejected"})(pt||(pt={}));var _t;(function(s){s.ConnectionDestroyed="ConnectionDestroyed",s.ConnectionTimeout="ConnectionTimeout",s.NoIframeSrc="NoIframeSrc"})(_t||(_t={}));var ue;(function(s){s.DataCloneError="DataCloneError"})(ue||(ue={}));var nt;(function(s){s.Message="message"})(nt||(nt={}));const Wr=(s,o)=>{const t=[];let e=!1;return{destroy(r){e||(e=!0,o(`${s}: Destroying connection`),t.forEach(n=>{n(r)}))},onDestroy(r){e?r():t.push(r)}}},jr=s=>(...o)=>{s&&console.log("[Penpal]",...o)},qr={"http:":"80","https:":"443"},Yr=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,Zr=["file:","data:"],Qr=s=>{if(s&&Zr.find(l=>s.startsWith(l)))return"null";const o=document.location,t=Yr.exec(s);let e,r,n;t?(e=t[1]?t[1]:o.protocol,r=t[2],n=t[4]):(e=o.protocol,r=o.hostname,n=o.port);const c=n&&n!==qr[e]?`:${n}`:"";return`${e}//${r}${c}`},Fe=({name:s,message:o,stack:t})=>({name:s,message:o,stack:t}),Xr=s=>{const o=new Error;return Object.keys(s).forEach(t=>o[t]=s[t]),o},tn=(s,o,t)=>{const{localName:e,local:r,remote:n,originForSending:c,originForReceiving:l}=s;let d=!1;const C=p=>{if(p.source!==n||p.data.penpal!==q.Call)return;if(p.origin!==l){t(`${e} received message from origin ${p.origin} which did not match expected origin ${l}`);return}const I=p.data,{methodName:S,args:v,id:P}=I;t(`${e}: Received ${S}() call`);const A=b=>H=>{if(t(`${e}: Sending ${S}() reply`),d){t(`${e}: Unable to send ${S}() reply due to destroyed connection`);return}const L={penpal:q.Reply,id:P,resolution:b,returnValue:H};b===pt.Rejected&&H instanceof Error&&(L.returnValue=Fe(H),L.returnValueIsError=!0);try{n.postMessage(L,c)}catch(F){if(F.name===ue.DataCloneError){const st={penpal:q.Reply,id:P,resolution:pt.Rejected,returnValue:Fe(F),returnValueIsError:!0};n.postMessage(st,c)}throw F}};new Promise(b=>b(o[S].apply(o,v))).then(A(pt.Fulfilled),A(pt.Rejected))};return r.addEventListener(nt.Message,C),()=>{d=!0,r.removeEventListener(nt.Message,C)}};let en=0;const sn=()=>++en,Ee=".",De=s=>s?s.split(Ee):[],rn=s=>s.join(Ee),nn=(s,o)=>{const t=De(o||"");return t.push(s),rn(t)},an=(s,o,t)=>{const e=De(o);return e.reduce((r,n,c)=>(typeof r[n]>"u"&&(r[n]={}),c===e.length-1&&(r[n]=t),r[n]),s),s},Oe=(s,o)=>{const t={};return Object.keys(s).forEach(e=>{const r=s[e],n=nn(e,o);typeof r=="object"&&Object.assign(t,Oe(r,n)),typeof r=="function"&&(t[n]=r)}),t},on=s=>{const o={};for(const t in s)an(o,t,s[t]);return o},cn=(s,o,t,e,r)=>{const{localName:n,local:c,remote:l,originForSending:d,originForReceiving:C}=o;let p=!1;r(`${n}: Connecting call sender`);const I=v=>(...P)=>{r(`${n}: Sending ${v}() call`);let A;try{l.closed&&(A=!0)}catch{A=!0}if(A&&e(),p){const b=new Error(`Unable to send ${v}() call due to destroyed connection`);throw b.code=_t.ConnectionDestroyed,b}return new Promise((b,H)=>{const L=sn(),F=rt=>{if(rt.source!==l||rt.data.penpal!==q.Reply||rt.data.id!==L)return;if(rt.origin!==C){r(`${n} received message from origin ${rt.origin} which did not match expected origin ${C}`);return}const Ut=rt.data;r(`${n}: Received ${v}() reply`),c.removeEventListener(nt.Message,F);let kt=Ut.returnValue;Ut.returnValueIsError&&(kt=Xr(kt)),(Ut.resolution===pt.Fulfilled?b:H)(kt)};c.addEventListener(nt.Message,F);const st={penpal:q.Call,id:L,methodName:v,args:P};l.postMessage(st,d)})},S=t.reduce((v,P)=>(v[P]=I(P),v),{});return Object.assign(s,on(S)),()=>{p=!0}},hn=(s,o,t,e,r)=>{const{destroy:n,onDestroy:c}=e;let l,d;const C={};return p=>{if(p.origin!==o){r(`Parent: Handshake - Received ACK message from origin ${p.origin} which did not match expected origin ${o}`);return}r("Parent: Handshake - Received ACK");const I={localName:"Parent",local:window,remote:p.source,originForSending:t,originForReceiving:o};l&&l(),l=tn(I,s,r),c(l),d&&d.forEach(v=>{delete C[v]}),d=p.data.methodNames;const S=cn(C,I,d,n,r);return c(S),C}},ln=(s,o,t,e)=>r=>{if(r.origin!==t){s(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${t}`);return}s("Parent: Handshake - Received SYN, responding with SYN-ACK");const n={penpal:q.SynAck,methodNames:Object.keys(o)};r.source.postMessage(n,e)},dn=6e4,un=(s,o)=>{const{destroy:t,onDestroy:e}=o,r=setInterval(()=>{s.isConnected||(clearInterval(r),t())},dn);e(()=>{clearInterval(r)})},gn=(s,o)=>{let t;return s!==void 0&&(t=window.setTimeout(()=>{const e=new Error(`Connection timed out after ${s}ms`);e.code=_t.ConnectionTimeout,o(e)},s)),()=>{clearTimeout(t)}},yn=s=>{if(!s.src&&!s.srcdoc){const o=new Error("Iframe must have src or srcdoc property defined.");throw o.code=_t.NoIframeSrc,o}},pn=s=>{let{iframe:o,methods:t={},childOrigin:e,timeout:r,debug:n=!1}=s;const c=jr(n),l=Wr("Parent",c),{onDestroy:d,destroy:C}=l;e||(yn(o),e=Qr(o.src));const p=e==="null"?"*":e,I=Oe(t),S=ln(c,I,e,p),v=hn(I,e,p,l,c);return{promise:new Promise((A,b)=>{const H=gn(r,C),L=F=>{if(!(F.source!==o.contentWindow||!F.data)){if(F.data.penpal===q.Syn){S(F);return}if(F.data.penpal===q.Ack){const st=v(F);st&&(H(),A(st));return}}};window.addEventListener(nt.Message,L),c("Parent: Awaiting handshake"),un(o,l),d(F=>{window.removeEventListener(nt.Message,L),F&&b(F)})}),destroy(){C()}}},Cn=s=>{const o=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w]+\/$/);let t="";return o.test(s)?t=s:s.indexOf("/index.html")>-1?t=s.replace("/index.html","/"):s.charAt(-1)!=="/"&&(t=`${s}/`),t},wn=(s,o,t)=>{const e=Cn(o),n=`<html>
2
+ <head>
3
+ <base href="/" />
4
4
  <meta charset="UTF-8"/>
5
- <!-- use this property to pass the StudioStyling to the engine -->
5
+ <!-- use this property to pass the StudioStyling to the engine -->
6
6
  <meta name="studio-styling" content='${JSON.stringify(t||{})}'>
7
- </head>
8
- <body>
9
- <script>
10
- <\/script>
11
- <script src="${e}init.js" async><\/script>
12
- <script src="${e}flutter_bootstrap.js"><\/script>
13
- <script>
14
- initializeStudioEngine({
15
- assetBase: '${e}',
16
- });
17
- <\/script>
18
- </body>
19
- </html>
20
- `;s.srcdoc=n},hn=(s,o,t,e="chili-editor",r)=>{const n=`#${e}`,c=document.createElement("iframe");c.setAttribute("srcdoc"," "),c.setAttribute("title","Chili-Editor"),c.setAttribute("style","width: 100%; height: 100%;"),c.setAttribute("frameBorder","0"),c.setAttribute("referrerpolicy","origin");const u=()=>{const l=document.querySelector(n);l&&(l==null||l.appendChild(c),cn(c,s,r))};document.readyState==="complete"||document.readyState==="interactive"?u():document.addEventListener("DOMContentLoaded",()=>{u()}),t(an({iframe:c,methods:{actionsChanged:o.onActionsChanged,stateChanged:o.onStateChanged,documentLoaded:o.onDocumentLoaded,authExpired:o.onAuthExpired,viewportRequested:o.onViewportRequested,selectedFramesContent:o.onSelectedFramesContentChanged,selectedFramesLayout:o.onSelectedFramesLayoutChanged,allFramesLayout:o.onFramesLayoutChanged,selectedLayoutProperties:o.onSelectedLayoutPropertiesChanged,openLayoutPropertiesPanel:o.onPageSelectionChanged,selectedLayoutUnit:o.onSelectedLayoutUnitChanged,scrubberPositionChanged:o.onScrubberPositionChanged,frameAnimationsChanged:o.onFrameAnimationsChanged,selectedToolChanged:o.onSelectedToolChanged,variableListChanged:o.onVariableListChanged,undoStackStateChanged:o.onUndoStateChanged,selectedLayoutFramesChanged:o.onSelectedLayoutFramesChanged,selectedTextStyleChanged:o.onSelectedTextStyleChanged,colorsChanged:o.onColorsChanged,paragraphStylesChanged:o.onParagraphStylesChanged,characterStylesChanged:o.onCharacterStylesChanged,fontFamiliesChanged:o.onFontFamiliesChanged,selectedLayoutId:o.onSelectedLayoutIdChanged,layoutListChanged:o.onLayoutsChanged,connectorEvent:o.onConnectorEvent,connectorsChanged:o.onConnectorsChanged,zoomChanged:o.onZoomChanged,pageSnapshotInvalidated:o.onPageSnapshotInvalidated,pagesChanged:o.onPagesChanged,pageSizeChanged:o.onPageSizeChanged,shapeCornerRadiusChanged:o.onShapeCornerRadiusChanged,cropActiveFrameIdChanged:o.onCropActiveFrameIdChanged,asyncError:o.onAsyncError,viewModeChanged:o.onViewModeChanged,barcodeValidationChanged:o.onBarcodeValidationChanged,selectedPageIdChanged:o.onSelectedPageIdChanged,dataSourceIdChanged:o.onDataSourceIdChanged,documentIssueListChanged:o.onDocumentIssueListChanged,customUndoDataChanged:o.onCustomUndoDataChanged,engineEditingModeChanged:o.onEngineEditModeChanged,brandKitMediaChanged:o.onBrandKitMediaChanged}}))};var q=(s=>(s.GraFxStudioEnvironmentApiUrl="ENVIRONMENT_API",s.GraFxStudioSdkVersion="SDK_VERSION",s.GraFxStudioDocumentType="DOCUMENT_TYPE",s.GraFxStudioTemplateId="TEMPLATE_ID",s.GraFxStudioAuthToken="GRAFX_AUTH_TOKEN",s.QueryCallCacheEnabled="ENABLE_QUERY_CALL_CACHE",s))(q||{});const ln={shortcutOptions:{debugPanel:{enabled:!1},ellipse:{enabled:!1},hand:{enabled:!1},image:{enabled:!1},polygon:{enabled:!1},rectangle:{enabled:!1},select:{enabled:!1},text:{enabled:!1},zoom:{enabled:!1},copyPaste:{enabled:!1},viewMode:{enabled:!1}},frameEditingMode:0};var Pe=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(Pe||{}),he=(s=>(s.project="project",s.template="template",s.component="component",s))(he||{});const dn=404075;function Fe(s){const o=s.error??"Yikes, something went wrong",t={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===dn){const r=JSON.parse(s.data).statusCode;throw new Ee(r,o,t)}else throw new Error(o,t)}function i(s,o=!0){try{s.success||Fe(s);const t=s.data&&o;return{...s,parsedData:t?JSON.parse(s.data):s.data}}catch(t){throw console.error(t),t}}class Ee extends Error{constructor(o,t,e){super(t,e),this.statusCode=o}}class De{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getActions().then(e=>i(e)),this.getById=async t=>(await a(this,V)).getActionById(t).then(r=>i(r)),this.create=async()=>(await a(this,V)).createAction().then(e=>i(e)),this.duplicate=async t=>(await a(this,V)).duplicateAction(t).then(r=>i(r)),this.remove=async t=>(await a(this,V)).removeAction(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,V)).updateAction(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>this.update(t,{name:e}),this.updateScript=async(t,e)=>this.update(t,{script:e}),this.updateTriggers=async(t,e)=>this.update(t,{triggers:e}),this.move=async(t,e)=>(await a(this,V)).moveActions(t,e).then(n=>i(n)),this.setTypeError=async(t,e)=>this.update(t,{hasTypeError:e}),this.disable=async()=>(await a(this,V)).disableActions().then(e=>i(e)),this.enable=async()=>(await a(this,V)).enableActions().then(e=>i(e)),y(this,V,o)}}V=new WeakMap;class Oe{constructor(o){g(this,M);this.getAllOnSelectedLayout=async()=>(await a(this,M)).getAnimationsOnSelectedLayout().then(e=>i(e)),this.getByFrameId=async(t,e)=>(await a(this,M)).getAnimationByFrameId(t,e).then(n=>i(n)),this.getByLayoutId=async t=>(await a(this,M)).getAnimationsByLayoutId(t).then(r=>i(r)),this.setFrameAnimation=async t=>(await a(this,M)).setFrameAnimation(JSON.stringify(t)).then(r=>i({...r,data:JSON.stringify(t)})),this.play=async()=>(await a(this,M)).playAnimation().then(e=>i(e)),this.pause=async()=>(await a(this,M)).pauseAnimation().then(e=>i(e)),this.setScrubberPosition=async t=>(await a(this,M)).setScrubberPosition(t).then(r=>i(r)),this.setDuration=async t=>(await a(this,M)).setAnimationDuration(t).then(r=>i(r)),this.resetFrameAnimation=async t=>(await a(this,M)).resetFrameAnimation(t).then(r=>i(r)),this.reset=async()=>(await a(this,M)).resetAnimation().then(e=>i(e)),y(this,M,o)}}M=new WeakMap;var H=(s=>(s.code39="code39",s.code93="code93",s.code128="code128",s.dataMatrix="dataMatrix",s.ean13="ean13",s.ean8="ean8",s.qr="qr",s.upca="upca",s.upce="upce",s.gs1128="gs1128",s))(H||{}),It=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(It||{}),Ct=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(Ct||{}),Le=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Le||{}),Y=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(Y||{}),Me=(s=>(s.top="top",s.child="child",s))(Me||{}),Ne=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(Ne||{}),Re=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(Re||{}),Ve=(s=>(s.locked="locked",s.range="range",s.none="none",s))(Ve||{});class Te{constructor(o){g(this,z);this.setBarcodeProperties=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableBackground=async(t,e)=>{const r={enableBackground:e};return this.setBarcodeProperties(t,r)},this.setBackgroundColor=async(t,e)=>{const r={backgroundColor:e};return this.setBarcodeProperties(t,r)},this.setEnableBars=async(t,e)=>{const r={enableBars:e};return this.setBarcodeProperties(t,r)},this.setBarColor=async(t,e)=>{const r={barColor:e};return this.setBarcodeProperties(t,r)},this.setBarcodeSource=async(t,e)=>(await a(this,z)).setBarcodeSource(t,JSON.stringify(e)).then(n=>i(n)),this.removeBarcodeSource=async t=>(await a(this,z)).setBarcodeSource(t,null).then(r=>i(r)),this.setEnableText=async(t,e)=>{const r={enableText:e};return this.setBarcodeProperties(t,r)},this.setBarHeight=async(t,e)=>{const r={barHeight:e};return this.setBarcodeProperties(t,r)},this.setMagnification=async(t,e)=>{const r={magnification:e};return this.setBarcodeProperties(t,r)},this.setQuietZoneValue=async(t,e,r)=>{const n=r?{left:r===Y.left?e:void 0,top:r===Y.top?e:void 0,right:r===Y.right?e:void 0,bottom:r===Y.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:n})).then(u=>i(u))},this.setAreQuietZoneValuesCombined=async(t,e)=>{const r={areQuietZoneValuesCombined:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:r})).then(c=>i(c))},this.setErrorCorrectionLevel=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({errorCorrectionLevel:e})).then(n=>i(n)),this.setCharacterSet=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({characterSet:e})).then(n=>i(n)),this.setDrawLightMarginIndicator=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.setDrawStartStopChars=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.getBarcodeConfigationOptions=t=>{let e=!0,r=!0,n=!0,c,u,l=!1,C=!1,p=!1;switch(t){case H.qr:c=[Ct.iso8859_1,Ct.utf8],u=[It.low,It.medium,It.quartile,It.high];case H.dataMatrix:e=!1,r=!1,n=!1,l=!0;break;case H.ean13:e=!1,C=!0;break;case H.ean8:C=!0;case H.upca:case H.upce:e=!1;break;case H.code128:case H.gs1128:c=[Ct.code128a,Ct.code128b,Ct.code128c];break;case H.code39:p=!0;break}return{allowEnableMagnification:n,allowBarHeight:r,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:u,allowToggleText:e,quietZoneAlwaysCombined:l,allowToggleLightMarginIndicator:C,allowToggleDrawStartAndEndChar:p}},y(this,z,o)}}z=new WeakMap;var K=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(K||{}),Z=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.gray="gray",s.hsl="hsl",s.spot="spot",s.spotCMYK="spotCMYK",s.spotRGB="spotRGB",s.spotHEX="spotHEX",s))(Z||{}),Xt=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(Xt||{});const Be=s=>s.type===K.hex,le=s=>s.type===K.spotHex,un=s=>s.type===K.spotRgb,gn=s=>s.type===K.spotCmyk,yn=s=>un(s)||gn(s)||le(s),pn=s=>{const o=Cn(s.type);return yn(s)?{...le(s)&&{value:s.displayValue},...!le(s)&&{...s.displayValue},spotName:s.value,type:o}:{...Be(s)&&{value:s.value},...!Be(s)&&{...s.value},type:o}},Ge=(s,o,t,e)=>{const{brandKitColorGuid:r,brandKitFontFamilyGuid:n,fontStyleId:c,textStrokeColorGuid:u,textStrokeColorApplied:l,textStrokeWidth:C,...p}=s;return{...Object.keys(p).reduce((b,v)=>({...b,[v]:{value:s[v]}}),{}),...o&&{color:{value:{id:o.id,color:o.color,type:Xt.brandKit,isApplied:p.fillColorApplied}}},...t&&{strokeColor:{value:{id:t.id,color:t.color,type:Xt.brandKit,isApplied:l||!1}},strokeColorApplied:{value:l||!1},strokeWidth:{value:C!=null?C.toString():C}},fontKey:{value:e??null}}},Cn=s=>{switch(s){case K.rgb:return Z.rgb;case K.cmyk:return Z.cmyk;case K.hex:return Z.hex;case K.spotRgb:return Z.spotRGB;case K.spotCmyk:return Z.spotCMYK;case K.spotHex:return Z.spotHEX}},te=(s,o)=>{if(!(s===null||o===void 0))return(s||[]).find(t=>t.id===o)},Je=(s,o,t)=>{var e,r;if(!(s===null||o===void 0||t===void 0))return(r=(e=(s||[]).find(n=>n.id===o))==null?void 0:e.fontStyles.find(n=>n.fontStyleId===t))==null?void 0:r.id};class Ue{constructor(o,t){g(this,N);this.getId=async()=>(await a(this,N)).getBrandKitId().then(r=>i(r)),this.getVersion=async()=>(await a(this,N)).getBrandKitVersion().then(r=>i(r)),this.getName=async()=>(await a(this,N)).getBrandKitName().then(r=>i(r)),this.rename=async e=>(await a(this,N)).renameBrandKit(e).then(n=>i(n)),this.updateIdAndVersion=async(e,r)=>(await a(this,N)).updateBrandKitIdAndVersion(e,r).then(c=>i(c)),this.get=async()=>{const e=await this.getId(),r=await this.getVersion(),n=await this.getName(),c=this.colorStyleController.getAll(),u=this.gradientStyleController.getAll(),l=this.fontController.getFontFamilies(),C=this.characterStyleController.getAll(),p=this.paragraphStyleController.getAll(),I=this.getAllMedia(),[b,v,P,A,S,x]=await Promise.all([c,u,l,p,C,I]),L={id:e.parsedData,brandKit:{id:e.parsedData,name:n.parsedData,lastModifiedDate:r.parsedData,colors:b.parsedData,gradients:v.parsedData,fonts:P.parsedData,paragraphStyles:A.parsedData,characterStyles:S.parsedData,media:x.parsedData}},F={success:!0,data:JSON.stringify(L),parsedData:L,status:200};return i(F)},this.getAllMedia=async()=>(await a(this,N)).getAllBrandKitMedia().then(r=>i(r)),this.addMedia=async(e,r,n)=>(await a(this,N)).addBrandKitMedia(e,r,n).then(u=>i(u)),this.updateMedia=async(e,r,n)=>(await a(this,N)).updateBrandKitMedia(e,r,n).then(u=>i(u)),this.renameMedia=async(e,r)=>(await a(this,N)).renameBrandKitMedia(e,r).then(c=>i(c)),this.removeMedia=async e=>(await a(this,N)).removeBrandKitMedia(e).then(n=>i(n)),this.remove=async()=>{const r=(await this.colorStyleController.getAll()).parsedData||[],c=(await this.gradientStyleController.getAll()).parsedData||[],l=(await this.paragraphStyleController.getAll()).parsedData||[],p=(await this.characterStyleController.getAll()).parsedData||[],b=(await this.fontController.getFontFamilies()).parsedData||[],P=(await this.getAllMedia()).parsedData||[];await this.undoManagerController.record("brandKit.remove",async A=>{for(const S of r)await A.colorStyle.remove(S.id);for(const S of c)await A.gradientStyle.remove(S.id);for(const S of l)await A.paragraphStyle.remove(S.id);for(const S of p)await A.characterStyle.remove(S.id);for(const S of b)await A.font.removeFontFamily(S.id);for(const S of P)await this.removeMedia(S.name)})},this.set=async e=>{let r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:[],gradients:[],fonts:[],paragraphStyles:[],characterStyles:[],media:[]}};return await this.undoManagerController.record("brandKit.set",async n=>{const c=await this.setColors(e,n);await this.setGradients(e,n);const u=await this.setFonts(e,n),{parsedData:l=[]}=await n.colorStyle.getAll(),{parsedData:C=[]}=await n.gradientStyle.getAll(),{parsedData:p}=await n.font.getFontFamilies();await this.setParagraphStyles(e,n,{localColors:l,localFonts:p,localColorGuidMap:c,localFontGuidMap:u}),await this.setCharacterStyles(e,n,{localColors:l,localFonts:p,localColorGuidMap:c,localFontGuidMap:u}),await this.setMedia(e);const{parsedData:I}=await n.paragraphStyle.getAll(),{parsedData:b}=await n.characterStyle.getAll(),{parsedData:v}=await this.getAllMedia();await n.brandKit.updateIdAndVersion(e.id,e.brandKit.lastModifiedDate),await n.brandKit.rename(e.brandKit.name),r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:l||[],gradients:C||[],fonts:p||[],paragraphStyles:I||[],characterStyles:b||[],media:v||[]}}}),r},y(this,N,o),this.colorStyleController=t.colorStyle,this.gradientStyleController=t.gradientStyle,this.fontController=t.font,this.mediaController=t.mediaConnector,this.paragraphStyleController=t.paragraphStyle,this.characterStyleController=t.characterStyle,this.undoManagerController=t.undoManager}async setColors(o,t){const e=new Map;for(const r of o.brandKit.colors||[]){const{parsedData:n}=await t.colorStyle.create();if(!n)continue;e.set(r.guid,n);const c=pn(r);await t.colorStyle.rename(n,r.name),await t.colorStyle.update(n,c)}return e}async setGradients(o,t){return new Map}async setFonts(o,t){const e=o.fontConnectorId,r=new Map;for(const n of o.brandKit.fonts||[]){const{parsedData:c=[]}=await t.fontConnector.detail(e,n.fontFamilyId);if(!(c!=null&&c[0]))throw new Error(`No font styles for family ID: ${n.fontFamilyId}`);const{parsedData:u}=await t.font.addFontFamily(e,{name:c[0].familyName,fontFamilyId:n.fontFamilyId});u&&r.set(n.fontFamilyBrandKitGuid,u)}return r}async setParagraphStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:u}=e;for(const l of o.brandKit.paragraphStyles||[]){const C=c.get(l.brandKitColorGuid),p=c.get(l.textStrokeColorGuid),I=u.get(l.brandKitFontFamilyGuid),b=Je(n,I,l.fontStyleId);if(!I||!b)throw new Error(`Paragraph style could not be created with an empty font family: ${l.name}`);const v=te(r,C),P=te(r,p);if(!v)throw new Error(`Paragraph style could not be created with an empty color: ${l.name}`);const{parsedData:A}=await t.paragraphStyle.create(),S=Ge(l,v,P,`${b}`);await t.paragraphStyle.rename(A,l.name),await t.paragraphStyle.update(A,S)}}async setCharacterStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:u}=e;for(const l of o.brandKit.characterStyles||[]){const C=l.brandKitColorGuid?c.get(l.brandKitColorGuid):void 0,p=l.textStrokeColorGuid?c.get(l.textStrokeColorGuid):void 0,I=l.brandKitFontFamilyGuid?u.get(l.brandKitFontFamilyGuid):void 0,b=te(r,C),v=te(r,p),P=Je(n,I,l.fontStyleId),{parsedData:A}=await t.characterStyle.create(),S=Ge(l,b,v,P);await t.characterStyle.rename(A,l.name),await t.characterStyle.update(A,S)}}async setMedia(o){for(const t of o.brandKit.media||[])await this.addMedia(t.name,t.mediaConnectorId,t.mediaId)}}N=new WeakMap;class de{constructor(o){g(this,it);this.zoomToPage=async(t,e,r,n,c)=>(t!==void 0&&console.warn("id has no effect and will be deprecated in the future"),(await a(this,it)).zoomToPage(e,r,n,c).then(l=>i(l))),this.getZoomPercentage=async()=>(await a(this,it)).getZoomPercentage().then(e=>i(e)),this.setZoomPercentage=async t=>(await a(this,it)).setZoomPercentage(t).then(r=>i(r)),this.setViewMode=async t=>(await a(this,it)).setViewMode(t).then(r=>i(r)),y(this,it,o)}}it=new WeakMap;class ke{constructor(o){g(this,B);this.getAll=async()=>(await a(this,B)).getCharacterStyles().then(e=>i(e)),this.getById=async t=>(await a(this,B)).getCharacterStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,B)).createCharacterStyle().then(e=>i(e)),this.update=async(t,e)=>(await a(this,B)).updateCharacterStyle(t,JSON.stringify(e)).then(n=>i(n)),this.remove=async t=>(await a(this,B)).removeCharacterStyle(t).then(r=>i(r)),this.duplicate=async t=>(await a(this,B)).duplicateCharacterStyle(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,B)).renameCharacterStyle(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,B)).moveCharacterStyles(t,e).then(n=>i(n)),y(this,B,o)}}B=new WeakMap;class _e{constructor(o){g(this,ot);this.copyFrames=async t=>{const r=await(await a(this,ot)).copyFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.cutFrames=async t=>{const r=await(await a(this,ot)).cutFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.pasteFrames=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.pasteFrames(e);return i(r)},this.getContentType=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.getClipboardContentType(e);return i(r)},y(this,ot,o)}}ot=new WeakMap;class xe{constructor(o){g(this,xt);this.convertToRgb=async t=>(await a(this,xt)).colorToRgb(JSON.stringify(t)).then(r=>i(r)),y(this,xt,o)}}xt=new WeakMap;class He{constructor(o){g(this,G);this.getAll=async()=>(await a(this,G)).getColors().then(e=>i(e)),this.getById=async t=>(await a(this,G)).getColorById(t).then(r=>i(r)),this.create=async()=>(await a(this,G)).createColor().then(e=>i(e)),this.duplicate=async t=>(await a(this,G)).duplicateColor(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,G)).moveColors(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,G)).renameColor(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,G),n=e;return n.type===Z.spot&&(n.type=Z.spotCMYK),r.updateColor(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,G)).removeColor(t).then(r=>i(r)),y(this,G,o)}}G=new WeakMap;var At=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(At||{}),ee=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(ee||{}),Pt=(s=>(s.file="file",s.collection="collection",s))(Pt||{}),Ke=(s=>(s.media="media",s.fonts="fonts",s.data="data",s))(Ke||{}),$e=(s=>(s.name="name",s.path="relativePath",s.id="id",s))($e||{}),ze=(s=>(s.ascending="asc",s.descending="desc",s))(ze||{}),We=(s=>(s.text="text",s.boolean="boolean",s))(We||{}),je=(s=>(s.query="query",s.upload="upload",s))(je||{}),Ft=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Ft||{});class mn{constructor(o,t,e,r="engineToConnector"){this.direction="engineToConnector",this.name=o,this.direction=r,t==="var"?this.value=`${t}.${e}`:this.value=e}}var qe=(s=>(s.variable="var",s.value="value",s))(qe||{}),Ye=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(Ye||{}),se=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(se||{}),Ze=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(Ze||{});const wn={url:"grafx-media.json",source:"local"};class fn{constructor(o){this.type="grafxToken",this.token=o}}class Sn{constructor(){this.type="refreshed"}}var Qe=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(Qe||{}),Xe=(s=>(s.grafxToken="grafxToken",s.any="any",s))(Xe||{}),ue=(s=>(s.minDimension="minDimension",s))(ue||{});class ts extends Error{constructor(o,t){super(o),this.type=t}}class ge{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=Ft.grafx||this.isSourceMigrated(o))return o;let t=o.url;for(;t.endsWith("/");)t=t.substring(0,t.length-1);const e=t.split("/");return{id:e[e.length-1],source:Ft.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,t)=>o.map(e=>this.makeSingleConnectorBackwardsCompatible(e,t)),this.makeSingleConnectorBackwardsCompatible=(o,t)=>o.source.source!=Ft.grafx?o:{id:o.id,name:o.name,iconUrl:o.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(o.source,t)},this.makeConnectorSourceBackwardsCompatible=(o,t)=>{let e=t;for(;e!=null&&e.endsWith("/");)e=e.substring(0,e.length-1);return{url:`${e}/connectors/${o.id}`,source:Ft.grafx}},this.isSourceMigrated=o=>"id"in o}}let es=(wr=class{constructor(o,t){g(this,J);g(this,Dt);g(this,mt);this.getById=async e=>(await a(this,J)).getConnectorById(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,mt).makeSingleConnectorBackwardsCompatible(n.parsedData,a(this,Dt).get(q.GraFxStudioEnvironmentApiUrl))),c}),this.getAllByType=async e=>(await a(this,J)).getConnectors(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,mt).makeMultipleConnectorsBackwardsCompatible(n.parsedData,a(this,Dt).get(q.GraFxStudioEnvironmentApiUrl))),c}),this.register=async e=>{const r=await a(this,J),n=a(this,mt).makeConnectorSourceForwardsCompatible(e);return r.registerConnector(JSON.stringify(n)).then(c=>i(c))},this.unregister=async e=>(await a(this,J)).unregisterConnector(e).then(n=>i(n)),this.configure=async(e,r)=>{const n=await a(this,J);return await this.waitToBeReady(e),await r(new bn(e,n)),n.updateConnectorConfiguration(e).then(c=>i(c))},this.getState=async e=>(await a(this,J)).getConnectorState(e).then(n=>i(n)),this.getOptions=async e=>(await a(this,J)).getConnectorOptions(e).then(n=>i(n)),this.waitToBeReady=async(e,r=2e3)=>{let n=Math.max(r,500);n=Math.min(n,5e3);const c=100;let u=0;try{for(;u*c<n;){const l=await this.getState(e);if(l.success&&l.parsedData&&(l.parsedData.type===se.running||l.parsedData.type===se.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(C=>setTimeout(C,c)),u++}}catch(l){return i({data:null,success:!1,error:`Error while getting connector state ${l}`,status:5e4,parsedData:void 0},!1)}return i({data:null,success:!1,error:"Timed out waiting for connector",status:5e4,parsedData:void 0},!1)},this.updateMappings=async(e,r)=>await this.configure(e,async n=>{const{parsedData:c}=await this.getMappings(e),u=(c==null?void 0:c.filter(p=>!r.some(I=>I.name===p.name&&I.direction===p.direction)))??[],l=r.filter(p=>p.name!==""&&p.value!==""),C=[...u,...l];await n.setMappings(C)}),y(this,J,o),y(this,Dt,t),y(this,mt,new ge)}async getMappings(o,t){return(await a(this,J)).getConnectorMappings(o).then(r=>i(r)).then(r=>{var n;return t?{...r,parsedData:(n=r.parsedData)==null?void 0:n.filter(c=>c.direction===t)}:r})}},J=new WeakMap,Dt=new WeakMap,mt=new WeakMap,wr);class bn{constructor(o,t){g(this,wt);g(this,ft);this.setOptions=async e=>a(this,ft).setConnectorOptions(a(this,wt),JSON.stringify(e)).then(r=>i(r)),this.setMappings=async e=>{const r=await a(this,ft).setConnectorMappings(a(this,wt),e.map(function(n){return JSON.stringify(n)}));return i(r)},this.setHttpHeader=async(e,r)=>a(this,ft).connectorAuthenticationSetHttpHeader(a(this,wt),e,r).then(n=>i(n)),y(this,wt,o),y(this,ft,t)}}wt=new WeakMap,ft=new WeakMap;class ss{constructor(o,t){g(this,ct);g(this,Ht);this.getPage=async(e,r,n={})=>(await a(this,ct)).dataConnectorGetPage(e,JSON.stringify(r),JSON.stringify(n)).then(u=>i(u)).then(u=>{const l={...u,parsedData:null};return u.parsedData&&(l.parsedData={data:u.parsedData.data.map(C=>a(this,Ht).mapEngineToDataItem(C)),continuationToken:u.parsedData.continuationToken}),l}),this.getModel=async(e,r={})=>(await a(this,ct)).dataConnectorGetModel(e,JSON.stringify(r)).then(c=>i(c)),this.getConfigurationOptions=async e=>(await a(this,ct)).dataConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,ct)).dataConnectorGetCapabilities(e).then(n=>i(n)),y(this,ct,o),y(this,Ht,t)}}ct=new WeakMap,Ht=new WeakMap;class rs{constructor(o,t){g(this,ht);g(this,Kt);this.setDataSource=async e=>(await a(this,ht)).setDataSource(e).then(n=>i(n)),this.getDataSource=async()=>(await a(this,ht)).getDataSource().then(r=>i(r)),this.removeDataSource=async()=>(await a(this,ht)).removeDataSource().then(r=>i(r)),this.setDataRow=async e=>{const r=await a(this,ht),n=a(this,Kt).mapDataItemToEngine(e);return r.setDataRow(JSON.stringify(n)).then(c=>i(c))},y(this,ht,o),y(this,Kt,t)}}ht=new WeakMap,Kt=new WeakMap;class ns{constructor(o){g(this,lt);this.getAllLogs=async()=>(await a(this,lt)).getLogs().then(e=>i(e)),this.toggleDebugPanel=async()=>(await a(this,lt)).toggleDebugPanel().then(e=>i(e)),this.enableDebug=async()=>(await a(this,lt)).enableDebug().then(e=>i(e)),this.disableDebug=async()=>(await a(this,lt)).disableDebug().then(e=>i(e)),y(this,lt,o)}}lt=new WeakMap;class as{constructor(o){g(this,St);this.getCurrentState=async()=>(await a(this,St)).getCurrentDocumentState().then(e=>i(e)),this.load=async(t,e={keepConnectors:!1})=>{const r=await a(this,St),n=typeof t!="string"?JSON.stringify(t):t;return r.loadDocument(n,JSON.stringify(e)).then(c=>i(c))},this.createAndLoad=async t=>{const e=await a(this,St),r=JSON.stringify(t);return e.createAndLoadDocument(r).then(n=>i(n))},y(this,St,o)}}St=new WeakMap;var is=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(is||{}),kt=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(kt||{}),os=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s))(os||{}),cs=(s=>(s.variable="variable",s.text="text",s))(cs||{}),hs=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(hs||{}),ls=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(ls||{}),ds=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(ds||{}),us=(s=>(s.normal="normal",s.screen="screen",s.overlay="overlay",s.darken="darken",s.lighten="lighten",s.colorDodge="colorDodge",s.colorBurn="colorBurn",s.hardLight="hardLight",s.softLight="softLight",s.difference="difference",s.exclusion="exclusion",s.multiply="multiply",s.hue="hue",s.saturation="saturation",s.color="color",s.luminosity="luminosity",s))(us||{}),gs=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(gs||{}),ys=(s=>(s.topLeft="topLeft",s.topCenter="topCenter",s.topRight="topRight",s.centerLeft="centerLeft",s.center="center",s.centerRight="centerRight",s.bottomLeft="bottomLeft",s.bottomCenter="bottomCenter",s.bottomRight="bottomRight",s))(ys||{}),ps=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(ps||{}),Cs=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(Cs||{}),ms=(s=>(s.page="page",s.frame="frame",s))(ms||{}),ws=(s=>(s.start="start",s.end="end",s.center="center",s))(ws||{});class vn{constructor(){this.type="page"}}class In{constructor(o,t){this.type="frame",this.frameId=o,this.edge=t}}var ye=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(ye||{});class fs{constructor(o){g(this,U);this.insertImageVariableToFrame=async(t,e)=>{const r=await a(this,U),n={id:e,type:kt.variable};return r.setImageSource(t,JSON.stringify(n)).then(c=>i(c))},this.insertTextVariable=async t=>(await a(this,U)).insertTextVariable(t).then(r=>i(r)),this.enterTextEditMode=async t=>(await a(this,U)).enterTextEditMode(t).then(r=>i(r)),this.exitTextEditMode=async()=>(await a(this,U)).exitTextEditMode().then(e=>i(e)),this.getText=async(t,e)=>(await a(this,U)).getTextByFrameId(t,e).then(n=>i(n)),this.setText=async(t,e)=>(await a(this,U)).setTextByFrameId(t,e).then(n=>i(n)),this.selectText=async(t,e,r)=>(await a(this,U)).selectTextById(t,e,r).then(c=>i(c)),this.addCustomUndoData=async(t,e,r)=>(await a(this,U)).setCustomUndoData(t,e,r??!1).then(c=>i(c)),y(this,U,o)}}U=new WeakMap;class Ss{constructor(o){g(this,dt);g(this,Ot);this.query=async(t,e,r={})=>(await a(this,dt)).fontConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,dt)).fontConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r={})=>(await a(this,Ot)).fontConnectorDownload(t,e,JSON.stringify(r)).then(c=>c??c),this.preview=async(t,e,r,n={})=>(await a(this,Ot)).fontConnectorPreview(t,e,r,JSON.stringify(n)).then(u=>u??u),this.getConfigurationOptions=async t=>(await a(this,dt)).fontConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,dt)).fontConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedFontType=t=>{if(t===At.file)return Pt.file;if(t===At.collection)return Pt.collection},y(this,dt,o),y(this,Ot,o)}}dt=new WeakMap,Ot=new WeakMap;class bs{constructor(o){g(this,E);this.addFontFamily=async(t,e)=>(await a(this,E)).addFontFamily(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontFamily=async t=>(await a(this,E)).removeFontFamily(t).then(r=>i(r)),this.addFontStyle=async(t,e)=>(await a(this,E)).addFontStyle(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontStyle=async t=>(await a(this,E)).removeFontStyle(t).then(r=>i(r)),this.getFontFamilies=async()=>(await a(this,E)).getFontFamilies().then(e=>i(e)),this.getFontStyles=async t=>(await a(this,E)).getFontStyles(t).then(r=>i(r)),this.getFontFamilyById=async t=>(await a(this,E)).getFontFamilyById(t).then(r=>i(r)),this.getFontStyleById=async t=>(await a(this,E)).getFontStyleById(t).then(r=>i(r)),this.getDefaultFontStyle=async()=>(await a(this,E)).getDefaultFontStyle().then(e=>i(e)),this.getDefaultFontFamily=async()=>(await a(this,E)).getDefaultFontFamily().then(e=>i(e)),this.isFontFamilyUsed=async t=>(await a(this,E)).isFontFamilyUsed(t).then(r=>i(r)),this.isFontStyleUsed=async t=>(await a(this,E)).isFontStyleUsed(t).then(r=>i(r)),this.moveFontFamilies=async(t,e)=>(await a(this,E)).moveFontFamilies(t,e).then(n=>i(n)),this.getPreviewsOfCharacterStrings=async(t,e)=>(await a(this,E)).getPreviewsOfCharacterStrings(t,JSON.stringify(e)).then(n=>i(n)),y(this,E,o)}}E=new WeakMap;class pe{constructor(o){g(this,Lt);this.setShapeProperties=async(t,e)=>(await a(this,Lt)).setShapeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableFill=async(t,e)=>{const r={enableFill:e};return this.setShapeProperties(t,r)},this.setFillColor=async(t,e)=>{const r={fillColor:e};return this.setShapeProperties(t,r)},this.setEnableStroke=async(t,e)=>{const r={enableStroke:e};return this.setShapeProperties(t,r)},this.setStrokeColor=async(t,e)=>{const r={strokeColor:e};return this.setShapeProperties(t,r)},this.setStrokeWeight=async(t,e)=>{const r={strokeWeight:e};return this.setShapeProperties(t,r)},this.setFlagAllCornersSame=async(t,e)=>{const r={allCornersSame:e};return this.setShapeProperties(t,r)},this.setShapeCorners=async(t,e)=>(await a(this,Lt)).setShapeCorners(t,JSON.stringify(e)).then(n=>i(n)),this.setRadiusAll=async(t,e)=>{const r={radiusAll:e};return this.setShapeCorners(t,r)},this.setRadiusTopLeft=async(t,e)=>{const r={topLeft:e};return this.setShapeCorners(t,r)},this.setRadiusBottomLeft=async(t,e)=>{const r={bottomLeft:e};return this.setShapeCorners(t,r)},this.setRadiusTopRight=async(t,e)=>{const r={topRight:e};return this.setShapeCorners(t,r)},this.setRadiusBottomRight=async(t,e)=>{const r={bottomRight:e};return this.setShapeCorners(t,r)},y(this,Lt,o)}}Lt=new WeakMap;class vs{constructor(o){g(this,d);this.getAll=async()=>(await a(this,d)).getFrames().then(e=>i(e)),this.getSelected=async()=>(await a(this,d)).getSelectedFrames().then(e=>i(e)),this.getAllByPageId=async t=>(await a(this,d)).getFramesByPageId(t).then(r=>i(r)),this.getByName=async t=>(await a(this,d)).getFrameByName(t).then(r=>i(r)),this.getById=async t=>(await a(this,d)).getFrameById(t).then(r=>i(r)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,d)).getFramePropertiesOnSelectedLayout().then(e=>i(e)),this.getLayoutProperties=async(t,e)=>(await a(this,d)).getFramePropertiesByFrameId(t,e).then(n=>i(n)),this.getAllLayoutProperties=async t=>(await a(this,d)).getFramesProperties(t).then(r=>i(r)),this.resetTransformation=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetSize=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.select=async t=>(await a(this,d)).selectFrames([t]).then(r=>i(r)),this.selectMultiple=async t=>(await a(this,d)).selectFrames(t).then(r=>i(r)),this.deselectAll=async()=>(await a(this,d)).deselectFrames().then(e=>i(e)),this.reorderFrames=async(t,e)=>(await a(this,d)).reorderFrames(t,e).then(n=>i(n)),this.setZIndex=async(t,e)=>(await a(this,d)).setFrameZIndex(t,e).then(n=>i(n)),this.setHeight=async(t,e)=>(await a(this,d)).setFrameHeight(t,e).then(n=>i(n)),this.setRotation=async(t,e)=>(await a(this,d)).setFrameRotation(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,d)).setFrameWidth(t,e).then(n=>i(n)),this.setX=async(t,e)=>(await a(this,d)).setFrameX(t,e).then(n=>i(n)),this.setY=async(t,e)=>(await a(this,d)).setFrameY(t,e).then(n=>i(n)),this.setOpacity=async(t,e)=>(await a(this,d)).setFrameOpacity(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,d)).renameFrame(t,e).then(n=>i(n)),this.reset=async t=>(await a(this,d)).resetFrame(t).then(r=>i(r)),this.resetX=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetY=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetRotation=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetHeight=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetImageFrameFitMode=async t=>(await a(this,d)).resetImageFrameFitMode(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,d)).setFrameIsVisible(t,e).then(n=>i(n)),this.setIsVisible=async(t,e)=>(await a(this,d)).setFrameIsVisible(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,d)).removeFrames([t]).then(r=>i(r)),this.removeFrames=async t=>(await a(this,d)).removeFrames(t).then(r=>i(r)),this.create=async(t,e,r,n,c)=>(await a(this,d)).addFrame(t,e,r,n,c).then(l=>i(l)),this.createShapeFrame=async(t,e,r,n,c)=>(await a(this,d)).addFrame(t,e,r,n,c).then(l=>i(l)),this.createBarcodeFrame=async(t,e)=>(await a(this,d)).addBarcodeFrame(t,e==null?void 0:e.x,e==null?void 0:e.y).then(n=>i(n)),this.duplicateFrames=async t=>(await a(this,d)).duplicateFrames(t).then(r=>i(r)),this.updateImageSource=async(t,e)=>{const r=await a(this,d),n=e!==null?JSON.stringify(e):null;return r.setImageSource(t,n).then(c=>i(c))},this.removeImageSource=async t=>this.updateImageSource(t,null),this.setImageFromConnector=async(t,e,r)=>{const n={id:e,assetId:r,type:kt.connector};return this.updateImageSource(t,n)},this.setImageFromUrl=async(t,e)=>{const r={url:e,type:kt.url};return this.updateImageSource(t,r)},this.setImageFrameFitMode=async(t,e)=>(await a(this,d)).setImageFrameFitMode(t,e).then(n=>i(n)),this.setImageFrameFitModePosition=async(t,e)=>(await a(this,d)).setImageFrameFitModePosition(t,e).then(n=>i(n)),this.setFrameConstrainProportions=async(t,e)=>(console.error("setFrameConstrainProportions is not supported anymore"),i({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(t,e)=>(await a(this,d)).setVerticalAlignment(t,e).then(n=>i(n)),this.setMinCopyfitting=async(t,e)=>(await a(this,d)).setMinCopyfitting(t,e).then(n=>i(n)),this.setMaxCopyfitting=async(t,e)=>(await a(this,d)).setMaxCopyfitting(t,e).then(n=>i(n)),this.setEnableCopyfitting=async(t,e)=>(await a(this,d)).setEnableCopyfitting(t,e).then(n=>i(n)),this.resetMinCopyfitting=async t=>(await a(this,d)).resetMinCopyfitting(t).then(r=>i(r)),this.resetMaxCopyfitting=async t=>(await a(this,d)).resetMaxCopyfitting(t).then(r=>i(r)),this.resetEnableCopyfitting=async t=>(await a(this,d)).resetEnableCopyfitting(t).then(r=>i(r)),this.setShapeFrameEnableFill=async(t,e)=>this.shapeController.setEnableFill(t,e),this.setShapeFrameFillColor=async(t,e)=>this.shapeController.setFillColor(t,e),this.setShapeFrameEnableStroke=async(t,e)=>this.shapeController.setEnableStroke(t,e),this.setShapeFrameStrokeColor=async(t,e)=>this.shapeController.setStrokeColor(t,e),this.setShapeFrameStrokeWeight=async(t,e)=>this.shapeController.setStrokeWeight(t,e),this.setBlendMode=async(t,e)=>(await a(this,d)).setFrameBlendMode(t,e).then(n=>i(n)),this.enterCropMode=async(t,e=ye.frameCrop)=>(await a(this,d)).enterCropMode(t,e).then(n=>i(n)),this.applyCropMode=async()=>(await a(this,d)).applyCropMode().then(e=>i(e)),this.exitCropMode=async()=>(await a(this,d)).cancelCropMode().then(e=>i(e)),this.enterSubjectMode=async t=>(await a(this,d)).enterSubjectMode(t).then(r=>i(r)),this.applySubjectMode=async()=>(await a(this,d)).applySubjectMode().then(e=>i(e)),this.exitSubjectMode=async()=>(await a(this,d)).cancelSubjectMode().then(e=>i(e)),this.enterGradientMode=async t=>(await a(this,d)).enterGradientMode(t).then(r=>i(r)),this.applyGradientMode=async()=>(await a(this,d)).applyGradientMode().then(e=>i(e)),this.cancelGradientMode=async()=>(await a(this,d)).cancelGradientMode().then(e=>i(e)),this.resetCropMode=async t=>(console.error("resetCropMode is not supported anymore"),i({success:!1,status:0,error:"resetCropMode is not supported anymore",parsedData:null})),this.setEnableAutoGrow=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinWidth=async(t,e)=>{const r={minWidth:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxWidth=async(t,e)=>{const r={maxWidth:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinHeight=async(t,e)=>{const r={minHeight:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxHeight=async(t,e)=>{const r={maxHeight:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowDirections=async(t,e)=>{const r={directions:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.resetAutoGrowSettingsEnabled=async t=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async t=>(console.error("resetAutoGrowMinWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async t=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async t=>(console.error("resetAutoGrowMinHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async t=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async t=>(console.error("resetAutoGrowDirections is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async t=>(console.error("resetAutoGrow is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setShadowEnabled=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowDistance=async(t,e)=>{const r={distance:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowAngleDegrees=async(t,e)=>{const r={angleDegrees:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowBlurRadius=async(t,e)=>{const r={blurRadius:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowColor=async(t,e)=>{const r={color:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAnchor=async(t,e,r,n,c)=>{const u={horizontal:e,type:r,target:n,endTarget:c};return(await a(this,d)).setAnchorProperties(t,JSON.stringify(u)).then(C=>i(C))},this.setVerticalAnchor=async(t,e,r,n)=>this.setAnchor(t,!1,e,r,n),this.setHorizontalAnchor=async(t,e,r,n)=>this.setAnchor(t,!0,e,r,n),this.resetAnchoring=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetVisibility=async t=>(await a(this,d)).setFrameIsVisible(t,null).then(r=>i(r)),this.getConfiguration=async t=>(await a(this,d)).getFrameConfiguration(t).then(r=>i(r)),this.resetAssetCropOverride=async t=>(await a(this,d)).resetAssetCropOverride(t).then(r=>i(r)),this.resetAllAssetCropOverrides=async t=>(await a(this,d)).resetAllAssetCropOverrides(t).then(r=>i(r)),this.setGradientApplied=async(t,e)=>{const r={isApplied:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setLocalGradient=async(t,e)=>{const r={gradient:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setBrandKitGradient=async(t,e)=>{const r={id:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},y(this,d,o),this.shapeController=new pe(a(this,d)),this.constraints=new An(a(this,d))}}d=new WeakMap;class An{constructor(o){g(this,Q);this.get=async t=>(await a(this,Q)).getFrameConstraints(t).then(r=>i(r)),this.setSelectable=async(t,e)=>{const r={selectable:{value:e}};return(await a(this,Q)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setHorizontalMovement=async(t,e)=>{const r={horizontalMovementAllowed:{value:e}};return(await a(this,Q)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setVerticalMovement=async(t,e)=>{const r={verticalMovementAllowed:{value:e}};return(await a(this,Q)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setRotation=async(t,e)=>{const r={rotationAllowed:{value:e}};return(await a(this,Q)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setResize=async(t,e)=>{const r={resizeAllowed:{value:e}};return(await a(this,Q)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},y(this,Q,o)}}Q=new WeakMap;class Is{constructor(){this.currentEngineVersion=R.current,this.currentSDKVersion=Se.version}}class As{constructor(o){g(this,f);g(this,$t);this.getAll=async()=>(await a(this,f)).getLayouts().then(e=>i(e)),this.getById=async t=>(await a(this,f)).getLayoutById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,f)).getLayoutByName(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,f)).getSelectedLayout().then(e=>i(e)),this.remove=async t=>(await a(this,f)).removeLayout(t).then(r=>i(r)),this.create=async(t,e)=>{const r=await a(this,f);return e!=null&&e.length?r.addLayouts(t,JSON.stringify(e)).then(n=>i(n)):r.addLayout(t).then(n=>i(n))},this.rename=async(t,e)=>(await a(this,f)).renameLayout(t,e).then(n=>i(n)),this.select=async t=>(await a(this,f)).selectLayoutWithOptions(t,null).then(r=>i(r)),this.selectWithPageSize=async(t,e)=>{const r=await a(this,f),n={pageSize:e};return r.selectLayoutWithOptions(t,JSON.stringify(n)).then(c=>i(c))},this.duplicate=async t=>(await a(this,f)).duplicateLayout(t).then(r=>i(r)),this.reset=async t=>(await a(this,f)).resetLayout(t).then(r=>i(r)),this.setHeight=async(t,e)=>(await a(this,f)).setLayoutHeight(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,f)).setLayoutWidth(t,e).then(n=>i(n)),this.setUnit=async(t,e)=>(await a(this,f)).setLayoutUnit(t,e).then(n=>i(n)),this.resetHeight=async t=>(await a(this,f)).resetLayoutHeight(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,f)).resetLayoutWidth(t).then(r=>i(r)),this.resetUnit=async t=>(await a(this,f)).resetLayoutUnit(t).then(r=>i(r)),this.getSelectedSnapshot=async()=>(await a(this,$t)).getPageSnapshot().then(e=>e??e),this.setIntent=async(t,e)=>(await a(this,f)).setLayoutIntent(t,e).then(n=>i(n)),this.resetIntent=async t=>(await a(this,f)).resetLayoutIntent(t).then(r=>i(r)),this.setFillColor=async(t,e)=>(await a(this,f)).setLayoutFillColor(t,JSON.stringify(e)).then(n=>i(n)),this.setFillColorEnabled=async(t,e)=>(await a(this,f)).setLayoutFillColorEnabled(t,e).then(n=>i(n)),this.resetFillColor=async t=>(await a(this,f)).resetLayoutFillColor(t).then(r=>i(r)),this.setBleedValue=async(t,e,r)=>{const n=r?{left:r===Y.left?e:void 0,top:r===Y.top?e:void 0,right:r===Y.right?e:void 0,bottom:r===Y.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(n)).then(u=>i(u))},this.setAreBleedValuesCombined=async(t,e)=>{const r={areBleedValuesCombined:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(r)).then(c=>i(c))},this.resetBleedValues=async t=>(await a(this,f)).updateLayoutBleed(t,null).then(r=>i(r)),this.setPrivateData=async(t,e)=>(await a(this,f)).setLayoutPrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,f)).getLayoutPrivateData(t).then(r=>i(r)),this.setDisplayName=async(t,e)=>(await a(this,f)).setLayoutDisplayName(t,e).then(n=>i(n)),this.getDisplayName=async t=>(await a(this,f)).getLayoutDisplayName(t).then(r=>i(r)),this.resetDisplayName=async t=>(await a(this,f)).setLayoutDisplayName(t,null).then(r=>i(r)),this.setAvailableForUser=async(t,e)=>(await a(this,f)).setLayoutAvailableForUser(t,e).then(n=>i(n)),this.setSelectedByUser=async(t,e)=>(await a(this,f)).setLayoutSelectedByUser(t,e).then(n=>i(n)),this.setResizableByUser=async(t,e)=>(await a(this,f)).setLayoutResizableByUser(t,JSON.stringify(e)).then(n=>i(n)),y(this,f,o),y(this,$t,o)}}f=new WeakMap,$t=new WeakMap;var re=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(re||{}),Ce=(s=>(s.web="web",s.print="print",s.animation="animation",s))(Ce||{});class Ps{constructor(o){g(this,X);g(this,zt);this.query=async(t,e,r={})=>(await a(this,X)).mediaConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,X)).mediaConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r,n={})=>{const c=this.parseDeprecatedMediaDownloadType(r);return(await a(this,zt)).mediaConnectorDownload(t,e,c,Ce.web,JSON.stringify(n)).then(l=>{if(l instanceof Uint8Array)return l;throw typeof l=="object"&&l!==null&&"success"in l&&!l.success&&Fe(l),new Error(`Unexpected response type: ${typeof l}.`)})},this.getConfigurationOptions=async t=>(await a(this,X)).mediaConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,X)).mediaConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedMediaType=t=>{if(t===At.file)return Pt.file;if(t===At.collection)return Pt.collection},this.upload=async(t,e,r={})=>(await a(this,X)).mediaConnectorUpload(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),y(this,X,o),y(this,zt,o)}parseDeprecatedMediaDownloadType(o){switch(o){case ee.HighResolutionWeb:return re.highres;case ee.LowResolutionWeb:return re.thumbnail;default:return o}}}X=new WeakMap,zt=new WeakMap;let Fs=(fr=class{constructor(o){g(this,O);g(this,Wt);this.add=async()=>(await a(this,O)).addPage().then(e=>i(e)),this.remove=async t=>(await a(this,O)).removePage(t).then(r=>i(r)),this.select=async t=>(await a(this,O)).selectPage(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,O)).setPageIsVisible(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,O)).duplicatePage(t).then(r=>i(r)),this.getAll=async()=>(await a(this,O)).getPages().then(e=>i(e)),this.getById=async t=>(await a(this,O)).getPageById(t).then(r=>i(r)),this.getSnapshot=async(t,e)=>(await a(this,Wt)).getPageSnapshotWithSettings(t,e==null?null:JSON.stringify(e)).then(n=>n??n),this.setWidth=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,O)).setPageWidth(e).then(n=>i(n))),this.setHeight=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,O)).setPageHeight(e).then(n=>i(n))),this.setSize=async(t,e)=>(await a(this,O)).setPageSize(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,O)).reorderPages(t,e).then(n=>i(n)),y(this,O,o),y(this,Wt,o)}},O=new WeakMap,Wt=new WeakMap,fr);class Es{constructor(o){g(this,k);this.getAll=async()=>(await a(this,k)).getParagraphStyles().then(e=>i(e)),this.getById=async t=>(await a(this,k)).getParagraphStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,k)).createParagraphStyle().then(e=>i(e)),this.duplicate=async t=>(await a(this,k)).duplicateParagraphStyle(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,k)).updateParagraphStyle(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,k)).renameParagraphStyle(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,k)).removeParagraphStyle(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,k)).moveParagraphStyles(t,e).then(n=>i(n)),y(this,k,o)}}k=new WeakMap;var T=(s=>(s.info="info",s.warn="warn",s.error="error",s))(T||{}),Ds=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s))(Ds||{}),_t=(s=>(s.throw="throw",s.log="log",s))(_t||{});class Os{constructor(o,t,e,r){this.type="action",this.message=o,this.id=t,this.event=e,this.eventChain=r}}class Ls{constructor(o,t,e){this.type="dataRow",this.count=o,this.message=t,this.exceptions=e}}var ne=(s=>(s.shortText="shortText",s.longText="longText",s.image="image",s.list="list",s.boolean="boolean",s.group="group",s.number="number",s.date="date",s))(ne||{}),Ms=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Ms||{}),Ns=(s=>(s.en_US="en_US",s.cs="cs",s.da="da",s.nl="nl",s.fi="fi",s.fr="fr",s.de="de",s.it="it",s.no="no",s.pl="pl",s.pt_PT="pt_PT",s.es_ES="es_ES",s.sv="sv",s))(Ns||{}),Et=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Et||{}),Rs=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(Rs||{}),Vs=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(Vs||{});let Pn=class{constructor(o,t){this.onActionsChanged=e=>{this.config.events.onActionsChanged.trigger(JSON.parse(e))},this.onAnimationChanged=e=>{this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(e))},this.onAnimationPlaybackChanged=e=>{this.config.events.onScrubberPositionChanged.trigger(JSON.parse(e))},this.onSelectedLayoutPropertiesChanged=e=>{this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutUnitChanged=e=>{this.config.events.onSelectedLayoutUnitChanged.trigger(e)},this.onFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onFramesLayoutChanged.trigger(r)},this.onSelectedFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesLayoutChanged.trigger(r);const n=this.config.onSelectedFrameLayoutChanged;n&&n(r.length>1?void 0:r[0])},this.onSelectedFramesContentChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesContentChanged.trigger(r);const n=this.config.onSelectedFrameContentChanged;n&&n(r.length>1?null:r[0])},this.onStateChanged=()=>{this.config.events.onStateChanged.trigger()},this.onAuthExpired=async e=>{const r=await this.config.handlers.onAuthExpired.trigger(JSON.parse(e));return r!=null?JSON.stringify(r):null},this.onViewportRequested=()=>{const e=this.config.handlers.onViewportRequested.trigger();return e!=null?JSON.stringify(e):null},this.onDocumentLoaded=()=>{this.config.events.onDocumentLoaded.trigger()},this.onPageSelectionChanged=e=>{this.config.events.onPageSelectionChanged.trigger(e)},this.onVariableListChanged=e=>{const n=JSON.parse(e).map(c=>{var u;return c.type===ne.list?{...c,items:c.items.map(l=>l.value),selected:(u=c.selected)==null?void 0:u.value}:c});this.config.events.onVariableListChanged.trigger(n)},this.onSelectedToolChanged=e=>{this.config.events.onSelectedToolChanged.trigger(e)},this.onUndoStateChanged=e=>{this.config.events.onUndoStackStateChanged.trigger(JSON.parse(e))},this.onCustomUndoDataChanged=e=>{this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(e))},this.onSelectedLayoutFramesChanged=e=>{this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(e))},this.onSelectedTextStyleChanged=e=>{this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(e))},this.onColorsChanged=e=>{this.config.events.onColorsChanged.trigger(JSON.parse(e))},this.onParagraphStylesChanged=e=>{this.config.events.onParagraphStylesChanged.trigger(JSON.parse(e))},this.onCharacterStylesChanged=e=>{this.config.events.onCharacterStylesChanged.trigger(JSON.parse(e))},this.onFontFamiliesChanged=e=>{this.config.events.onFontFamiliesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutIdChanged=e=>{this.config.events.onSelectedLayoutIdChanged.trigger(e)},this.onLayoutsChanged=e=>{this.config.events.onLayoutsChanged.trigger(JSON.parse(e))},this.onZoomChanged=e=>{this.config.events.onZoomChanged.trigger(JSON.parse(e))},this.onConnectorEvent=e=>{this.config.events.onConnectorEvent.trigger(JSON.parse(e))},this.onConnectorsChanged=e=>{const n=new ge().makeMultipleConnectorsBackwardsCompatible(JSON.parse(e),this.localConfig.get(q.GraFxStudioEnvironmentApiUrl));this.config.events.onConnectorsChanged.trigger(n)},this.onSelectedPageIdChanged=e=>{this.config.events.onSelectedPageIdChanged.trigger(e)},this.onPagesChanged=e=>{this.config.events.onPagesChanged.trigger(JSON.parse(e))},this.onPageSnapshotInvalidated=e=>{this.config.events.onPageSnapshotInvalidated.trigger(e)},this.onPageSizeChanged=e=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(e))},this.onShapeCornerRadiusChanged=e=>{this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(e))},this.onCropActiveFrameIdChanged=e=>{this.config.events.onCropActiveFrameIdChanged.trigger(e)},this.onAsyncError=e=>{const r=JSON.parse(e);if((r==null?void 0:r.type)==="dataRow"){const n=new Ls(r.count,r.message,r.exceptions);this.config.events.onAsyncError.trigger(n)}else if((r==null?void 0:r.type)==="action"){const n=new Os(r.message,r.id,r.event,r.eventChain);this.config.events.onAsyncError.trigger(n)}else this.config.events.onAsyncError.trigger(r)},this.onViewModeChanged=e=>{this.config.events.onViewModeChanged.trigger(e)},this.onBarcodeValidationChanged=e=>{this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(e))},this.onDataSourceIdChanged=e=>{this.config.events.onDataSourceIdChanged.trigger(e)},this.onDocumentIssueListChanged=e=>{this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(e))},this.onEngineEditModeChanged=e=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(e))},this.onBrandKitMediaChanged=e=>{this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(e))},this.config=o,this.localConfig=t}};class Ts{constructor(o){g(this,bt);this.set=async t=>(await a(this,bt)).selectedTextStyleDeltaUpdate(JSON.stringify(t)).then(r=>i(r)),this.removeSelected=async()=>(await a(this,bt)).selectedTextStyleClean().then(e=>i(e)),this.getSelected=async()=>(await a(this,bt)).getSelectedTextStyle().then(e=>i(e)),y(this,bt,o)}}bt=new WeakMap;var Bs=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Bs||{}),Gs=(s=>(s.LAYOUT_HEIGHT="layoutHeight",s.LAYOUT_WIDTH="layoutWidth",s.BLEED_TOP="bleedTop",s.BLEED_BOTTOM="bleedBottom",s.BLEED_LEFT="bleedLeft",s.BLEED_RIGHT="bleedRight",s.BLEED_VALUES_COMBINED="areBleedValuesCombined",s))(Gs||{}),$=(s=>(s.SELECT="select",s.ZOOM="zoom",s.HAND="hand",s.IMAGE_FRAME="imageFrame",s.TEXT_FRAME="textFrame",s.SHAPE_RECT="rect",s.SHAPE_ELLIPSE="ellipse",s.SHAPE_POLYGON="polygon",s))($||{}),Js=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s.HTML="html",s))(Js||{}),ae=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(ae||{});class Us{constructor(o){g(this,Mt);this.setTool=async t=>(await a(this,Mt)).setTool(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,Mt)).getSelectedTool().then(e=>i(e)),this.setPointer=async()=>this.setTool($.SELECT),this.setSelect=async()=>this.setTool($.SELECT),this.setHand=async()=>this.setTool($.HAND),this.setZoom=async()=>this.setTool($.ZOOM),this.setTextFrame=async()=>this.setTool($.TEXT_FRAME),this.setImageFrame=async()=>this.setTool($.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool($.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool($.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool($.SHAPE_POLYGON),y(this,Mt,o)}}Mt=new WeakMap;class ks{constructor(o,t){g(this,tt);g(this,W);g(this,jt);this.undo=async()=>(await a(this,tt)).undo().then(r=>i(r)),this.redo=async()=>(await a(this,tt)).redo().then(r=>i(r)),this.addCustomData=async(e,r)=>(await a(this,tt)).setCustomUndoData(e,r,!1).then(c=>i(c)),this.record=async(e,r)=>{try{await a(this,W).beginIfNoneActive(e),await r(a(this,jt)),await a(this,W).end()}catch(n){throw await a(this,W).abort(),n}},this.pause=async()=>(await a(this,tt)).pause().then(r=>i(r)),this.resume=async()=>(await a(this,tt)).resume().then(r=>i(r)),this.advanced={begin:async e=>a(this,W).begin(e),beginIfNoneActive:async e=>a(this,W).beginIfNoneActive(e),end:async()=>a(this,W).end(),abort:async()=>a(this,W).abort()},y(this,tt,o),y(this,jt,t),y(this,W,new Fn(o))}}tt=new WeakMap,W=new WeakMap,jt=new WeakMap;class Fn{constructor(o){g(this,ut);this.begin=async t=>(await a(this,ut)).begin(t).then(r=>i(r)),this.beginIfNoneActive=async t=>(await a(this,ut)).beginIfNoneActive(t).then(r=>i(r)),this.end=async()=>(await a(this,ut)).end().then(e=>i(e)),this.abort=async()=>(await a(this,ut)).abort().then(e=>i(e)),y(this,ut,o)}}ut=new WeakMap;const En=(s,o=2)=>{const t=Math.pow(10,o);return Math.round(s*t)/t};class _s{constructor(o,t){g(this,qt);g(this,Nt);this.round=(e,r)=>i({data:String(En(e,r)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=e=>{const{type:r=ae.SANDBOX,environment:n="ft-nostress",version:c="1"}=e,u=r==ae.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${n}.${u}.online/grafx/api/v${c}/environment/${n}`},this.stageFiles=async(e,r,n)=>{const c=a(this,Nt).get(q.GraFxStudioEnvironmentApiUrl);if(!c)throw new Error("GraFx Studio Environment API URL is not set");const u=`${c}connectors/${r}/stage`,l=a(this,Nt).get(q.GraFxStudioAuthToken);if(!l)throw new Error("GraFx Studio Auth Token is not set");const C=new FormData;e.forEach((b,v)=>{const P=b instanceof File?b.name:`blob-${v}`;C.append("files",b,P)}),n&&C.append("validationJson",JSON.stringify({allowedMimeTypes:n.mimeTypes,minDimensions:{width:n.minWidthPixels,height:n.minHeightPixels}}));const p=await fetch(u,{method:"POST",body:C,headers:{Authorization:`Bearer ${l}`}});if(p.status===422){const b=await p.json();throw new ts(b.message,ue.minDimension)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},this.unitEvaluate=async(e,r)=>(await a(this,qt)).unitEvaluate(e,r).then(c=>i(c)),y(this,qt,o),y(this,Nt,t)}}qt=new WeakMap,Nt=new WeakMap;class Dn{constructor(o){g(this,Yt);this.setMinimum=async(t,e)=>{const r={minValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setMaximum=async(t,e)=>{const r={maxValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setShowStepper=async(t,e)=>{const r={showStepper:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStepSize=async(t,e)=>{const r={stepSize:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setThousandsSeparator=async(t,e)=>{const r={thousandsSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalSeparator=async(t,e)=>{const r={decimalSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalCharacterStyle=async(t,e)=>{const r={decimalCharacterStyleId:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setNumberOfDecimals=async(t,e)=>{const r={numberOfDecimals:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Yt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Yt)).updateNumberVariableProperties(o,JSON.stringify(t));return i(r)}}Yt=new WeakMap;class On{constructor(o){g(this,Zt);this.setDisplayFormat=async(t,e)=>{const r={displayFormat:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setLocale=async(t,e)=>{const r={locale:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStartDate=async(t,e)=>{const r={startDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setEndDate=async(t,e)=>{const r={endDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setExcludedDays=async(t,e)=>{const r={excludedDays:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Zt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Zt)).updateDateVariableProperties(o,JSON.stringify(t));return i(r)}}Zt=new WeakMap;let xs=(Sr=class{constructor(o){g(this,w);g(this,Rt);g(this,Vt);this.getAll=async()=>(await a(this,w)).getVariables().then(e=>i(e)).then(e=>{const r=e;return r.parsedData&&(r.parsedData=this.makeVariablesBackwardsCompatible(r.parsedData)),r}),this.getById=async t=>(await a(this,w)).getVariableById(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.getByName=async t=>(await a(this,w)).getVariableByName(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.create=async(t,e)=>(await a(this,w)).addVariable(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,w)).removeVariables(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,w)).setVariableName(t,e).then(n=>i(n)),this.setLabel=async(t,e)=>(await a(this,w)).setVariableLabel(t,e).then(n=>i(n)),y(this,Rt,async(t,e)=>(await a(this,w)).setVariablePlaceholder(t,e).then(n=>i(n))),this.setPlaceholder=async(t,e)=>a(this,Rt).call(this,t,e),this.resetPlaceholder=async t=>a(this,Rt).call(this,t,null),y(this,Vt,async(t,e)=>(await a(this,w)).setVariableHelpText(t,e).then(n=>i(n))),this.setHelpText=async(t,e)=>a(this,Vt).call(this,t,e),this.resetHelpText=async t=>a(this,Vt).call(this,t,null),this.setType=async(t,e)=>(await a(this,w)).setVariableType(t,e).then(n=>i(n)),this.setListVariable=async(t,e)=>(await a(this,w)).setListVariableItems(t,e.map(n=>JSON.stringify({value:n}))).then(n=>i(n)),this.setValue=async(t,e)=>(await a(this,w)).setVariableValue(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,w)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,e)=>(await a(this,w)).groupVariables(t,e).then(n=>i(n)),this.ungroupVariables=async t=>(await a(this,w)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,e,r)=>(await a(this,w)).moveVariable(e,r,t).then(c=>i(c)),this.moveVariables=async(t,e,r)=>(await a(this,w)).moveVariables(e,r,t).then(c=>i(c)),this.setIsVisible=async(t,e)=>{const r=e?{type:Et.visible}:{type:Et.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,e)=>{const r=e?{type:Et.invisible}:{type:Et.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,e)=>(await a(this,w)).setVariableVisibility(t,JSON.stringify(e)).then(n=>i(n)),this.setLayoutsForVariableVisibility=async t=>(await a(this,w)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,e)=>(await a(this,w)).setVariableIsRequired(t,e).then(n=>i(n)),this.setRemoveParagraphIfEmpty=async(t,e)=>(await a(this,w)).setVariableRemoveParagraphIfEmpty(t,e).then(n=>i(n)),this.setIsReadonly=async(t,e)=>(await a(this,w)).setVariableIsReadonly(t,e).then(n=>i(n)),this.getImageVariableConnectorId=async t=>(await a(this,w)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,e)=>{const r=await a(this,w),c=new ge().makeConnectorSourceForwardsCompatible(e);return r.setImageVariableConnector(t,JSON.stringify(c)).then(u=>i(u))},this.setImageVariableValueWithContext=async(t,e,r)=>(await a(this,w)).setImageVariableValueWithContext(t,e,JSON.stringify(r)).then(c=>i(c)),this.removeSource=async t=>this.setValue(t,null),this.setPrefix=async(t,e)=>{const r={prefix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffix=async(t,e)=>{const r={suffix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrefixCharacterStyle=async(t,e)=>{const r={prefixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffixCharacterStyle=async(t,e)=>{const r={suffixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrivateData=async(t,e)=>(await a(this,w)).setVariablePrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,w)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,e)=>(await a(this,w)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowImageUpload=async(t,e)=>(await a(this,w)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinImageUploadSize=async(t,e,r)=>(await a(this,w)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setIsDontBreak=async(t,e)=>(await a(this,w)).setVariableIsDontBreak(t,e).then(n=>i(n)),y(this,w,o),this.number=new Dn(a(this,w)),this.date=new On(a(this,w))}makeVariablesBackwardsCompatible(o){return o.map(t=>this.makeVariableBackwardsCompatible(t))}makeVariableBackwardsCompatible(o){return o.type!==ne.list?o:this.makeListVariableBackwardsCompatible(o)}makeListVariableBackwardsCompatible(o){const t=o,e=o.items,r=o.selected,n=e.map(c=>c.value);return t.items=n,t.selected=r==null?void 0:r.value,t}async applyPrefixSuffixDeltaUpdate(o,t){const r=await(await a(this,w)).updateVariablePrefixSuffixProperties(o,JSON.stringify(t));return i(r)}},w=new WeakMap,Rt=new WeakMap,Vt=new WeakMap,Sr);class Ln{constructor(o){this.onVariableListChanged=t=>{this.config.events.onVariableListChanged.trigger(JSON.parse(t))},this.onConnectorsChanged=t=>{this.config.events.onConnectorsChanged.trigger(JSON.parse(t))},this.onPageSizeChanged=t=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(t))},this.onEngineEditModeChanged=t=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(t))},this.config=o}}class Mn{constructor(o){g(this,gt);this.getAll=async()=>(await a(this,gt)).getVariables().then(e=>i(e)),this.getById=async t=>(await a(this,gt)).getVariableById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,gt)).getVariableByName(t).then(r=>i(r)),this.setListVariable=async(t,e)=>(await a(this,gt)).setListVariableItems(t,e.map(n=>JSON.stringify(n))).then(n=>i(n)),y(this,gt,o),this.image=new Nn(o)}}gt=new WeakMap;class Nn{constructor(o){g(this,et);this.setAllowQuery=async(t,e)=>(await a(this,et)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowUpload=async(t,e)=>(await a(this,et)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinUploadSize=async(t,e,r)=>(await a(this,et)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setConnector=async(t,e)=>(await a(this,et)).setImageVariableConnector(t,JSON.stringify(e)).then(n=>i(n)),this.setConnectorContext=async(t,e)=>(await a(this,et)).setImageVariableConnectorContext(t,JSON.stringify(e)).then(n=>i(n)),y(this,et,o)}}et=new WeakMap;class Rn{constructor(o){g(this,vt);this.register=async t=>(await a(this,vt)).registerConnector(JSON.stringify(t)).then(r=>i(r)),this.getById=async t=>(await a(this,vt)).getConnectorById(t).then(r=>i(r)),this.getAllByType=async t=>(await a(this,vt)).getConnectors(t).then(r=>i(r)),y(this,vt,o)}}vt=new WeakMap;class Vn{constructor(o){g(this,Tt);g(this,ie);this.setWidth=async t=>(await a(this,Tt)).setPageWidth(t).then(r=>i(r)),this.setHeight=async t=>(await a(this,Tt)).setPageHeight(t).then(r=>i(r)),y(this,Tt,o),y(this,ie,o)}}Tt=new WeakMap,ie=new WeakMap;class Hs{constructor(o,t,e){this.config=o,this.connection=t,this.editorAPI=e,this.subscriber=new Ln(o),this.variable=new Mn(this.editorAPI),this.connector=new Rn(this.editorAPI),this.page=new Vn(this.editorAPI),this.canvas=new de(this.editorAPI)}}class Ks{constructor(o){this.logger=o}createEventHandlerFn(o,t){return(...r)=>{try{const n=o(...r);return n instanceof Promise?n.catch(c=>this.handleError(c,t,o.name)):n}catch(n){this.handleError(n,t,o.name)}}}handleError(o,t,e){var r;if(t===_t.log)(r=this.logger)==null||r.call(this,T.error,Ds.event,`Error in callback ${e}: ${o}`);else throw o}}class $s extends Ks{constructor(o,t){super(t),this.handler=o}trigger(...o){const t=this.handler();if(t)return this.createEventHandlerFn(t,_t.throw)(...o)}}class m extends Ks{constructor(o,t){super(t),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const t=this.legacyHandler();t&&this.createEventHandlerFn(t,_t.log)(...o);for(const e of this.subscriptions)e(...o)}registerCallback(o,t=_t.log){const e=this.createEventHandlerFn(o,t);return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}}class me{static createRuntimeConfig(o){var e,r,n,c,u,l,C,p,I,b,v,P,A,S,x,L,F,st,rt,Gt,Jt,br,vr,Ir,Ar,Pr,Fr,Er,Dr,Or,Lr,Mr,Nr,Rr,Vr;const t={...o};return t.logging={logLevel:((e=o.logging)==null?void 0:e.logLevel)||T.error,logger:((r=o.logging)==null?void 0:r.logger)||((Qt,we,fe)=>{var Tr;if(me.isLoggingEnabled(Qt,((Tr=t.logging)==null?void 0:Tr.logLevel)??T.error))switch(Qt){case T.error:console.error(`[${we}] [${Qt}] ${fe}`);break;case T.warn:console.warn(`[${we}] [${Qt}] ${fe}`);break;default:console.log(`[${we}] [${Qt}] ${fe}`)}})},t.handlers={onAuthExpired:new $s(()=>t.onAuthExpired,(n=t.logging)==null?void 0:n.logger),onViewportRequested:new $s(()=>t.onViewportRequested,(c=t.logging)==null?void 0:c.logger)},t.events={onActionsChanged:new m(()=>t.onActionsChanged,(u=t.logging)==null?void 0:u.logger),onStateChanged:new m(()=>t.onStateChanged,(l=t.logging)==null?void 0:l.logger),onDocumentLoaded:new m(()=>t.onDocumentLoaded,(C=t.logging)==null?void 0:C.logger),onSelectedFramesLayoutChanged:new m(()=>t.onSelectedFramesLayoutChanged,(p=t.logging)==null?void 0:p.logger),onFramesLayoutChanged:new m(()=>t.onFramesLayoutChanged,(I=t.logging)==null?void 0:I.logger),onSelectedFramesContentChanged:new m(()=>t.onSelectedFramesContentChanged,(b=t.logging)==null?void 0:b.logger),onPageSelectionChanged:new m(()=>t.onPageSelectionChanged,(v=t.logging)==null?void 0:v.logger),onSelectedLayoutPropertiesChanged:new m(()=>t.onSelectedLayoutPropertiesChanged,(P=t.logging)==null?void 0:P.logger),onSelectedLayoutUnitChanged:new m(()=>t.onSelectedLayoutUnitChanged,(A=t.logging)==null?void 0:A.logger),onScrubberPositionChanged:new m(()=>t.onScrubberPositionChanged,(S=t.logging)==null?void 0:S.logger),onFrameAnimationsChanged:new m(()=>t.onFrameAnimationsChanged,(x=t.logging)==null?void 0:x.logger),onVariableListChanged:new m(()=>t.onVariableListChanged,(L=t.logging)==null?void 0:L.logger),onSelectedToolChanged:new m(()=>t.onSelectedToolChanged,(F=t.logging)==null?void 0:F.logger),onUndoStackStateChanged:new m(()=>t.onUndoStackStateChanged,(st=t.logging)==null?void 0:st.logger),onSelectedLayoutFramesChanged:new m(()=>t.onSelectedLayoutFramesChanged,(rt=t.logging)==null?void 0:rt.logger),onSelectedTextStyleChanged:new m(()=>t.onSelectedTextStyleChanged,(Gt=t.logging)==null?void 0:Gt.logger),onColorsChanged:new m(()=>t.onColorsChanged,(Jt=t.logging)==null?void 0:Jt.logger),onParagraphStylesChanged:new m(()=>t.onParagraphStylesChanged,(br=t.logging)==null?void 0:br.logger),onCharacterStylesChanged:new m(()=>t.onCharacterStylesChanged,(vr=t.logging)==null?void 0:vr.logger),onFontFamiliesChanged:new m(()=>t.onFontFamiliesChanged,(Ir=t.logging)==null?void 0:Ir.logger),onSelectedLayoutIdChanged:new m(()=>t.onSelectedLayoutIdChanged,(Ar=t.logging)==null?void 0:Ar.logger),onLayoutsChanged:new m(()=>t.onLayoutsChanged,(Pr=t.logging)==null?void 0:Pr.logger),onConnectorEvent:new m(()=>t.onConnectorEvent,(Fr=t.logging)==null?void 0:Fr.logger),onConnectorsChanged:new m(()=>t.onConnectorsChanged,(Er=t.logging)==null?void 0:Er.logger),onZoomChanged:new m(()=>t.onZoomChanged,(Dr=t.logging)==null?void 0:Dr.logger),onSelectedPageIdChanged:new m(()=>t.onSelectedPageIdChanged,t.logging.logger),onPagesChanged:new m(()=>t.onPagesChanged,t.logging.logger),onPageSnapshotInvalidated:new m(()=>t.onPageSnapshotInvalidated,t.logging.logger),onPageSizeChanged:new m(()=>t.onPageSizeChanged,(Or=t.logging)==null?void 0:Or.logger),onShapeCornerRadiusChanged:new m(()=>t.onShapeCornerRadiusChanged,(Lr=t.logging)==null?void 0:Lr.logger),onCropActiveFrameIdChanged:new m(()=>t.onCropActiveFrameIdChanged,(Mr=t.logging)==null?void 0:Mr.logger),onAsyncError:new m(()=>t.onAsyncError,(Nr=t.logging)==null?void 0:Nr.logger),onViewModeChanged:new m(()=>t.onViewModeChanged,(Rr=t.logging)==null?void 0:Rr.logger),onBarcodeValidationChanged:new m(()=>t.onBarcodeValidationChanged,(Vr=t.logging)==null?void 0:Vr.logger),onDataSourceIdChanged:new m(()=>t.onDataSourceIdChanged,t.logging.logger),onDocumentIssueListChanged:new m(()=>t.onDocumentIssueListChanged,t.logging.logger),onCustomUndoDataChanged:new m(()=>t.onCustomUndoDataChanged,t.logging.logger),onEngineEditModeChanged:new m(()=>t.onEngineEditModeChanged,t.logging.logger),onBrandKitMediaChanged:new m(()=>t.onBrandKitMediaChanged,t.logging.logger)},t}static isLoggingEnabled(o,t){return t==T.info||t==T.warn&&(o==T.warn||o==T.error)?!0:t==T.error&&o==T.error}}class Tn{isDatePropertyWrapper(o){return typeof o=="object"&&(o==null?void 0:o.type)==="date"}isDateObject(o){return o instanceof Date}mapEngineToDataItem(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDatePropertyWrapper(r)?new Date(r.value):r}),t}mapDataItemToEngine(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDateObject(r)?{value:r.getTime(),type:"date"}:r}),t}}class Bn{constructor(o){g(this,yt);y(this,yt,o)}async getValue(o){return(await a(this,yt)).getConfigValue(o).then(e=>i(e))}async setValue(o,t){return(await a(this,yt)).setConfigValue(o,t).then(r=>i(r))}async updateStudioOptions(o){return(await a(this,yt)).updateStudioOptions(JSON.stringify(o)).then(e=>i(e))}async getEngineSessionId(){return(await a(this,yt)).getEngineSessionId().then(t=>i(t))}}yt=new WeakMap;class zs extends Bn{constructor(t,e){super(t);g(this,Bt);y(this,Bt,e)}async getValue(t){const e=a(this,Bt).get(t);return e!=null?i({status:200,success:!0,parsedData:e,data:e},!1):super.getValue(t)}async setValue(t,e){const r=super.setValue(t,e);return a(this,Bt).set(t,e),r}}Bt=new WeakMap;class Ws{constructor(o){g(this,_);this.getAll=async()=>(await a(this,_)).getGradients().then(e=>i(e)),this.getById=async t=>(await a(this,_)).getGradientById(t).then(r=>i(r)),this.create=async()=>(await a(this,_)).createGradient().then(e=>i(e)),this.duplicate=async t=>(await a(this,_)).duplicateGradient(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,_)).moveGradients(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,_)).renameGradient(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,_),n=e;return r.updateGradient(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,_)).removeGradient(t).then(r=>i(r)),y(this,_,o)}}_=new WeakMap;const Gn=`https://studio-cdn.chiligrafx.com/editor/${R.current}/web`;let at;class Jn{constructor(o){this.localConfig=new Map,this.dataItemMappingTools=new Tn,this.loadEditor=()=>{var t;hn(this.config.editorLink||Gn,{onActionsChanged:this.subscriber.onActionsChanged,onStateChanged:this.subscriber.onStateChanged,onAuthExpired:this.subscriber.onAuthExpired,onViewportRequested:this.subscriber.onViewportRequested,onDocumentLoaded:this.subscriber.onDocumentLoaded,onSelectedFramesContentChanged:this.subscriber.onSelectedFramesContentChanged,onSelectedFramesLayoutChanged:this.subscriber.onSelectedFramesLayoutChanged,onFramesLayoutChanged:this.subscriber.onFramesLayoutChanged,onSelectedLayoutPropertiesChanged:this.subscriber.onSelectedLayoutPropertiesChanged,onSelectedLayoutUnitChanged:this.subscriber.onSelectedLayoutUnitChanged,onPageSelectionChanged:this.subscriber.onPageSelectionChanged,onScrubberPositionChanged:this.subscriber.onAnimationPlaybackChanged,onFrameAnimationsChanged:this.subscriber.onAnimationChanged,onVariableListChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onVariableListChanged?this.next.subscriber.onVariableListChanged(e):this.subscriber.onVariableListChanged(e)},onSelectedToolChanged:this.subscriber.onSelectedToolChanged,onUndoStateChanged:this.subscriber.onUndoStateChanged,onSelectedLayoutFramesChanged:this.subscriber.onSelectedLayoutFramesChanged,onSelectedTextStyleChanged:this.subscriber.onSelectedTextStyleChanged,onColorsChanged:this.subscriber.onColorsChanged,onParagraphStylesChanged:this.subscriber.onParagraphStylesChanged,onCharacterStylesChanged:this.subscriber.onCharacterStylesChanged,onFontFamiliesChanged:this.subscriber.onFontFamiliesChanged,onSelectedLayoutIdChanged:this.subscriber.onSelectedLayoutIdChanged,onLayoutsChanged:this.subscriber.onLayoutsChanged,onConnectorEvent:this.subscriber.onConnectorEvent,onConnectorsChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onConnectorsChanged?this.next.subscriber.onConnectorsChanged(e):this.subscriber.onConnectorsChanged(e)},onZoomChanged:this.subscriber.onZoomChanged,onSelectedPageIdChanged:this.subscriber.onSelectedPageIdChanged,onPagesChanged:this.subscriber.onPagesChanged,onPageSnapshotInvalidated:this.subscriber.onPageSnapshotInvalidated,onPageSizeChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onPageSizeChanged?this.next.subscriber.onPageSizeChanged(e):this.subscriber.onPageSizeChanged(e)},onShapeCornerRadiusChanged:this.subscriber.onShapeCornerRadiusChanged,onCropActiveFrameIdChanged:this.subscriber.onCropActiveFrameIdChanged,onAsyncError:this.subscriber.onAsyncError,onViewModeChanged:this.subscriber.onViewModeChanged,onBarcodeValidationChanged:this.subscriber.onBarcodeValidationChanged,onDataSourceIdChanged:this.subscriber.onDataSourceIdChanged,onDocumentIssueListChanged:this.subscriber.onDocumentIssueListChanged,onCustomUndoDataChanged:this.subscriber.onCustomUndoDataChanged,onEngineEditModeChanged:this.subscriber.onEngineEditModeChanged,onBrandKitMediaChanged:this.subscriber.onBrandKitMediaChanged},this.setConnection,this.config.editorId,this.config.studioStyling),this.editorAPI=at==null?void 0:at.promise.then(e=>e),this.action=new De(this.editorAPI),this.layout=new As(this.editorAPI),this.frame=new vs(this.editorAPI),this.barcode=new Te(this.editorAPI),this.animation=new Oe(this.editorAPI),this.document=new as(this.editorAPI),this.configuration=new zs(this.editorAPI,this.localConfig),this.utils=new _s(this.editorAPI,this.localConfig),this.tool=new Us(this.editorAPI),this.page=new Fs(this.editorAPI),this.debug=new ns(this.editorAPI),this.undoManager=new ks(this.editorAPI,this),this.textSelection=new Ts(this.editorAPI),this.colorStyle=new He(this.editorAPI),this.gradientStyle=new Ws(this.editorAPI),this.paragraphStyle=new Es(this.editorAPI),this.characterStyle=new ke(this.editorAPI),this.mediaConnector=new Ps(this.editorAPI),this.fontConnector=new Ss(this.editorAPI),this.dataConnector=new ss(this.editorAPI,this.dataItemMappingTools),this.dataSource=new rs(this.editorAPI,this.dataItemMappingTools),this.connector=new es(this.editorAPI,this.localConfig),this.variable=new xs(this.editorAPI),this.font=new bs(this.editorAPI),this.experiment=new fs(this.editorAPI),this.canvas=new de(this.editorAPI),this.shape=new pe(this.editorAPI),this.colorConversion=new xe(this.editorAPI),this.info=new Is,this.clipboard=new _e(this.editorAPI),this.brandKit=new Ue(this.editorAPI,this),this.next=new Hs(this.config,this.connection,this.editorAPI),this.configuration.setValue(q.GraFxStudioSdkVersion,Se.version),this.configuration.setValue(q.GraFxStudioDocumentType,this.config.documentType||he.template),this.configuration.updateStudioOptions(this.config.studioOptions||ln),this.configuration.setValue(q.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{at=t},this.config=me.createRuntimeConfig(o),this.connection=at,this.editorAPI=at==null?void 0:at.promise.then(t=>t),this.action=new De(this.editorAPI),this.layout=new As(this.editorAPI),this.frame=new vs(this.editorAPI),this.shape=new pe(this.editorAPI),this.barcode=new Te(this.editorAPI),this.undoManager=new ks(this.editorAPI,this),this.connector=new es(this.editorAPI,this.localConfig),this.mediaConnector=new Ps(this.editorAPI),this.fontConnector=new Ss(this.editorAPI),this.dataConnector=new ss(this.editorAPI,this.dataItemMappingTools),this.dataSource=new rs(this.editorAPI,this.dataItemMappingTools),this.animation=new Oe(this.editorAPI),this.document=new as(this.editorAPI),this.configuration=new zs(this.editorAPI,this.localConfig),this.variable=new xs(this.editorAPI),this.utils=new _s(this.editorAPI,this.localConfig),this.subscriber=new Pn(this.config,this.localConfig),this.tool=new Us(this.editorAPI),this.page=new Fs(this.editorAPI),this.debug=new ns(this.editorAPI),this.textSelection=new Ts(this.editorAPI),this.colorStyle=new He(this.editorAPI),this.gradientStyle=new Ws(this.editorAPI),this.paragraphStyle=new Es(this.editorAPI),this.characterStyle=new ke(this.editorAPI),this.font=new bs(this.editorAPI),this.experiment=new fs(this.editorAPI),this.canvas=new de(this.editorAPI),this.colorConversion=new xe(this.editorAPI),this.info=new Is,this.clipboard=new _e(this.editorAPI),this.next=new Hs(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=new Ue(this.editorAPI,this)}}var js=(s=>(s.top="top",s.left="left",s.right="right",s.bottom="bottom",s.topLeft="topLeft",s.topRight="topRight",s.bottomLeft="bottomLeft",s.bottomRight="bottomRight",s))(js||{}),qs=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(qs||{}),Ys=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))(Ys||{}),Zs=(s=>(s.quadratic="Quadratic",s.cubic="Cubic",s.quartic="Quartic",s.quintic="Quintic",s.sine="Sine",s.exponential="Exponential",s.circular="Circular",s.elastic="Elastic",s.bounce="Bounce",s.back="Back",s))(Zs||{}),Qs=(s=>(s.bounce="bounce",s.flash="flash",s.headshake="headShake",s.heartbeat="heartbeat",s.pulse="pulse",s.rubberBand="rubberBand",s.vertical="vertical",s.horizontal="horizontal",s.swing="swing",s.tada="tada",s))(Qs||{}),Xs=(s=>(s.preview="preview",s.normal="normal",s))(Xs||{}),tr=(s=>(s.linear="linear",s))(tr||{}),er=(s=>(s.local="linearLocal",s.linearBrandKit="linearBrandKit",s))(er||{}),sr=(s=>(s.Square="square",s.Line="line",s))(sr||{}),rr=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(rr||{}),nr=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(nr||{}),ar=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(ar||{}),ir=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(ir||{}),or=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(or||{}),cr=(s=>(s.none="none",s.bullet="bullet",s.number="number",s))(cr||{}),hr=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(hr||{}),lr=(s=>(s.PARAGRAPH="paragraphStyleId",s.CHARACTER="characterStyleId",s.FONT_FAMILY="fontKey",s.FONT_STYLE="fontStyle",s.FONT_SIZE="fontSize",s.LETTER_SPACING="letterSpacing",s.LINE_HEIGHT="lineHeight",s.TEXT_ALIGN="textAlign",s.VERTICAL_ALIGN="verticalAlign",s.TYPOGRAPHIC_CASE="typographicCase",s.SUB_SUPER_SCRIPT="subSuperScript",s.UNDERLINE="underline",s.LINE_THROUGH="lineThrough",s.FILL_COLOR="fillColor",s.COLOR="color",s.FILL_COLOR_APPLIED="fillColorApplied",s.STROKE_COLOR="strokeColor",s.STROKE_COLOR_APPLIED="strokeColorApplied",s.DROP_SHADOW_COLOR="dropShadowColor",s.BLEND_MODE="blendMode",s.OPACITY="opacity",s.TRACKING_RIGHT="trackingRight",s.BASELINE_SHIFT="baselineShiftValue",s.STROKE_WIDTH="strokeWidth",s.MARKED_LIST_TYPE="markedListType",s.MARKED_LIST_GROUP="markedListGroup",s.MARKED_LIST_LEVEL="markedListLevel",s))(lr||{}),dr=(s=>(s.arabic="arabic",s.romanUpperCase="romanUpperCase",s.romanLowerCase="romanLowerCase",s.latinUpperCase="latinUpperCase",s.latinLowerCase="latinLowerCase",s))(dr||{}),ur=(s=>(s.none="none",s.dash="dash",s.dot="dot",s.colon="colon",s.roundBracket="roundBracket",s))(ur||{}),gr=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(gr||{}),yr=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s))(yr||{}),pr=(s=>(s.all="all",s.only="only",s.none="none",s))(pr||{}),Cr=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s.gradient="gradient",s))(Cr||{}),mr=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(mr||{});const Un=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:mr},Symbol.toStringTag,{value:"Module"}));h.ActionAsyncError=Os,h.ActionEditorEvent=gr,h.Alignment=nr,h.AnchorTargetEdgeType=ws,h.AnchorTargetType=ms,h.AuthCredentialsTypeEnum=Qe,h.AuthRefreshTypeEnum=Xe,h.AutoGrowDirection=is,h.BarcodeCharacterSet=Ct,h.BarcodeErrorCorrectionLevel=It,h.BarcodeSourceTypeEnum=cs,h.BarcodeType=H,h.BarcodeValidationResult=Le,h.BasicAnimationsEmphasisStyles=Qs,h.BlendMode=us,h.Case=ir,h.ColorType=Z,h.ColorUsageType=Xt,h.ConnectorConfigContextType=je,h.ConnectorConfigValueType=We,h.ConnectorEventType=Ze,h.ConnectorHttpError=Ee,h.ConnectorMapping=mn,h.ConnectorMappingDirection=Ye,h.ConnectorMappingSource=qe,h.ConnectorRegistrationSource=Ft,h.ConnectorStateType=se,h.ConnectorType=Ke,h.ConstraintMode=Ve,h.CornerRadiusType=pr,h.CropType=ye,h.DataRowAsyncError=Ls,h.Day=Ms,h.DeprecatedMediaConnectorDownloadType=ee,h.DeprecatedMediaType=At,h.DocumentIssueTypeEnum=Pe,h.DocumentType=he,h.DownloadFormats=Js,h.EaseTypes=Ys,h.EngineEditModeType=Cr,h.EnvironmentType=ae,h.FitMode=gs,h.FitModePosition=ys,h.FlowDirection=ls,h.FontPreviewFormat=sr,h.FontWeights=rr,h.FrameAnchorTarget=In,h.FrameAnchorType=Cs,h.FramePropertyNames=Bs,h.FrameTypeEnum=os,h.GradientType=tr,h.GradientUsageType=er,h.GrafxTokenAuthCredentials=fn,h.ImageSourceTypeEnum=kt,h.LayoutIntent=Re,h.LayoutPropertyNames=Gs,h.LayoutType=Me,h.Locale=Ns,h.MarkedListType=cr,h.MeasurementUnit=Ne,h.MediaDownloadIntent=Ce,h.MediaDownloadType=re,h.MediaType=Pt,h.Next=Un,h.NumberListFormat=dr,h.NumberListSeparatorSymbol=ur,h.PageAnchorTarget=vn,h.PositionEnum=Y,h.RefreshedAuthCredendentials=Sn,h.Scripting=or,h.SelectedTextStyleSections=hr,h.SelectedTextStyles=lr,h.ShakeDirections=qs,h.ShapeType=yr,h.SlideDirections=js,h.SortBy=$e,h.SortOrder=ze,h.TextDirection=hs,h.TextPosition=ar,h.ToolType=$,h.TweenTypes=Zs,h.UpdateZIndexMethod=ps,h.UploadAssetValidationError=ts,h.UploadAssetValidationErrorType=ue,h.VariableType=ne,h.VariableVisibilityOperator=Vs,h.VariableVisibilityTargetType=Rs,h.VariableVisibilityType=Et,h.VerticalAlign=ds,h.ViewMode=Xs,h.WellKnownConfigurationKeys=q,h.default=Jn,h.grafxMediaConnectorRegistration=wn,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
7
+ </head>
8
+ <body>
9
+ <script>
10
+ const handleIframeError = (event) => {
11
+ if (window.parent && window.parent !== window) {
12
+ window.parent.postMessage(
13
+ {
14
+ type: 'iframe-error',
15
+ error: {
16
+ message: event.message,
17
+ filename: event.filename,
18
+ lineno: event.lineno,
19
+ colno: event.colno,
20
+ error: event.error?.toString(),
21
+ },
22
+ },
23
+ window.location.ancestorOrigins[0] || window.location.origin,
24
+ );
25
+ }
26
+ };
27
+ const handleUnhandledRejection = (event) => {
28
+ if (window.parent && window.parent !== window) {
29
+ window.parent.postMessage(
30
+ {
31
+ type: 'iframe-error',
32
+ error: { message: event.reason?.toString() || 'Unhandled promise rejection' },
33
+ },
34
+ window.location.ancestorOrigins[0] || window.location.origin,
35
+ );
36
+ }
37
+ };
38
+ window.addEventListener('error', handleIframeError);
39
+ window.addEventListener('unhandledrejection', handleUnhandledRejection);
40
+ <\/script>
41
+ <script src="${e}init.js" async><\/script>
42
+ <script src="${e}flutter_bootstrap.js"><\/script>
43
+ <script>
44
+ try {
45
+ if(!window?.initializeStudioEngine){
46
+ throw new Error('Failed to initialize studio engine: initializeStudioEngine not found');
47
+ }
48
+ initializeStudioEngine({
49
+ assetBase: '${e}',
50
+ });
51
+ } catch(error) {
52
+ if (window.parent && window.parent !== window) {
53
+ window.parent.postMessage({
54
+ type: 'iframe-error',
55
+ error: {
56
+ message: error?.message || 'Error initializing studio engine',
57
+ error: error?.toString()
58
+ }
59
+ }, window.location.ancestorOrigins[0] || window.location.origin);
60
+ }
61
+ throw error;
62
+ } finally {
63
+ window.removeEventListener('error', handleIframeError);
64
+ window.removeEventListener('unhandledrejection', handleUnhandledRejection);
65
+ }
66
+ <\/script>
67
+ </body>
68
+ </html>`;s.srcdoc=n};let se=null;const mn=(s,o,t,e="chili-editor",r,n)=>{se&&window.removeEventListener("message",se);const c=`#${e}`,l=document.createElement("iframe");l.setAttribute("srcdoc"," "),l.setAttribute("title","Chili-Editor"),l.setAttribute("style","width: 100%; height: 100%;"),l.setAttribute("frameBorder","0"),l.setAttribute("referrerpolicy","origin");const d=()=>{const C=document.querySelector(c);if(C){C==null||C.appendChild(l),l.addEventListener("error",()=>{const p=new Error("Failed to setup frame: iframe failed to load");n==null||n(p)},{capture:!0,once:!0});try{wn(l,s,r)}catch(p){p instanceof Error?n==null||n(p):n==null||n(new Error(`Failed to setup frame: ${p}`))}}};document.readyState==="complete"||document.readyState==="interactive"?d():document.addEventListener("DOMContentLoaded",()=>{d()}),se=C=>{var p;if(C.source===l.contentWindow&&((p=C.data)==null?void 0:p.type)==="iframe-error"){const I=C.data.error,S=new Error(I.message||"Failed to setup frame: error in iframe");n==null||n(S)}},window.addEventListener("message",se),t(pn({iframe:l,methods:{actionsChanged:o.onActionsChanged,stateChanged:o.onStateChanged,documentLoaded:o.onDocumentLoaded,authExpired:o.onAuthExpired,viewportRequested:o.onViewportRequested,selectedFramesContent:o.onSelectedFramesContentChanged,selectedFramesLayout:o.onSelectedFramesLayoutChanged,allFramesLayout:o.onFramesLayoutChanged,selectedLayoutProperties:o.onSelectedLayoutPropertiesChanged,openLayoutPropertiesPanel:o.onPageSelectionChanged,selectedLayoutUnit:o.onSelectedLayoutUnitChanged,scrubberPositionChanged:o.onScrubberPositionChanged,frameAnimationsChanged:o.onFrameAnimationsChanged,selectedToolChanged:o.onSelectedToolChanged,variableListChanged:o.onVariableListChanged,undoStackStateChanged:o.onUndoStateChanged,selectedLayoutFramesChanged:o.onSelectedLayoutFramesChanged,selectedTextStyleChanged:o.onSelectedTextStyleChanged,colorsChanged:o.onColorsChanged,paragraphStylesChanged:o.onParagraphStylesChanged,characterStylesChanged:o.onCharacterStylesChanged,fontFamiliesChanged:o.onFontFamiliesChanged,selectedLayoutId:o.onSelectedLayoutIdChanged,layoutListChanged:o.onLayoutsChanged,connectorEvent:o.onConnectorEvent,connectorsChanged:o.onConnectorsChanged,zoomChanged:o.onZoomChanged,pageSnapshotInvalidated:o.onPageSnapshotInvalidated,pagesChanged:o.onPagesChanged,pageSizeChanged:o.onPageSizeChanged,shapeCornerRadiusChanged:o.onShapeCornerRadiusChanged,cropActiveFrameIdChanged:o.onCropActiveFrameIdChanged,asyncError:o.onAsyncError,viewModeChanged:o.onViewModeChanged,barcodeValidationChanged:o.onBarcodeValidationChanged,selectedPageIdChanged:o.onSelectedPageIdChanged,dataSourceIdChanged:o.onDataSourceIdChanged,documentIssueListChanged:o.onDocumentIssueListChanged,customUndoDataChanged:o.onCustomUndoDataChanged,engineEditingModeChanged:o.onEngineEditModeChanged,brandKitMediaChanged:o.onBrandKitMediaChanged}}))};var Y=(s=>(s.GraFxStudioEnvironmentApiUrl="ENVIRONMENT_API",s.GraFxStudioSdkVersion="SDK_VERSION",s.GraFxStudioDocumentType="DOCUMENT_TYPE",s.GraFxStudioTemplateId="TEMPLATE_ID",s.GraFxStudioAuthToken="GRAFX_AUTH_TOKEN",s.QueryCallCacheEnabled="ENABLE_QUERY_CALL_CACHE",s))(Y||{}),Le=(s=>(s.full="full",s.followConstraints="followConstraints",s))(Le||{});const fn={shortcutOptions:{debugPanel:{enabled:!1},ellipse:{enabled:!1},hand:{enabled:!1},image:{enabled:!1},polygon:{enabled:!1},rectangle:{enabled:!1},select:{enabled:!1},text:{enabled:!1},zoom:{enabled:!1},copyPaste:{enabled:!1},viewMode:{enabled:!1}},frameEditingMode:"full"};var Me=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(Me||{}),ge=(s=>(s.project="project",s.template="template",s.component="component",s))(ge||{});const Sn=404075;function ye(s){const o=s.error??"Yikes, something went wrong",t={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===Sn){const r=JSON.parse(s.data).statusCode;throw new Ne(r,o,t)}else throw new Error(o,t)}function i(s,o=!0){try{s.success||ye(s);const t=s.data&&o;return{...s,parsedData:t?JSON.parse(s.data):s.data}}catch(t){throw console.error(t),t}}class Ne extends Error{constructor(o,t,e){super(t,e),this.statusCode=o}}class Re{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getActions().then(e=>i(e)),this.getById=async t=>(await a(this,V)).getActionById(t).then(r=>i(r)),this.create=async()=>(await a(this,V)).createAction().then(e=>i(e)),this.duplicate=async t=>(await a(this,V)).duplicateAction(t).then(r=>i(r)),this.remove=async t=>(await a(this,V)).removeAction(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,V)).updateAction(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>this.update(t,{name:e}),this.updateScript=async(t,e)=>this.update(t,{script:e}),this.updateTriggers=async(t,e)=>this.update(t,{triggers:e}),this.move=async(t,e)=>(await a(this,V)).moveActions(t,e).then(n=>i(n)),this.setTypeError=async(t,e)=>this.update(t,{hasTypeError:e}),this.disable=async()=>(await a(this,V)).disableActions().then(e=>i(e)),this.enable=async()=>(await a(this,V)).enableActions().then(e=>i(e)),y(this,V,o)}}V=new WeakMap;class Ve{constructor(o){g(this,M);this.getAllOnSelectedLayout=async()=>(await a(this,M)).getAnimationsOnSelectedLayout().then(e=>i(e)),this.getByFrameId=async(t,e)=>(await a(this,M)).getAnimationByFrameId(t,e).then(n=>i(n)),this.getByLayoutId=async t=>(await a(this,M)).getAnimationsByLayoutId(t).then(r=>i(r)),this.setFrameAnimation=async t=>(await a(this,M)).setFrameAnimation(JSON.stringify(t)).then(r=>i({...r,data:JSON.stringify(t)})),this.play=async()=>(await a(this,M)).playAnimation().then(e=>i(e)),this.pause=async()=>(await a(this,M)).pauseAnimation().then(e=>i(e)),this.setScrubberPosition=async t=>(await a(this,M)).setScrubberPosition(t).then(r=>i(r)),this.setDuration=async t=>(await a(this,M)).setAnimationDuration(t).then(r=>i(r)),this.resetFrameAnimation=async t=>(await a(this,M)).resetFrameAnimation(t).then(r=>i(r)),this.reset=async()=>(await a(this,M)).resetAnimation().then(e=>i(e)),y(this,M,o)}}M=new WeakMap;var x=(s=>(s.code39="code39",s.code93="code93",s.code128="code128",s.dataMatrix="dataMatrix",s.ean13="ean13",s.ean8="ean8",s.qr="qr",s.upca="upca",s.upce="upce",s.gs1128="gs1128",s))(x||{}),At=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(At||{}),Ct=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(Ct||{}),Te=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Te||{}),Be=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(Be||{}),Z=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(Z||{}),Ge=(s=>(s.top="top",s.child="child",s))(Ge||{}),Je=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(Je||{}),Ue=(s=>(s.locked="locked",s.range="range",s.none="none",s))(Ue||{});class ke{constructor(o){g(this,z);this.setBarcodeProperties=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableBackground=async(t,e)=>{const r={enableBackground:e};return this.setBarcodeProperties(t,r)},this.setBackgroundColor=async(t,e)=>{const r={backgroundColor:e};return this.setBarcodeProperties(t,r)},this.setEnableBars=async(t,e)=>{const r={enableBars:e};return this.setBarcodeProperties(t,r)},this.setBarColor=async(t,e)=>{const r={barColor:e};return this.setBarcodeProperties(t,r)},this.setBarcodeSource=async(t,e)=>(await a(this,z)).setBarcodeSource(t,JSON.stringify(e)).then(n=>i(n)),this.removeBarcodeSource=async t=>(await a(this,z)).setBarcodeSource(t,null).then(r=>i(r)),this.setEnableText=async(t,e)=>{const r={enableText:e};return this.setBarcodeProperties(t,r)},this.setBarHeight=async(t,e)=>{const r={barHeight:e};return this.setBarcodeProperties(t,r)},this.setMagnification=async(t,e)=>{const r={magnification:e};return this.setBarcodeProperties(t,r)},this.setQuietZoneValue=async(t,e,r)=>{const n=r?{left:r===Z.left?e:void 0,top:r===Z.top?e:void 0,right:r===Z.right?e:void 0,bottom:r===Z.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:n})).then(l=>i(l))},this.setAreQuietZoneValuesCombined=async(t,e)=>{const r={areQuietZoneValuesCombined:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:r})).then(c=>i(c))},this.setErrorCorrectionLevel=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({errorCorrectionLevel:e})).then(n=>i(n)),this.setCharacterSet=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({characterSet:e})).then(n=>i(n)),this.setDrawLightMarginIndicator=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.setDrawStartStopChars=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.getBarcodeConfigationOptions=t=>{let e=!0,r=!0,n=!0,c,l,d=!1,C=!1,p=!1;switch(t){case x.qr:c=[Ct.iso8859_1,Ct.utf8],l=[At.low,At.medium,At.quartile,At.high];case x.dataMatrix:e=!1,r=!1,n=!1,d=!0;break;case x.ean13:e=!1,C=!0;break;case x.ean8:C=!0;case x.upca:case x.upce:e=!1;break;case x.code128:case x.gs1128:c=[Ct.code128a,Ct.code128b,Ct.code128c];break;case x.code39:p=!0;break}return{allowEnableMagnification:n,allowBarHeight:r,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:l,allowToggleText:e,quietZoneAlwaysCombined:d,allowToggleLightMarginIndicator:C,allowToggleDrawStartAndEndChar:p}},y(this,z,o)}}z=new WeakMap;var K=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(K||{}),Q=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.gray="gray",s.hsl="hsl",s.spot="spot",s.spotCMYK="spotCMYK",s.spotRGB="spotRGB",s.spotHEX="spotHEX",s))(Q||{}),re=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(re||{});const _e=s=>s.type===K.hex,pe=s=>s.type===K.spotHex,bn=s=>s.type===K.spotRgb,vn=s=>s.type===K.spotCmyk,In=s=>bn(s)||vn(s)||pe(s),An=s=>{const o=Pn(s.type);return In(s)?{...pe(s)&&{value:s.displayValue},...!pe(s)&&{...s.displayValue},spotName:s.value,type:o}:{..._e(s)&&{value:s.value},...!_e(s)&&{...s.value},type:o}},He=(s,o,t,e)=>{const{brandKitColorGuid:r,brandKitFontFamilyGuid:n,fontStyleId:c,textStrokeColorGuid:l,textStrokeColorApplied:d,textStrokeWidth:C,...p}=s;return{...Object.keys(p).reduce((S,v)=>({...S,[v]:{value:s[v]}}),{}),...o&&{color:{value:{id:o.id,color:o.color,type:re.brandKit,isApplied:p.fillColorApplied}}},...t&&{strokeColor:{value:{id:t.id,color:t.color,type:re.brandKit,isApplied:d||!1}},strokeColorApplied:{value:d||!1},strokeWidth:{value:C!=null?C.toString():C}},fontKey:{value:e??null}}},Pn=s=>{switch(s){case K.rgb:return Q.rgb;case K.cmyk:return Q.cmyk;case K.hex:return Q.hex;case K.spotRgb:return Q.spotRGB;case K.spotCmyk:return Q.spotCMYK;case K.spotHex:return Q.spotHEX}},ne=(s,o)=>{if(!(s===null||o===void 0))return(s||[]).find(t=>t.id===o)},xe=(s,o,t)=>{var e,r;if(!(s===null||o===void 0||t===void 0))return(r=(e=(s||[]).find(n=>n.id===o))==null?void 0:e.fontStyles.find(n=>n.fontStyleId===t))==null?void 0:r.id};class Ke{constructor(o,t){g(this,N);this.getId=async()=>(await a(this,N)).getBrandKitId().then(r=>i(r)),this.getVersion=async()=>(await a(this,N)).getBrandKitVersion().then(r=>i(r)),this.getName=async()=>(await a(this,N)).getBrandKitName().then(r=>i(r)),this.rename=async e=>(await a(this,N)).renameBrandKit(e).then(n=>i(n)),this.updateIdAndVersion=async(e,r)=>(await a(this,N)).updateBrandKitIdAndVersion(e,r).then(c=>i(c)),this.get=async()=>{const e=await this.getId(),r=await this.getVersion(),n=await this.getName(),c=this.colorStyleController.getAll(),l=this.gradientStyleController.getAll(),d=this.fontController.getFontFamilies(),C=this.characterStyleController.getAll(),p=this.paragraphStyleController.getAll(),I=this.getAllMedia(),[S,v,P,A,b,H]=await Promise.all([c,l,d,p,C,I]),L={id:e.parsedData,brandKit:{id:e.parsedData,name:n.parsedData,lastModifiedDate:r.parsedData,colors:S.parsedData,gradients:v.parsedData,fonts:P.parsedData,paragraphStyles:A.parsedData,characterStyles:b.parsedData,media:H.parsedData}},F={success:!0,data:JSON.stringify(L),parsedData:L,status:200};return i(F)},this.getAllMedia=async()=>(await a(this,N)).getAllBrandKitMedia().then(r=>i(r)),this.addMedia=async(e,r,n)=>(await a(this,N)).addBrandKitMedia(e,r,n).then(l=>i(l)),this.updateMedia=async(e,r,n)=>(await a(this,N)).updateBrandKitMedia(e,r,n).then(l=>i(l)),this.renameMedia=async(e,r)=>(await a(this,N)).renameBrandKitMedia(e,r).then(c=>i(c)),this.removeMedia=async e=>(await a(this,N)).removeBrandKitMedia(e).then(n=>i(n)),this.remove=async()=>{const r=(await this.colorStyleController.getAll()).parsedData||[],c=(await this.gradientStyleController.getAll()).parsedData||[],d=(await this.paragraphStyleController.getAll()).parsedData||[],p=(await this.characterStyleController.getAll()).parsedData||[],S=(await this.fontController.getFontFamilies()).parsedData||[],P=(await this.getAllMedia()).parsedData||[];await this.undoManagerController.record("brandKit.remove",async A=>{for(const b of r)await A.colorStyle.remove(b.id);for(const b of c)await A.gradientStyle.remove(b.id);for(const b of d)await A.paragraphStyle.remove(b.id);for(const b of p)await A.characterStyle.remove(b.id);for(const b of S)await A.font.removeFontFamily(b.id);for(const b of P)await this.removeMedia(b.name)})},this.set=async e=>{let r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:[],gradients:[],fonts:[],paragraphStyles:[],characterStyles:[],media:[]}};return await this.undoManagerController.record("brandKit.set",async n=>{const c=await this.setColors(e,n);await this.setGradients(e,n);const l=await this.setFonts(e,n),{parsedData:d=[]}=await n.colorStyle.getAll(),{parsedData:C=[]}=await n.gradientStyle.getAll(),{parsedData:p}=await n.font.getFontFamilies();await this.setParagraphStyles(e,n,{localColors:d,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setCharacterStyles(e,n,{localColors:d,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setMedia(e);const{parsedData:I}=await n.paragraphStyle.getAll(),{parsedData:S}=await n.characterStyle.getAll(),{parsedData:v}=await this.getAllMedia();await n.brandKit.updateIdAndVersion(e.id,e.brandKit.lastModifiedDate),await n.brandKit.rename(e.brandKit.name),r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:d||[],gradients:C||[],fonts:p||[],paragraphStyles:I||[],characterStyles:S||[],media:v||[]}}}),r},y(this,N,o),this.colorStyleController=t.colorStyle,this.gradientStyleController=t.gradientStyle,this.fontController=t.font,this.mediaController=t.mediaConnector,this.paragraphStyleController=t.paragraphStyle,this.characterStyleController=t.characterStyle,this.undoManagerController=t.undoManager}async setColors(o,t){const e=new Map;for(const r of o.brandKit.colors||[]){const{parsedData:n}=await t.colorStyle.create();if(!n)continue;e.set(r.guid,n);const c=An(r);await t.colorStyle.rename(n,r.name),await t.colorStyle.update(n,c)}return e}async setGradients(o,t){return new Map}async setFonts(o,t){const e=o.fontConnectorId,r=new Map;for(const n of o.brandKit.fonts||[]){const{parsedData:c=[]}=await t.fontConnector.detail(e,n.fontFamilyId);if(!(c!=null&&c[0]))throw new Error(`No font styles for family ID: ${n.fontFamilyId}`);const{parsedData:l}=await t.font.addFontFamily(e,{name:c[0].familyName,fontFamilyId:n.fontFamilyId});l&&r.set(n.fontFamilyBrandKitGuid,l)}return r}async setParagraphStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const d of o.brandKit.paragraphStyles||[]){const C=c.get(d.brandKitColorGuid),p=c.get(d.textStrokeColorGuid),I=l.get(d.brandKitFontFamilyGuid),S=xe(n,I,d.fontStyleId);if(!I||!S)throw new Error(`Paragraph style could not be created with an empty font family: ${d.name}`);const v=ne(r,C),P=ne(r,p);if(!v)throw new Error(`Paragraph style could not be created with an empty color: ${d.name}`);const{parsedData:A}=await t.paragraphStyle.create(),b=He(d,v,P,`${S}`);await t.paragraphStyle.rename(A,d.name),await t.paragraphStyle.update(A,b)}}async setCharacterStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const d of o.brandKit.characterStyles||[]){const C=d.brandKitColorGuid?c.get(d.brandKitColorGuid):void 0,p=d.textStrokeColorGuid?c.get(d.textStrokeColorGuid):void 0,I=d.brandKitFontFamilyGuid?l.get(d.brandKitFontFamilyGuid):void 0,S=ne(r,C),v=ne(r,p),P=xe(n,I,d.fontStyleId),{parsedData:A}=await t.characterStyle.create(),b=He(d,S,v,P);await t.characterStyle.rename(A,d.name),await t.characterStyle.update(A,b)}}async setMedia(o){for(const t of o.brandKit.media||[])await this.addMedia(t.name,t.mediaConnectorId,t.mediaId)}}N=new WeakMap;class Ce{constructor(o){g(this,it);this.zoomToPage=async(t,e,r,n,c)=>(t!==void 0&&console.warn("id has no effect and will be deprecated in the future"),(await a(this,it)).zoomToPage(e,r,n,c).then(d=>i(d))),this.getZoomPercentage=async()=>(await a(this,it)).getZoomPercentage().then(e=>i(e)),this.setZoomPercentage=async t=>(await a(this,it)).setZoomPercentage(t).then(r=>i(r)),this.setViewMode=async t=>(await a(this,it)).setViewMode(t).then(r=>i(r)),y(this,it,o)}}it=new WeakMap;class $e{constructor(o){g(this,B);this.getAll=async()=>(await a(this,B)).getCharacterStyles().then(e=>i(e)),this.getById=async t=>(await a(this,B)).getCharacterStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,B)).createCharacterStyle().then(e=>i(e)),this.update=async(t,e)=>(await a(this,B)).updateCharacterStyle(t,JSON.stringify(e)).then(n=>i(n)),this.remove=async t=>(await a(this,B)).removeCharacterStyle(t).then(r=>i(r)),this.duplicate=async t=>(await a(this,B)).duplicateCharacterStyle(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,B)).renameCharacterStyle(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,B)).moveCharacterStyles(t,e).then(n=>i(n)),y(this,B,o)}}B=new WeakMap;class ze{constructor(o){g(this,ot);this.copyFrames=async t=>{const r=await(await a(this,ot)).copyFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.cutFrames=async t=>{const r=await(await a(this,ot)).cutFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.pasteFrames=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.pasteFrames(e);return i(r)},this.getContentType=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.getClipboardContentType(e);return i(r)},y(this,ot,o)}}ot=new WeakMap;class We{constructor(o){g(this,Kt);this.convertToRgb=async t=>(await a(this,Kt)).colorToRgb(JSON.stringify(t)).then(r=>i(r)),y(this,Kt,o)}}Kt=new WeakMap;class je{constructor(o){g(this,G);this.getAll=async()=>(await a(this,G)).getColors().then(e=>i(e)),this.getById=async t=>(await a(this,G)).getColorById(t).then(r=>i(r)),this.create=async()=>(await a(this,G)).createColor().then(e=>i(e)),this.duplicate=async t=>(await a(this,G)).duplicateColor(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,G)).moveColors(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,G)).renameColor(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,G),n=e;return n.type===Q.spot&&(n.type=Q.spotCMYK),r.updateColor(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,G)).removeColor(t).then(r=>i(r)),y(this,G,o)}}G=new WeakMap;var Pt=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(Pt||{}),ae=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(ae||{}),Ft=(s=>(s.file="file",s.collection="collection",s))(Ft||{}),qe=(s=>(s.media="media",s.fonts="fonts",s.data="data",s.components="components",s))(qe||{}),Ye=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(Ye||{}),Ze=(s=>(s.ascending="asc",s.descending="desc",s))(Ze||{}),Qe=(s=>(s.text="text",s.boolean="boolean",s))(Qe||{}),Xe=(s=>(s.query="query",s.upload="upload",s))(Xe||{}),Et=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Et||{});class Fn{constructor(o,t,e,r="engineToConnector"){this.direction="engineToConnector",this.name=o,this.direction=r,t==="var"?this.value=`${t}.${e}`:this.value=e}}var ts=(s=>(s.variable="var",s.value="value",s))(ts||{}),es=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(es||{}),ie=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(ie||{}),ss=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(ss||{});const En={url:"grafx-media.json",source:"local"};class Dn{constructor(o){this.type="grafxToken",this.token=o}}class On{constructor(){this.type="refreshed"}}var rs=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(rs||{}),ns=(s=>(s.grafxToken="grafxToken",s.any="any",s))(ns||{}),we=(s=>(s.minDimension="minDimension",s))(we||{});class as extends Error{constructor(o,t){super(o),this.type=t}}class me{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=Et.grafx||this.isSourceMigrated(o))return o;let t=o.url;for(;t.endsWith("/");)t=t.substring(0,t.length-1);const e=t.split("/");return{id:e[e.length-1],source:Et.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,t)=>o.map(e=>this.makeSingleConnectorBackwardsCompatible(e,t)),this.makeSingleConnectorBackwardsCompatible=(o,t)=>o.source.source!=Et.grafx?o:{id:o.id,name:o.name,iconUrl:o.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(o.source,t)},this.makeConnectorSourceBackwardsCompatible=(o,t)=>{let e=t;for(;e!=null&&e.endsWith("/");)e=e.substring(0,e.length-1);return{url:`${e}/connectors/${o.id}`,source:Et.grafx}},this.isSourceMigrated=o=>"id"in o}}let is=(Er=class{constructor(o,t){g(this,J);g(this,Ot);g(this,wt);this.getById=async e=>(await a(this,J)).getConnectorById(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,wt).makeSingleConnectorBackwardsCompatible(n.parsedData,a(this,Ot).get(Y.GraFxStudioEnvironmentApiUrl))),c}),this.getAllByType=async e=>(await a(this,J)).getConnectors(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,wt).makeMultipleConnectorsBackwardsCompatible(n.parsedData,a(this,Ot).get(Y.GraFxStudioEnvironmentApiUrl))),c}),this.register=async e=>{const r=await a(this,J),n=a(this,wt).makeConnectorSourceForwardsCompatible(e);return r.registerConnector(JSON.stringify(n)).then(c=>i(c))},this.unregister=async e=>(await a(this,J)).unregisterConnector(e).then(n=>i(n)),this.configure=async(e,r)=>{const n=await a(this,J);return await this.waitToBeReady(e),await r(new Ln(e,n)),n.updateConnectorConfiguration(e).then(c=>i(c))},this.getState=async e=>(await a(this,J)).getConnectorState(e).then(n=>i(n)),this.getOptions=async e=>(await a(this,J)).getConnectorOptions(e).then(n=>i(n)),this.waitToBeReady=async(e,r=2e3)=>{let n=Math.max(r,500);n=Math.min(n,5e3);const c=100;let l=0;try{for(;l*c<n;){const d=await this.getState(e);if(d.success&&d.parsedData&&(d.parsedData.type===ie.running||d.parsedData.type===ie.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(C=>setTimeout(C,c)),l++}}catch(d){return i({data:null,success:!1,error:`Error while getting connector state ${d}`,status:5e4,parsedData:void 0},!1)}return i({data:null,success:!1,error:"Timed out waiting for connector",status:5e4,parsedData:void 0},!1)},this.updateMappings=async(e,r)=>await this.configure(e,async n=>{const{parsedData:c}=await this.getMappings(e),l=(c==null?void 0:c.filter(p=>!r.some(I=>I.name===p.name&&I.direction===p.direction)))??[],d=r.filter(p=>p.name!==""&&p.value!==""),C=[...l,...d];await n.setMappings(C)}),y(this,J,o),y(this,Ot,t),y(this,wt,new me)}async getMappings(o,t){return(await a(this,J)).getConnectorMappings(o).then(r=>i(r)).then(r=>{var n;return t?{...r,parsedData:(n=r.parsedData)==null?void 0:n.filter(c=>c.direction===t)}:r})}},J=new WeakMap,Ot=new WeakMap,wt=new WeakMap,Er);class Ln{constructor(o,t){g(this,mt);g(this,ft);this.setOptions=async e=>a(this,ft).setConnectorOptions(a(this,mt),JSON.stringify(e)).then(r=>i(r)),this.setMappings=async e=>{const r=await a(this,ft).setConnectorMappings(a(this,mt),e.map(function(n){return JSON.stringify(n)}));return i(r)},this.setHttpHeader=async(e,r)=>a(this,ft).connectorAuthenticationSetHttpHeader(a(this,mt),e,r).then(n=>i(n)),y(this,mt,o),y(this,ft,t)}}mt=new WeakMap,ft=new WeakMap;class os{constructor(o,t){g(this,ct);g(this,$t);this.getPage=async(e,r,n={})=>(await a(this,ct)).dataConnectorGetPage(e,JSON.stringify(r),JSON.stringify(n)).then(l=>i(l)).then(l=>{const d={...l,parsedData:null};return l.parsedData&&(d.parsedData={data:l.parsedData.data.map(C=>a(this,$t).mapEngineToDataItem(C)),continuationToken:l.parsedData.continuationToken}),d}),this.getModel=async(e,r={})=>(await a(this,ct)).dataConnectorGetModel(e,JSON.stringify(r)).then(c=>i(c)),this.getConfigurationOptions=async e=>(await a(this,ct)).dataConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,ct)).dataConnectorGetCapabilities(e).then(n=>i(n)),y(this,ct,o),y(this,$t,t)}}ct=new WeakMap,$t=new WeakMap;class cs{constructor(o,t){g(this,ht);g(this,zt);this.setDataSource=async e=>(await a(this,ht)).setDataSource(e).then(n=>i(n)),this.getDataSource=async()=>(await a(this,ht)).getDataSource().then(r=>i(r)),this.removeDataSource=async()=>(await a(this,ht)).removeDataSource().then(r=>i(r)),this.setDataRow=async e=>{const r=await a(this,ht),n=a(this,zt).mapDataItemToEngine(e);return r.setDataRow(JSON.stringify(n)).then(c=>i(c))},y(this,ht,o),y(this,zt,t)}}ht=new WeakMap,zt=new WeakMap;class hs{constructor(o){g(this,lt);this.getAllLogs=async()=>(await a(this,lt)).getLogs().then(e=>i(e)),this.toggleDebugPanel=async()=>(await a(this,lt)).toggleDebugPanel().then(e=>i(e)),this.enableDebug=async()=>(await a(this,lt)).enableDebug().then(e=>i(e)),this.disableDebug=async()=>(await a(this,lt)).disableDebug().then(e=>i(e)),y(this,lt,o)}}lt=new WeakMap;class ls{constructor(o){g(this,St);this.getCurrentState=async()=>(await a(this,St)).getCurrentDocumentState().then(e=>i(e)),this.load=async(t,e={keepConnectors:!1})=>{const r=await a(this,St),n=typeof t!="string"?JSON.stringify(t):t;return r.loadDocument(n,JSON.stringify(e)).then(c=>i(c))},this.createAndLoad=async t=>{const e=await a(this,St),r=JSON.stringify(t);return e.createAndLoadDocument(r).then(n=>i(n))},y(this,St,o)}}St=new WeakMap;var ds=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(ds||{}),Ht=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(Ht||{}),us=(s=>(s.connector="connector",s))(us||{}),gs=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s.component="component",s))(gs||{}),ys=(s=>(s.variable="variable",s.text="text",s))(ys||{}),ps=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(ps||{}),Cs=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(Cs||{}),ws=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(ws||{}),ms=(s=>(s.normal="normal",s.screen="screen",s.overlay="overlay",s.darken="darken",s.lighten="lighten",s.colorDodge="colorDodge",s.colorBurn="colorBurn",s.hardLight="hardLight",s.softLight="softLight",s.difference="difference",s.exclusion="exclusion",s.multiply="multiply",s.hue="hue",s.saturation="saturation",s.color="color",s.luminosity="luminosity",s))(ms||{}),fs=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(fs||{}),Ss=(s=>(s.topLeft="topLeft",s.topCenter="topCenter",s.topRight="topRight",s.centerLeft="centerLeft",s.center="center",s.centerRight="centerRight",s.bottomLeft="bottomLeft",s.bottomCenter="bottomCenter",s.bottomRight="bottomRight",s))(Ss||{}),bs=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(bs||{}),vs=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(vs||{}),Is=(s=>(s.page="page",s.frame="frame",s))(Is||{}),As=(s=>(s.start="start",s.end="end",s.center="center",s))(As||{});class Mn{constructor(){this.type="page"}}class Nn{constructor(o,t){this.type="frame",this.frameId=o,this.edge=t}}var fe=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(fe||{});class Ps{constructor(o){g(this,U);this.insertImageVariableToFrame=async(t,e)=>{const r=await a(this,U),n={id:e,type:Ht.variable};return r.setImageSource(t,JSON.stringify(n)).then(c=>i(c))},this.insertTextVariable=async t=>(await a(this,U)).insertTextVariable(t).then(r=>i(r)),this.enterTextEditMode=async t=>(await a(this,U)).enterTextEditMode(t).then(r=>i(r)),this.exitTextEditMode=async()=>(await a(this,U)).exitTextEditMode().then(e=>i(e)),this.getText=async(t,e)=>(await a(this,U)).getTextByFrameId(t,e).then(n=>i(n)),this.setText=async(t,e)=>(await a(this,U)).setTextByFrameId(t,e).then(n=>i(n)),this.selectText=async(t,e,r)=>(await a(this,U)).selectTextById(t,e,r).then(c=>i(c)),this.addCustomUndoData=async(t,e,r)=>(await a(this,U)).setCustomUndoData(t,e,r??!1).then(c=>i(c)),y(this,U,o)}}U=new WeakMap;class Fs{constructor(o){g(this,dt);g(this,Lt);this.query=async(t,e,r={})=>(await a(this,dt)).fontConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,dt)).fontConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r={})=>(await a(this,Lt)).fontConnectorDownload(t,e,JSON.stringify(r)).then(c=>c??c),this.preview=async(t,e,r,n={})=>(await a(this,Lt)).fontConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>l??l),this.getConfigurationOptions=async t=>(await a(this,dt)).fontConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,dt)).fontConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedFontType=t=>{if(t===Pt.file)return Ft.file;if(t===Pt.collection)return Ft.collection},y(this,dt,o),y(this,Lt,o)}}dt=new WeakMap,Lt=new WeakMap;class Es{constructor(o){g(this,E);this.addFontFamily=async(t,e)=>(await a(this,E)).addFontFamily(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontFamily=async t=>(await a(this,E)).removeFontFamily(t).then(r=>i(r)),this.addFontStyle=async(t,e)=>(await a(this,E)).addFontStyle(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontStyle=async t=>(await a(this,E)).removeFontStyle(t).then(r=>i(r)),this.getFontFamilies=async()=>(await a(this,E)).getFontFamilies().then(e=>i(e)),this.getFontStyles=async t=>(await a(this,E)).getFontStyles(t).then(r=>i(r)),this.getFontFamilyById=async t=>(await a(this,E)).getFontFamilyById(t).then(r=>i(r)),this.getFontStyleById=async t=>(await a(this,E)).getFontStyleById(t).then(r=>i(r)),this.getDefaultFontStyle=async()=>(await a(this,E)).getDefaultFontStyle().then(e=>i(e)),this.getDefaultFontFamily=async()=>(await a(this,E)).getDefaultFontFamily().then(e=>i(e)),this.isFontFamilyUsed=async t=>(await a(this,E)).isFontFamilyUsed(t).then(r=>i(r)),this.isFontStyleUsed=async t=>(await a(this,E)).isFontStyleUsed(t).then(r=>i(r)),this.moveFontFamilies=async(t,e)=>(await a(this,E)).moveFontFamilies(t,e).then(n=>i(n)),this.getPreviewsOfCharacterStrings=async(t,e)=>(await a(this,E)).getPreviewsOfCharacterStrings(t,JSON.stringify(e)).then(n=>i(n)),y(this,E,o)}}E=new WeakMap;class Se{constructor(o){g(this,Mt);this.setShapeProperties=async(t,e)=>(await a(this,Mt)).setShapeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableFill=async(t,e)=>{const r={enableFill:e};return this.setShapeProperties(t,r)},this.setFillColor=async(t,e)=>{const r={fillColor:e};return this.setShapeProperties(t,r)},this.setEnableStroke=async(t,e)=>{const r={enableStroke:e};return this.setShapeProperties(t,r)},this.setStrokeColor=async(t,e)=>{const r={strokeColor:e};return this.setShapeProperties(t,r)},this.setStrokeWeight=async(t,e)=>{const r={strokeWeight:e};return this.setShapeProperties(t,r)},this.setFlagAllCornersSame=async(t,e)=>{const r={allCornersSame:e};return this.setShapeProperties(t,r)},this.setShapeCorners=async(t,e)=>(await a(this,Mt)).setShapeCorners(t,JSON.stringify(e)).then(n=>i(n)),this.setRadiusAll=async(t,e)=>{const r={radiusAll:e};return this.setShapeCorners(t,r)},this.setRadiusTopLeft=async(t,e)=>{const r={topLeft:e};return this.setShapeCorners(t,r)},this.setRadiusBottomLeft=async(t,e)=>{const r={bottomLeft:e};return this.setShapeCorners(t,r)},this.setRadiusTopRight=async(t,e)=>{const r={topRight:e};return this.setShapeCorners(t,r)},this.setRadiusBottomRight=async(t,e)=>{const r={bottomRight:e};return this.setShapeCorners(t,r)},y(this,Mt,o)}}Mt=new WeakMap;class Ds{constructor(o){g(this,u);this.getAll=async()=>(await a(this,u)).getFrames().then(e=>i(e)),this.getSelected=async()=>(await a(this,u)).getSelectedFrames().then(e=>i(e)),this.getAllByPageId=async t=>(await a(this,u)).getFramesByPageId(t).then(r=>i(r)),this.getByName=async t=>(await a(this,u)).getFrameByName(t).then(r=>i(r)),this.getById=async t=>(await a(this,u)).getFrameById(t).then(r=>i(r)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,u)).getFramePropertiesOnSelectedLayout().then(e=>i(e)),this.getLayoutProperties=async(t,e)=>(await a(this,u)).getFramePropertiesByFrameId(t,e).then(n=>i(n)),this.getAllLayoutProperties=async t=>(await a(this,u)).getFramesProperties(t).then(r=>i(r)),this.resetTransformation=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetSize=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.select=async t=>(await a(this,u)).selectFrames([t]).then(r=>i(r)),this.selectMultiple=async t=>(await a(this,u)).selectFrames(t).then(r=>i(r)),this.deselectAll=async()=>(await a(this,u)).deselectFrames().then(e=>i(e)),this.reorderFrames=async(t,e)=>(await a(this,u)).reorderFrames(t,e).then(n=>i(n)),this.setZIndex=async(t,e)=>(await a(this,u)).setFrameZIndex(t,e).then(n=>i(n)),this.setHeight=async(t,e)=>(await a(this,u)).setFrameHeight(t,e).then(n=>i(n)),this.setRotation=async(t,e)=>(await a(this,u)).setFrameRotation(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,u)).setFrameWidth(t,e).then(n=>i(n)),this.setX=async(t,e)=>(await a(this,u)).setFrameX(t,e).then(n=>i(n)),this.setY=async(t,e)=>(await a(this,u)).setFrameY(t,e).then(n=>i(n)),this.setOpacity=async(t,e)=>(await a(this,u)).setFrameOpacity(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,u)).renameFrame(t,e).then(n=>i(n)),this.reset=async t=>(await a(this,u)).resetFrame(t).then(r=>i(r)),this.resetX=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetY=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetRotation=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetHeight=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetImageFrameFitMode=async t=>(await a(this,u)).resetImageFrameFitMode(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,u)).setFrameIsVisible(t,e).then(n=>i(n)),this.setIsVisible=async(t,e)=>(await a(this,u)).setFrameIsVisible(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,u)).removeFrames([t]).then(r=>i(r)),this.removeFrames=async t=>(await a(this,u)).removeFrames(t).then(r=>i(r)),this.create=async(t,e,r,n,c)=>(await a(this,u)).addFrame(t,e,r,n,c).then(d=>i(d)),this.createShapeFrame=async(t,e,r,n,c)=>(await a(this,u)).addFrame(t,e,r,n,c).then(d=>i(d)),this.createBarcodeFrame=async(t,e)=>(await a(this,u)).addBarcodeFrame(t,e==null?void 0:e.x,e==null?void 0:e.y).then(n=>i(n)),this.createComponentFrame=async(t,e,r,n,c)=>(await a(this,u)).addComponentFrame(e,r,n,c,JSON.stringify(t)).then(d=>i(d)),this.duplicateFrames=async t=>(await a(this,u)).duplicateFrames(t).then(r=>i(r)),this.updateImageSource=async(t,e)=>{const r=await a(this,u),n=e!==null?JSON.stringify(e):null;return r.setImageSource(t,n).then(c=>i(c))},this.removeImageSource=async t=>this.updateImageSource(t,null),this.setImageFromConnector=async(t,e,r)=>{const n={id:e,assetId:r,type:Ht.connector};return this.updateImageSource(t,n)},this.setImageFromUrl=async(t,e)=>{const r={url:e,type:Ht.url};return this.updateImageSource(t,r)},this.setImageFrameFitMode=async(t,e)=>(await a(this,u)).setImageFrameFitMode(t,e).then(n=>i(n)),this.setImageFrameFitModePosition=async(t,e)=>(await a(this,u)).setImageFrameFitModePosition(t,e).then(n=>i(n)),this.setFrameConstrainProportions=async(t,e)=>(console.error("setFrameConstrainProportions is not supported anymore"),i({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(t,e)=>(await a(this,u)).setVerticalAlignment(t,e).then(n=>i(n)),this.setMinCopyfitting=async(t,e)=>(await a(this,u)).setMinCopyfitting(t,e).then(n=>i(n)),this.setMaxCopyfitting=async(t,e)=>(await a(this,u)).setMaxCopyfitting(t,e).then(n=>i(n)),this.setEnableCopyfitting=async(t,e)=>(await a(this,u)).setEnableCopyfitting(t,e).then(n=>i(n)),this.resetMinCopyfitting=async t=>(await a(this,u)).resetMinCopyfitting(t).then(r=>i(r)),this.resetMaxCopyfitting=async t=>(await a(this,u)).resetMaxCopyfitting(t).then(r=>i(r)),this.resetEnableCopyfitting=async t=>(await a(this,u)).resetEnableCopyfitting(t).then(r=>i(r)),this.setShapeFrameEnableFill=async(t,e)=>this.shapeController.setEnableFill(t,e),this.setShapeFrameFillColor=async(t,e)=>this.shapeController.setFillColor(t,e),this.setShapeFrameEnableStroke=async(t,e)=>this.shapeController.setEnableStroke(t,e),this.setShapeFrameStrokeColor=async(t,e)=>this.shapeController.setStrokeColor(t,e),this.setShapeFrameStrokeWeight=async(t,e)=>this.shapeController.setStrokeWeight(t,e),this.setBlendMode=async(t,e)=>(await a(this,u)).setFrameBlendMode(t,e).then(n=>i(n)),this.enterCropMode=async(t,e=fe.frameCrop)=>(await a(this,u)).enterCropMode(t,e).then(n=>i(n)),this.applyCropMode=async()=>(await a(this,u)).applyCropMode().then(e=>i(e)),this.exitCropMode=async()=>(await a(this,u)).cancelCropMode().then(e=>i(e)),this.enterSubjectMode=async t=>(await a(this,u)).enterSubjectMode(t).then(r=>i(r)),this.applySubjectMode=async()=>(await a(this,u)).applySubjectMode().then(e=>i(e)),this.exitSubjectMode=async()=>(await a(this,u)).cancelSubjectMode().then(e=>i(e)),this.enterGradientMode=async t=>(await a(this,u)).enterGradientMode(t).then(r=>i(r)),this.applyGradientMode=async()=>(await a(this,u)).applyGradientMode().then(e=>i(e)),this.cancelGradientMode=async()=>(await a(this,u)).cancelGradientMode().then(e=>i(e)),this.resetCropMode=async t=>(console.error("resetCropMode is not supported anymore"),i({success:!1,status:0,error:"resetCropMode is not supported anymore",parsedData:null})),this.setEnableAutoGrow=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinWidth=async(t,e)=>{const r={minWidth:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxWidth=async(t,e)=>{const r={maxWidth:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinHeight=async(t,e)=>{const r={minHeight:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxHeight=async(t,e)=>{const r={maxHeight:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowDirections=async(t,e)=>{const r={directions:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.resetAutoGrowSettingsEnabled=async t=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async t=>(console.error("resetAutoGrowMinWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async t=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async t=>(console.error("resetAutoGrowMinHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async t=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async t=>(console.error("resetAutoGrowDirections is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async t=>(console.error("resetAutoGrow is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setShadowEnabled=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,u)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowDistance=async(t,e)=>{const r={distance:{value:e}};return(await a(this,u)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowAngleDegrees=async(t,e)=>{const r={angleDegrees:{value:e}};return(await a(this,u)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowBlurRadius=async(t,e)=>{const r={blurRadius:{value:e}};return(await a(this,u)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowColor=async(t,e)=>{const r={color:{value:e}};return(await a(this,u)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAnchor=async(t,e,r,n,c)=>{const l={horizontal:e,type:r,target:n,endTarget:c};return(await a(this,u)).setAnchorProperties(t,JSON.stringify(l)).then(C=>i(C))},this.setVerticalAnchor=async(t,e,r,n)=>this.setAnchor(t,!1,e,r,n),this.setHorizontalAnchor=async(t,e,r,n)=>this.setAnchor(t,!0,e,r,n),this.resetAnchoring=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetVisibility=async t=>(await a(this,u)).setFrameIsVisible(t,null).then(r=>i(r)),this.getConfiguration=async t=>(await a(this,u)).getFrameConfiguration(t).then(r=>i(r)),this.resetAssetCropOverride=async t=>(await a(this,u)).resetAssetCropOverride(t).then(r=>i(r)),this.resetAllAssetCropOverrides=async t=>(await a(this,u)).resetAllAssetCropOverrides(t).then(r=>i(r)),this.setGradientApplied=async(t,e)=>{const r={isApplied:e};return(await a(this,u)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setLocalGradient=async(t,e)=>{const r={gradient:e};return(await a(this,u)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setBrandKitGradient=async(t,e)=>{const r={id:e};return(await a(this,u)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},y(this,u,o),this.shapeController=new Se(a(this,u)),this.constraints=new Rn(a(this,u))}}u=new WeakMap;class Rn{constructor(o){g(this,W);this.get=async t=>(await a(this,W)).getFrameConstraints(t).then(r=>i(r)),this.setSelectable=async(t,e)=>{const r={selectionAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setHorizontalMovement=async(t,e)=>{const r={horizontalMovementAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setVerticalMovement=async(t,e)=>{const r={verticalMovementAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setRotation=async(t,e)=>{const r={rotationAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setResize=async(t,e)=>{const r={resizeAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setCrop=async(t,e)=>{const r={cropAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},y(this,W,o)}}W=new WeakMap;class Os{constructor(){this.currentEngineVersion=R.current,this.currentSDKVersion=Pe.version}}class Ls{constructor(o){g(this,f);g(this,Wt);this.getAll=async()=>(await a(this,f)).getLayouts().then(e=>i(e)),this.getById=async t=>(await a(this,f)).getLayoutById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,f)).getLayoutByName(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,f)).getSelectedLayout().then(e=>i(e)),this.remove=async t=>(await a(this,f)).removeLayout(t).then(r=>i(r)),this.create=async(t,e)=>{const r=await a(this,f);return e!=null&&e.length?r.addLayouts(t,JSON.stringify(e)).then(n=>i(n)):r.addLayout(t).then(n=>i(n))},this.rename=async(t,e)=>(await a(this,f)).renameLayout(t,e).then(n=>i(n)),this.select=async t=>(await a(this,f)).selectLayoutWithOptions(t,null).then(r=>i(r)),this.selectWithPageSize=async(t,e)=>{const r=await a(this,f),n={pageSize:e};return r.selectLayoutWithOptions(t,JSON.stringify(n)).then(c=>i(c))},this.duplicate=async t=>(await a(this,f)).duplicateLayout(t).then(r=>i(r)),this.reset=async t=>(await a(this,f)).resetLayout(t).then(r=>i(r)),this.setHeight=async(t,e)=>(await a(this,f)).setLayoutHeight(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,f)).setLayoutWidth(t,e).then(n=>i(n)),this.setUnit=async(t,e)=>(await a(this,f)).setLayoutUnit(t,e).then(n=>i(n)),this.resetHeight=async t=>(await a(this,f)).resetLayoutHeight(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,f)).resetLayoutWidth(t).then(r=>i(r)),this.resetUnit=async t=>(await a(this,f)).resetLayoutUnit(t).then(r=>i(r)),this.getSelectedSnapshot=async()=>(await a(this,Wt)).getPageSnapshot().then(e=>e??e),this.setIntent=async(t,e)=>(await a(this,f)).setLayoutIntent(t,e).then(n=>i(n)),this.resetIntent=async t=>(await a(this,f)).resetLayoutIntent(t).then(r=>i(r)),this.setFillColor=async(t,e)=>(await a(this,f)).setLayoutFillColor(t,JSON.stringify(e)).then(n=>i(n)),this.setFillColorEnabled=async(t,e)=>(await a(this,f)).setLayoutFillColorEnabled(t,e).then(n=>i(n)),this.resetFillColor=async t=>(await a(this,f)).resetLayoutFillColor(t).then(r=>i(r)),this.setBleedValue=async(t,e,r)=>{const n=r?{left:r===Z.left?e:void 0,top:r===Z.top?e:void 0,right:r===Z.right?e:void 0,bottom:r===Z.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(n)).then(l=>i(l))},this.setAreBleedValuesCombined=async(t,e)=>{const r={areBleedValuesCombined:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(r)).then(c=>i(c))},this.resetBleedValues=async t=>(await a(this,f)).updateLayoutBleed(t,null).then(r=>i(r)),this.setPrivateData=async(t,e)=>(await a(this,f)).setLayoutPrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,f)).getLayoutPrivateData(t).then(r=>i(r)),this.setDisplayName=async(t,e)=>(await a(this,f)).setLayoutDisplayName(t,e).then(n=>i(n)),this.getDisplayName=async t=>(await a(this,f)).getLayoutDisplayName(t).then(r=>i(r)),this.resetDisplayName=async t=>(await a(this,f)).setLayoutDisplayName(t,null).then(r=>i(r)),this.setAvailableForUser=async(t,e)=>(await a(this,f)).setLayoutAvailableForUser(t,e).then(n=>i(n)),this.setSelectedByUser=async(t,e)=>(await a(this,f)).setLayoutSelectedByUser(t,e).then(n=>i(n)),this.setResizableByUser=async(t,e)=>(await a(this,f)).setLayoutResizableByUser(t,JSON.stringify(e)).then(n=>i(n)),y(this,f,o),y(this,Wt,o)}}f=new WeakMap,Wt=new WeakMap;var oe=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(oe||{}),be=(s=>(s.web="web",s.print="print",s.animation="animation",s))(be||{});class Ms{constructor(o){g(this,X);g(this,jt);this.query=async(t,e,r={})=>(await a(this,X)).mediaConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,X)).mediaConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r,n={})=>{const c=this.parseDeprecatedMediaDownloadType(r);return(await a(this,jt)).mediaConnectorDownload(t,e,c,be.web,JSON.stringify(n)).then(d=>{if(d instanceof Uint8Array)return d;throw typeof d=="object"&&d!==null&&"success"in d&&!d.success&&ye(d),new Error(`Unexpected response type: ${typeof d}.`)})},this.getConfigurationOptions=async t=>(await a(this,X)).mediaConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,X)).mediaConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedMediaType=t=>{if(t===Pt.file)return Ft.file;if(t===Pt.collection)return Ft.collection},this.upload=async(t,e,r={})=>(await a(this,X)).mediaConnectorUpload(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),y(this,X,o),y(this,jt,o)}parseDeprecatedMediaDownloadType(o){switch(o){case ae.HighResolutionWeb:return oe.highres;case ae.LowResolutionWeb:return oe.thumbnail;default:return o}}}X=new WeakMap,jt=new WeakMap;let Ns=(Dr=class{constructor(o){g(this,O);g(this,qt);this.add=async()=>(await a(this,O)).addPage().then(e=>i(e)),this.remove=async t=>(await a(this,O)).removePage(t).then(r=>i(r)),this.select=async t=>(await a(this,O)).selectPage(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,O)).setPageIsVisible(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,O)).duplicatePage(t).then(r=>i(r)),this.getAll=async()=>(await a(this,O)).getPages().then(e=>i(e)),this.getById=async t=>(await a(this,O)).getPageById(t).then(r=>i(r)),this.getSnapshot=async(t,e)=>(await a(this,qt)).getPageSnapshotWithSettings(t,e==null?null:JSON.stringify(e)).then(n=>n??n),this.setWidth=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,O)).setPageWidth(e).then(n=>i(n))),this.setHeight=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,O)).setPageHeight(e).then(n=>i(n))),this.setSize=async(t,e)=>(await a(this,O)).setPageSize(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,O)).reorderPages(t,e).then(n=>i(n)),y(this,O,o),y(this,qt,o)}},O=new WeakMap,qt=new WeakMap,Dr);class Rs{constructor(o){g(this,k);this.getAll=async()=>(await a(this,k)).getParagraphStyles().then(e=>i(e)),this.getById=async t=>(await a(this,k)).getParagraphStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,k)).createParagraphStyle().then(e=>i(e)),this.duplicate=async t=>(await a(this,k)).duplicateParagraphStyle(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,k)).updateParagraphStyle(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,k)).renameParagraphStyle(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,k)).removeParagraphStyle(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,k)).moveParagraphStyles(t,e).then(n=>i(n)),y(this,k,o)}}k=new WeakMap;var T=(s=>(s.info="info",s.warn="warn",s.error="error",s))(T||{}),Vs=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s))(Vs||{}),xt=(s=>(s.throw="throw",s.log="log",s))(xt||{});class Ts{constructor(o,t,e,r){this.type="action",this.message=o,this.id=t,this.event=e,this.eventChain=r}}class Bs{constructor(o,t,e){this.type="dataRow",this.count=o,this.message=t,this.exceptions=e}}var ce=(s=>(s.shortText="shortText",s.longText="longText",s.image="image",s.list="list",s.boolean="boolean",s.group="group",s.number="number",s.date="date",s))(ce||{}),Gs=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Gs||{}),Js=(s=>(s.en_US="en_US",s.cs="cs",s.da="da",s.nl="nl",s.fi="fi",s.fr="fr",s.de="de",s.it="it",s.no="no",s.pl="pl",s.pt_PT="pt_PT",s.es_ES="es_ES",s.sv="sv",s))(Js||{}),Dt=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Dt||{}),Us=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(Us||{}),ks=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(ks||{});let Vn=class{constructor(o,t){this.onActionsChanged=e=>{this.config.events.onActionsChanged.trigger(JSON.parse(e))},this.onAnimationChanged=e=>{this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(e))},this.onAnimationPlaybackChanged=e=>{this.config.events.onScrubberPositionChanged.trigger(JSON.parse(e))},this.onSelectedLayoutPropertiesChanged=e=>{this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutUnitChanged=e=>{this.config.events.onSelectedLayoutUnitChanged.trigger(e)},this.onFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onFramesLayoutChanged.trigger(r)},this.onSelectedFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesLayoutChanged.trigger(r);const n=this.config.onSelectedFrameLayoutChanged;n&&n(r.length>1?void 0:r[0])},this.onSelectedFramesContentChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesContentChanged.trigger(r);const n=this.config.onSelectedFrameContentChanged;n&&n(r.length>1?null:r[0])},this.onStateChanged=()=>{this.config.events.onStateChanged.trigger()},this.onAuthExpired=async e=>{const r=await this.config.handlers.onAuthExpired.trigger(JSON.parse(e));return r!=null?JSON.stringify(r):null},this.onViewportRequested=()=>{const e=this.config.handlers.onViewportRequested.trigger();return e!=null?JSON.stringify(e):null},this.onDocumentLoaded=()=>{this.config.events.onDocumentLoaded.trigger()},this.onPageSelectionChanged=e=>{this.config.events.onPageSelectionChanged.trigger(e)},this.onVariableListChanged=e=>{const n=JSON.parse(e).map(c=>{var l;return c.type===ce.list?{...c,items:c.items.map(d=>d.value),selected:(l=c.selected)==null?void 0:l.value}:c});this.config.events.onVariableListChanged.trigger(n)},this.onSelectedToolChanged=e=>{this.config.events.onSelectedToolChanged.trigger(e)},this.onUndoStateChanged=e=>{this.config.events.onUndoStackStateChanged.trigger(JSON.parse(e))},this.onCustomUndoDataChanged=e=>{this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(e))},this.onSelectedLayoutFramesChanged=e=>{this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(e))},this.onSelectedTextStyleChanged=e=>{this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(e))},this.onColorsChanged=e=>{this.config.events.onColorsChanged.trigger(JSON.parse(e))},this.onParagraphStylesChanged=e=>{this.config.events.onParagraphStylesChanged.trigger(JSON.parse(e))},this.onCharacterStylesChanged=e=>{this.config.events.onCharacterStylesChanged.trigger(JSON.parse(e))},this.onFontFamiliesChanged=e=>{this.config.events.onFontFamiliesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutIdChanged=e=>{this.config.events.onSelectedLayoutIdChanged.trigger(e)},this.onLayoutsChanged=e=>{this.config.events.onLayoutsChanged.trigger(JSON.parse(e))},this.onZoomChanged=e=>{this.config.events.onZoomChanged.trigger(JSON.parse(e))},this.onConnectorEvent=e=>{this.config.events.onConnectorEvent.trigger(JSON.parse(e))},this.onConnectorsChanged=e=>{const n=new me().makeMultipleConnectorsBackwardsCompatible(JSON.parse(e),this.localConfig.get(Y.GraFxStudioEnvironmentApiUrl));this.config.events.onConnectorsChanged.trigger(n)},this.onSelectedPageIdChanged=e=>{this.config.events.onSelectedPageIdChanged.trigger(e)},this.onPagesChanged=e=>{this.config.events.onPagesChanged.trigger(JSON.parse(e))},this.onPageSnapshotInvalidated=e=>{this.config.events.onPageSnapshotInvalidated.trigger(e)},this.onPageSizeChanged=e=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(e))},this.onShapeCornerRadiusChanged=e=>{this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(e))},this.onCropActiveFrameIdChanged=e=>{this.config.events.onCropActiveFrameIdChanged.trigger(e)},this.onAsyncError=e=>{const r=JSON.parse(e);if((r==null?void 0:r.type)==="dataRow"){const n=new Bs(r.count,r.message,r.exceptions);this.config.events.onAsyncError.trigger(n)}else if((r==null?void 0:r.type)==="action"){const n=new Ts(r.message,r.id,r.event,r.eventChain);this.config.events.onAsyncError.trigger(n)}else this.config.events.onAsyncError.trigger(r)},this.onViewModeChanged=e=>{this.config.events.onViewModeChanged.trigger(e)},this.onBarcodeValidationChanged=e=>{this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(e))},this.onDataSourceIdChanged=e=>{this.config.events.onDataSourceIdChanged.trigger(e)},this.onDocumentIssueListChanged=e=>{this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(e))},this.onEngineEditModeChanged=e=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(e))},this.onBrandKitMediaChanged=e=>{this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(e))},this.config=o,this.localConfig=t}};class _s{constructor(o){g(this,bt);this.set=async t=>(await a(this,bt)).selectedTextStyleDeltaUpdate(JSON.stringify(t)).then(r=>i(r)),this.removeSelected=async()=>(await a(this,bt)).selectedTextStyleClean().then(e=>i(e)),this.getSelected=async()=>(await a(this,bt)).getSelectedTextStyle().then(e=>i(e)),y(this,bt,o)}}bt=new WeakMap;var Hs=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Hs||{}),xs=(s=>(s.LAYOUT_HEIGHT="layoutHeight",s.LAYOUT_WIDTH="layoutWidth",s.BLEED_TOP="bleedTop",s.BLEED_BOTTOM="bleedBottom",s.BLEED_LEFT="bleedLeft",s.BLEED_RIGHT="bleedRight",s.BLEED_VALUES_COMBINED="areBleedValuesCombined",s))(xs||{}),$=(s=>(s.SELECT="select",s.ZOOM="zoom",s.HAND="hand",s.IMAGE_FRAME="imageFrame",s.TEXT_FRAME="textFrame",s.SHAPE_RECT="rect",s.SHAPE_ELLIPSE="ellipse",s.SHAPE_POLYGON="polygon",s))($||{}),Ks=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s.HTML="html",s))(Ks||{}),he=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(he||{});class $s{constructor(o){g(this,Nt);this.setTool=async t=>(await a(this,Nt)).setTool(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,Nt)).getSelectedTool().then(e=>i(e)),this.setPointer=async()=>this.setTool($.SELECT),this.setSelect=async()=>this.setTool($.SELECT),this.setHand=async()=>this.setTool($.HAND),this.setZoom=async()=>this.setTool($.ZOOM),this.setTextFrame=async()=>this.setTool($.TEXT_FRAME),this.setImageFrame=async()=>this.setTool($.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool($.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool($.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool($.SHAPE_POLYGON),y(this,Nt,o)}}Nt=new WeakMap;class zs{constructor(o,t){g(this,tt);g(this,j);g(this,Yt);this.undo=async()=>(await a(this,tt)).undo().then(r=>i(r)),this.redo=async()=>(await a(this,tt)).redo().then(r=>i(r)),this.addCustomData=async(e,r)=>(await a(this,tt)).setCustomUndoData(e,r,!1).then(c=>i(c)),this.record=async(e,r)=>{try{await a(this,j).beginIfNoneActive(e),await r(a(this,Yt)),await a(this,j).end()}catch(n){throw await a(this,j).abort(),n}},this.pause=async()=>(await a(this,tt)).pause().then(r=>i(r)),this.resume=async()=>(await a(this,tt)).resume().then(r=>i(r)),this.advanced={begin:async e=>a(this,j).begin(e),beginIfNoneActive:async e=>a(this,j).beginIfNoneActive(e),end:async()=>a(this,j).end(),abort:async()=>a(this,j).abort()},y(this,tt,o),y(this,Yt,t),y(this,j,new Tn(o))}}tt=new WeakMap,j=new WeakMap,Yt=new WeakMap;class Tn{constructor(o){g(this,ut);this.begin=async t=>(await a(this,ut)).begin(t).then(r=>i(r)),this.beginIfNoneActive=async t=>(await a(this,ut)).beginIfNoneActive(t).then(r=>i(r)),this.end=async()=>(await a(this,ut)).end().then(e=>i(e)),this.abort=async()=>(await a(this,ut)).abort().then(e=>i(e)),y(this,ut,o)}}ut=new WeakMap;const Bn=(s,o=2)=>{const t=Math.pow(10,o);return Math.round(s*t)/t};class Ws{constructor(o,t){g(this,Zt);g(this,Rt);this.round=(e,r)=>i({data:String(Bn(e,r)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=e=>{const{type:r=he.SANDBOX,environment:n="ft-nostress",version:c="1"}=e,l=r==he.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${n}.${l}.online/grafx/api/v${c}/environment/${n}`},this.stageFiles=async(e,r,n)=>{const c=a(this,Rt).get(Y.GraFxStudioEnvironmentApiUrl);if(!c)throw new Error("GraFx Studio Environment API URL is not set");const l=`${c}connectors/${r}/stage`,d=a(this,Rt).get(Y.GraFxStudioAuthToken);if(!d)throw new Error("GraFx Studio Auth Token is not set");const C=new FormData;e.forEach((S,v)=>{const P=S instanceof File?S.name:`blob-${v}`;C.append("files",S,P)}),n&&C.append("validationJson",JSON.stringify({allowedMimeTypes:n.mimeTypes,minDimensions:{width:n.minWidthPixels,height:n.minHeightPixels}}));const p=await fetch(l,{method:"POST",body:C,headers:{Authorization:`Bearer ${d}`}});if(p.status===422){const S=await p.json();throw new as(S.message,we.minDimension)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},this.unitEvaluate=async(e,r)=>(await a(this,Zt)).unitEvaluate(e,r).then(c=>i(c)),y(this,Zt,o),y(this,Rt,t)}}Zt=new WeakMap,Rt=new WeakMap;class Gn{constructor(o){g(this,Qt);this.setMinimum=async(t,e)=>{const r={minValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setMaximum=async(t,e)=>{const r={maxValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setShowStepper=async(t,e)=>{const r={showStepper:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStepSize=async(t,e)=>{const r={stepSize:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setThousandsSeparator=async(t,e)=>{const r={thousandsSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalSeparator=async(t,e)=>{const r={decimalSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalCharacterStyle=async(t,e)=>{const r={decimalCharacterStyleId:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setNumberOfDecimals=async(t,e)=>{const r={numberOfDecimals:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Qt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Qt)).updateNumberVariableProperties(o,JSON.stringify(t));return i(r)}}Qt=new WeakMap;class Jn{constructor(o){g(this,Xt);this.setDisplayFormat=async(t,e)=>{const r={displayFormat:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setLocale=async(t,e)=>{const r={locale:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStartDate=async(t,e)=>{const r={startDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setEndDate=async(t,e)=>{const r={endDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setExcludedDays=async(t,e)=>{const r={excludedDays:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Xt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Xt)).updateDateVariableProperties(o,JSON.stringify(t));return i(r)}}Xt=new WeakMap;let js=(Or=class{constructor(o){g(this,m);g(this,Vt);g(this,Tt);this.getAll=async()=>(await a(this,m)).getVariables().then(e=>i(e)).then(e=>{const r=e;return r.parsedData&&(r.parsedData=this.makeVariablesBackwardsCompatible(r.parsedData)),r}),this.getById=async t=>(await a(this,m)).getVariableById(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.getByName=async t=>(await a(this,m)).getVariableByName(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.create=async(t,e)=>(await a(this,m)).addVariable(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,m)).removeVariables(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,m)).setVariableName(t,e).then(n=>i(n)),this.setLabel=async(t,e)=>(await a(this,m)).setVariableLabel(t,e).then(n=>i(n)),y(this,Vt,async(t,e)=>(await a(this,m)).setVariablePlaceholder(t,e).then(n=>i(n))),this.setPlaceholder=async(t,e)=>a(this,Vt).call(this,t,e),this.resetPlaceholder=async t=>a(this,Vt).call(this,t,null),y(this,Tt,async(t,e)=>(await a(this,m)).setVariableHelpText(t,e).then(n=>i(n))),this.setHelpText=async(t,e)=>a(this,Tt).call(this,t,e),this.resetHelpText=async t=>a(this,Tt).call(this,t,null),this.setType=async(t,e)=>(await a(this,m)).setVariableType(t,e).then(n=>i(n)),this.setListVariable=async(t,e)=>(await a(this,m)).setListVariableItems(t,e.map(n=>JSON.stringify({value:n}))).then(n=>i(n)),this.setValue=async(t,e)=>(await a(this,m)).setVariableValue(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,m)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,e)=>(await a(this,m)).groupVariables(t,e).then(n=>i(n)),this.ungroupVariables=async t=>(await a(this,m)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,e,r)=>(await a(this,m)).moveVariable(e,r,t).then(c=>i(c)),this.moveVariables=async(t,e,r)=>(await a(this,m)).moveVariables(e,r,t).then(c=>i(c)),this.setIsVisible=async(t,e)=>{const r=e?{type:Dt.visible}:{type:Dt.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,e)=>{const r=e?{type:Dt.invisible}:{type:Dt.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,e)=>(await a(this,m)).setVariableVisibility(t,JSON.stringify(e)).then(n=>i(n)),this.setLayoutsForVariableVisibility=async t=>(await a(this,m)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,e)=>(await a(this,m)).setVariableIsRequired(t,e).then(n=>i(n)),this.setRemoveParagraphIfEmpty=async(t,e)=>(await a(this,m)).setVariableRemoveParagraphIfEmpty(t,e).then(n=>i(n)),this.setIsReadonly=async(t,e)=>(await a(this,m)).setVariableIsReadonly(t,e).then(n=>i(n)),this.getImageVariableConnectorId=async t=>(await a(this,m)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,e)=>{const r=await a(this,m),c=new me().makeConnectorSourceForwardsCompatible(e);return r.setImageVariableConnector(t,JSON.stringify(c)).then(l=>i(l))},this.setImageVariableValueWithContext=async(t,e,r)=>(await a(this,m)).setImageVariableValueWithContext(t,e,JSON.stringify(r)).then(c=>i(c)),this.removeSource=async t=>this.setValue(t,null),this.setPrefix=async(t,e)=>{const r={prefix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffix=async(t,e)=>{const r={suffix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrefixCharacterStyle=async(t,e)=>{const r={prefixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffixCharacterStyle=async(t,e)=>{const r={suffixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrivateData=async(t,e)=>(await a(this,m)).setVariablePrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,m)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,e)=>(await a(this,m)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowImageUpload=async(t,e)=>(await a(this,m)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinImageUploadSize=async(t,e,r)=>(await a(this,m)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setIsDontBreak=async(t,e)=>(await a(this,m)).setVariableIsDontBreak(t,e).then(n=>i(n)),y(this,m,o),this.number=new Gn(a(this,m)),this.date=new Jn(a(this,m))}makeVariablesBackwardsCompatible(o){return o.map(t=>this.makeVariableBackwardsCompatible(t))}makeVariableBackwardsCompatible(o){return o.type!==ce.list?o:this.makeListVariableBackwardsCompatible(o)}makeListVariableBackwardsCompatible(o){const t=o,e=o.items,r=o.selected,n=e.map(c=>c.value);return t.items=n,t.selected=r==null?void 0:r.value,t}async applyPrefixSuffixDeltaUpdate(o,t){const r=await(await a(this,m)).updateVariablePrefixSuffixProperties(o,JSON.stringify(t));return i(r)}},m=new WeakMap,Vt=new WeakMap,Tt=new WeakMap,Or);class Un{constructor(o){this.onVariableListChanged=t=>{this.config.events.onVariableListChanged.trigger(JSON.parse(t))},this.onConnectorsChanged=t=>{this.config.events.onConnectorsChanged.trigger(JSON.parse(t))},this.onPageSizeChanged=t=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(t))},this.onEngineEditModeChanged=t=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(t))},this.config=o}}class kn{constructor(o){g(this,gt);this.getAll=async()=>(await a(this,gt)).getVariables().then(e=>i(e)),this.getById=async t=>(await a(this,gt)).getVariableById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,gt)).getVariableByName(t).then(r=>i(r)),this.setListVariable=async(t,e)=>(await a(this,gt)).setListVariableItems(t,e.map(n=>JSON.stringify(n))).then(n=>i(n)),y(this,gt,o),this.image=new _n(o)}}gt=new WeakMap;class _n{constructor(o){g(this,et);this.setAllowQuery=async(t,e)=>(await a(this,et)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowUpload=async(t,e)=>(await a(this,et)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinUploadSize=async(t,e,r)=>(await a(this,et)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setConnector=async(t,e)=>(await a(this,et)).setImageVariableConnector(t,JSON.stringify(e)).then(n=>i(n)),this.setConnectorContext=async(t,e)=>(await a(this,et)).setImageVariableConnectorContext(t,JSON.stringify(e)).then(n=>i(n)),y(this,et,o)}}et=new WeakMap;class Hn{constructor(o){g(this,vt);this.register=async t=>(await a(this,vt)).registerConnector(JSON.stringify(t)).then(r=>i(r)),this.getById=async t=>(await a(this,vt)).getConnectorById(t).then(r=>i(r)),this.getAllByType=async t=>(await a(this,vt)).getConnectors(t).then(r=>i(r)),y(this,vt,o)}}vt=new WeakMap;class xn{constructor(o){g(this,Bt);g(this,le);this.setWidth=async t=>(await a(this,Bt)).setPageWidth(t).then(r=>i(r)),this.setHeight=async t=>(await a(this,Bt)).setPageHeight(t).then(r=>i(r)),y(this,Bt,o),y(this,le,o)}}Bt=new WeakMap,le=new WeakMap;class qs{constructor(o,t,e){this.config=o,this.connection=t,this.editorAPI=e,this.subscriber=new Un(o),this.variable=new kn(this.editorAPI),this.connector=new Hn(this.editorAPI),this.page=new xn(this.editorAPI),this.canvas=new Ce(this.editorAPI)}}class Ys{constructor(o){this.logger=o}createEventHandlerFn(o,t){return(...r)=>{try{const n=o(...r);return n instanceof Promise?n.catch(c=>this.handleError(c,t,o.name)):n}catch(n){this.handleError(n,t,o.name)}}}handleError(o,t,e){var r;if(t===xt.log)(r=this.logger)==null||r.call(this,T.error,Vs.event,`Error in callback ${e}: ${o}`);else throw o}}class Zs extends Ys{constructor(o,t){super(t),this.handler=o}trigger(...o){const t=this.handler();if(t)return this.createEventHandlerFn(t,xt.throw)(...o)}}class w extends Ys{constructor(o,t){super(t),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const t=this.legacyHandler();t&&this.createEventHandlerFn(t,xt.log)(...o);for(const e of this.subscriptions)e(...o)}registerCallback(o,t=xt.log){const e=this.createEventHandlerFn(o,t);return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}}class ve{static createRuntimeConfig(o){var e,r,n,c,l,d,C,p,I,S,v,P,A,b,H,L,F,st,rt,Ut,kt,Lr,Mr,Nr,Rr,Vr,Tr,Br,Gr,Jr,Ur,kr,_r,Hr,xr;const t={...o};return t.logging={logLevel:((e=o.logging)==null?void 0:e.logLevel)||T.error,logger:((r=o.logging)==null?void 0:r.logger)||((ee,Ie,Ae)=>{var Kr;if(ve.isLoggingEnabled(ee,((Kr=t.logging)==null?void 0:Kr.logLevel)??T.error))switch(ee){case T.error:console.error(`[${Ie}] [${ee}] ${Ae}`);break;case T.warn:console.warn(`[${Ie}] [${ee}] ${Ae}`);break;default:console.log(`[${Ie}] [${ee}] ${Ae}`)}})},t.handlers={onAuthExpired:new Zs(()=>t.onAuthExpired,(n=t.logging)==null?void 0:n.logger),onViewportRequested:new Zs(()=>t.onViewportRequested,(c=t.logging)==null?void 0:c.logger)},t.events={onActionsChanged:new w(()=>t.onActionsChanged,(l=t.logging)==null?void 0:l.logger),onStateChanged:new w(()=>t.onStateChanged,(d=t.logging)==null?void 0:d.logger),onDocumentLoaded:new w(()=>t.onDocumentLoaded,(C=t.logging)==null?void 0:C.logger),onSelectedFramesLayoutChanged:new w(()=>t.onSelectedFramesLayoutChanged,(p=t.logging)==null?void 0:p.logger),onFramesLayoutChanged:new w(()=>t.onFramesLayoutChanged,(I=t.logging)==null?void 0:I.logger),onSelectedFramesContentChanged:new w(()=>t.onSelectedFramesContentChanged,(S=t.logging)==null?void 0:S.logger),onPageSelectionChanged:new w(()=>t.onPageSelectionChanged,(v=t.logging)==null?void 0:v.logger),onSelectedLayoutPropertiesChanged:new w(()=>t.onSelectedLayoutPropertiesChanged,(P=t.logging)==null?void 0:P.logger),onSelectedLayoutUnitChanged:new w(()=>t.onSelectedLayoutUnitChanged,(A=t.logging)==null?void 0:A.logger),onScrubberPositionChanged:new w(()=>t.onScrubberPositionChanged,(b=t.logging)==null?void 0:b.logger),onFrameAnimationsChanged:new w(()=>t.onFrameAnimationsChanged,(H=t.logging)==null?void 0:H.logger),onVariableListChanged:new w(()=>t.onVariableListChanged,(L=t.logging)==null?void 0:L.logger),onSelectedToolChanged:new w(()=>t.onSelectedToolChanged,(F=t.logging)==null?void 0:F.logger),onUndoStackStateChanged:new w(()=>t.onUndoStackStateChanged,(st=t.logging)==null?void 0:st.logger),onSelectedLayoutFramesChanged:new w(()=>t.onSelectedLayoutFramesChanged,(rt=t.logging)==null?void 0:rt.logger),onSelectedTextStyleChanged:new w(()=>t.onSelectedTextStyleChanged,(Ut=t.logging)==null?void 0:Ut.logger),onColorsChanged:new w(()=>t.onColorsChanged,(kt=t.logging)==null?void 0:kt.logger),onParagraphStylesChanged:new w(()=>t.onParagraphStylesChanged,(Lr=t.logging)==null?void 0:Lr.logger),onCharacterStylesChanged:new w(()=>t.onCharacterStylesChanged,(Mr=t.logging)==null?void 0:Mr.logger),onFontFamiliesChanged:new w(()=>t.onFontFamiliesChanged,(Nr=t.logging)==null?void 0:Nr.logger),onSelectedLayoutIdChanged:new w(()=>t.onSelectedLayoutIdChanged,(Rr=t.logging)==null?void 0:Rr.logger),onLayoutsChanged:new w(()=>t.onLayoutsChanged,(Vr=t.logging)==null?void 0:Vr.logger),onConnectorEvent:new w(()=>t.onConnectorEvent,(Tr=t.logging)==null?void 0:Tr.logger),onConnectorsChanged:new w(()=>t.onConnectorsChanged,(Br=t.logging)==null?void 0:Br.logger),onZoomChanged:new w(()=>t.onZoomChanged,(Gr=t.logging)==null?void 0:Gr.logger),onSelectedPageIdChanged:new w(()=>t.onSelectedPageIdChanged,t.logging.logger),onPagesChanged:new w(()=>t.onPagesChanged,t.logging.logger),onPageSnapshotInvalidated:new w(()=>t.onPageSnapshotInvalidated,t.logging.logger),onPageSizeChanged:new w(()=>t.onPageSizeChanged,(Jr=t.logging)==null?void 0:Jr.logger),onShapeCornerRadiusChanged:new w(()=>t.onShapeCornerRadiusChanged,(Ur=t.logging)==null?void 0:Ur.logger),onCropActiveFrameIdChanged:new w(()=>t.onCropActiveFrameIdChanged,(kr=t.logging)==null?void 0:kr.logger),onAsyncError:new w(()=>t.onAsyncError,(_r=t.logging)==null?void 0:_r.logger),onViewModeChanged:new w(()=>t.onViewModeChanged,(Hr=t.logging)==null?void 0:Hr.logger),onBarcodeValidationChanged:new w(()=>t.onBarcodeValidationChanged,(xr=t.logging)==null?void 0:xr.logger),onDataSourceIdChanged:new w(()=>t.onDataSourceIdChanged,t.logging.logger),onDocumentIssueListChanged:new w(()=>t.onDocumentIssueListChanged,t.logging.logger),onCustomUndoDataChanged:new w(()=>t.onCustomUndoDataChanged,t.logging.logger),onEngineEditModeChanged:new w(()=>t.onEngineEditModeChanged,t.logging.logger),onBrandKitMediaChanged:new w(()=>t.onBrandKitMediaChanged,t.logging.logger)},t}static isLoggingEnabled(o,t){return t==T.info||t==T.warn&&(o==T.warn||o==T.error)?!0:t==T.error&&o==T.error}}class Kn{isDatePropertyWrapper(o){return typeof o=="object"&&(o==null?void 0:o.type)==="date"}isDateObject(o){return o instanceof Date}mapEngineToDataItem(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDatePropertyWrapper(r)?new Date(r.value):r}),t}mapDataItemToEngine(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDateObject(r)?{value:r.getTime(),type:"date"}:r}),t}}class $n{constructor(o){g(this,yt);y(this,yt,o)}async getValue(o){return(await a(this,yt)).getConfigValue(o).then(e=>i(e))}async setValue(o,t){return(await a(this,yt)).setConfigValue(o,t).then(r=>i(r))}async updateStudioOptions(o){return(await a(this,yt)).updateStudioOptions(JSON.stringify(o)).then(e=>i(e))}async getEngineSessionId(){return(await a(this,yt)).getEngineSessionId().then(t=>i(t))}}yt=new WeakMap;class Qs extends $n{constructor(t,e){super(t);g(this,Gt);y(this,Gt,e)}async getValue(t){const e=a(this,Gt).get(t);return e!=null?i({status:200,success:!0,parsedData:e,data:e},!1):super.getValue(t)}async setValue(t,e){const r=super.setValue(t,e);return a(this,Gt).set(t,e),r}}Gt=new WeakMap;class Xs{constructor(o){g(this,_);this.getAll=async()=>(await a(this,_)).getGradients().then(e=>i(e)),this.getById=async t=>(await a(this,_)).getGradientById(t).then(r=>i(r)),this.create=async()=>(await a(this,_)).createGradient().then(e=>i(e)),this.duplicate=async t=>(await a(this,_)).duplicateGradient(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,_)).moveGradients(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,_)).renameGradient(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,_),n=e;return r.updateGradient(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,_)).removeGradient(t).then(r=>i(r)),y(this,_,o)}}_=new WeakMap;class tr{constructor(o){g(this,It);g(this,te);this.query=async(t,e,r={})=>(await a(this,It)).componentConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.preview=async(t,e,r,n={})=>(await a(this,te)).componentConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>{if(l instanceof Uint8Array)return l;throw typeof l=="object"&&l!==null&&"success"in l&&!l.success&&ye(l),new Error(`Unexpected response type: ${typeof l}.`)}),this.getConfigurationOptions=async t=>(await a(this,It)).componentConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,It)).componentConnectorGetCapabilities(t).then(r=>i(r)),y(this,It,o),y(this,te,o)}}It=new WeakMap,te=new WeakMap;class er{constructor(o){g(this,Jt);this.linkVariable=async(t,e,r)=>(await a(this,Jt)).linkComponentVariable(t,e,r,null).then(c=>i(c)),this.getComponentVariables=async t=>(await a(this,Jt)).getComponentVariables(t).then(r=>i(r)),y(this,Jt,o)}}Jt=new WeakMap;const zn=`https://studio-cdn.chiligrafx.com/editor/${R.current}/web`;let at;class Wn{constructor(o){this.localConfig=new Map,this.dataItemMappingTools=new Kn,this.loadEditor=()=>{var t;mn(this.config.editorLink||zn,{onActionsChanged:this.subscriber.onActionsChanged,onStateChanged:this.subscriber.onStateChanged,onAuthExpired:this.subscriber.onAuthExpired,onViewportRequested:this.subscriber.onViewportRequested,onDocumentLoaded:this.subscriber.onDocumentLoaded,onSelectedFramesContentChanged:this.subscriber.onSelectedFramesContentChanged,onSelectedFramesLayoutChanged:this.subscriber.onSelectedFramesLayoutChanged,onFramesLayoutChanged:this.subscriber.onFramesLayoutChanged,onSelectedLayoutPropertiesChanged:this.subscriber.onSelectedLayoutPropertiesChanged,onSelectedLayoutUnitChanged:this.subscriber.onSelectedLayoutUnitChanged,onPageSelectionChanged:this.subscriber.onPageSelectionChanged,onScrubberPositionChanged:this.subscriber.onAnimationPlaybackChanged,onFrameAnimationsChanged:this.subscriber.onAnimationChanged,onVariableListChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onVariableListChanged?this.next.subscriber.onVariableListChanged(e):this.subscriber.onVariableListChanged(e)},onSelectedToolChanged:this.subscriber.onSelectedToolChanged,onUndoStateChanged:this.subscriber.onUndoStateChanged,onSelectedLayoutFramesChanged:this.subscriber.onSelectedLayoutFramesChanged,onSelectedTextStyleChanged:this.subscriber.onSelectedTextStyleChanged,onColorsChanged:this.subscriber.onColorsChanged,onParagraphStylesChanged:this.subscriber.onParagraphStylesChanged,onCharacterStylesChanged:this.subscriber.onCharacterStylesChanged,onFontFamiliesChanged:this.subscriber.onFontFamiliesChanged,onSelectedLayoutIdChanged:this.subscriber.onSelectedLayoutIdChanged,onLayoutsChanged:this.subscriber.onLayoutsChanged,onConnectorEvent:this.subscriber.onConnectorEvent,onConnectorsChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onConnectorsChanged?this.next.subscriber.onConnectorsChanged(e):this.subscriber.onConnectorsChanged(e)},onZoomChanged:this.subscriber.onZoomChanged,onSelectedPageIdChanged:this.subscriber.onSelectedPageIdChanged,onPagesChanged:this.subscriber.onPagesChanged,onPageSnapshotInvalidated:this.subscriber.onPageSnapshotInvalidated,onPageSizeChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onPageSizeChanged?this.next.subscriber.onPageSizeChanged(e):this.subscriber.onPageSizeChanged(e)},onShapeCornerRadiusChanged:this.subscriber.onShapeCornerRadiusChanged,onCropActiveFrameIdChanged:this.subscriber.onCropActiveFrameIdChanged,onAsyncError:this.subscriber.onAsyncError,onViewModeChanged:this.subscriber.onViewModeChanged,onBarcodeValidationChanged:this.subscriber.onBarcodeValidationChanged,onDataSourceIdChanged:this.subscriber.onDataSourceIdChanged,onDocumentIssueListChanged:this.subscriber.onDocumentIssueListChanged,onCustomUndoDataChanged:this.subscriber.onCustomUndoDataChanged,onEngineEditModeChanged:this.subscriber.onEngineEditModeChanged,onBrandKitMediaChanged:this.subscriber.onBrandKitMediaChanged},this.setConnection,this.config.editorId,this.config.studioStyling,e=>{var r,n;(n=(r=this.config).onConnectionError)==null||n.call(r,e)}),this.editorAPI=at==null?void 0:at.promise.then(e=>e),this.action=new Re(this.editorAPI),this.layout=new Ls(this.editorAPI),this.frame=new Ds(this.editorAPI),this.barcode=new ke(this.editorAPI),this.component=new er(this.editorAPI),this.animation=new Ve(this.editorAPI),this.document=new ls(this.editorAPI),this.configuration=new Qs(this.editorAPI,this.localConfig),this.utils=new Ws(this.editorAPI,this.localConfig),this.tool=new $s(this.editorAPI),this.page=new Ns(this.editorAPI),this.debug=new hs(this.editorAPI),this.undoManager=new zs(this.editorAPI,this),this.textSelection=new _s(this.editorAPI),this.colorStyle=new je(this.editorAPI),this.gradientStyle=new Xs(this.editorAPI),this.paragraphStyle=new Rs(this.editorAPI),this.characterStyle=new $e(this.editorAPI),this.mediaConnector=new Ms(this.editorAPI),this.fontConnector=new Fs(this.editorAPI),this.componentConnector=new tr(this.editorAPI),this.dataConnector=new os(this.editorAPI,this.dataItemMappingTools),this.dataSource=new cs(this.editorAPI,this.dataItemMappingTools),this.connector=new is(this.editorAPI,this.localConfig),this.variable=new js(this.editorAPI),this.font=new Es(this.editorAPI),this.experiment=new Ps(this.editorAPI),this.canvas=new Ce(this.editorAPI),this.shape=new Se(this.editorAPI),this.colorConversion=new We(this.editorAPI),this.info=new Os,this.clipboard=new ze(this.editorAPI),this.brandKit=new Ke(this.editorAPI,this),this.next=new qs(this.config,this.connection,this.editorAPI),this.configuration.setValue(Y.GraFxStudioSdkVersion,Pe.version),this.configuration.setValue(Y.GraFxStudioDocumentType,this.config.documentType||ge.template),this.configuration.updateStudioOptions(this.config.studioOptions||fn),this.configuration.setValue(Y.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{at=t},this.config=ve.createRuntimeConfig(o),this.connection=at,this.editorAPI=at==null?void 0:at.promise.then(t=>t),this.action=new Re(this.editorAPI),this.layout=new Ls(this.editorAPI),this.frame=new Ds(this.editorAPI),this.shape=new Se(this.editorAPI),this.barcode=new ke(this.editorAPI),this.component=new er(this.editorAPI),this.undoManager=new zs(this.editorAPI,this),this.connector=new is(this.editorAPI,this.localConfig),this.mediaConnector=new Ms(this.editorAPI),this.fontConnector=new Fs(this.editorAPI),this.componentConnector=new tr(this.editorAPI),this.dataConnector=new os(this.editorAPI,this.dataItemMappingTools),this.dataSource=new cs(this.editorAPI,this.dataItemMappingTools),this.animation=new Ve(this.editorAPI),this.document=new ls(this.editorAPI),this.configuration=new Qs(this.editorAPI,this.localConfig),this.variable=new js(this.editorAPI),this.utils=new Ws(this.editorAPI,this.localConfig),this.subscriber=new Vn(this.config,this.localConfig),this.tool=new $s(this.editorAPI),this.page=new Ns(this.editorAPI),this.debug=new hs(this.editorAPI),this.textSelection=new _s(this.editorAPI),this.colorStyle=new je(this.editorAPI),this.gradientStyle=new Xs(this.editorAPI),this.paragraphStyle=new Rs(this.editorAPI),this.characterStyle=new $e(this.editorAPI),this.font=new Es(this.editorAPI),this.experiment=new Ps(this.editorAPI),this.canvas=new Ce(this.editorAPI),this.colorConversion=new We(this.editorAPI),this.info=new Os,this.clipboard=new ze(this.editorAPI),this.next=new qs(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=new Ke(this.editorAPI,this)}}var sr=(s=>(s.top="top",s.left="left",s.right="right",s.bottom="bottom",s.topLeft="topLeft",s.topRight="topRight",s.bottomLeft="bottomLeft",s.bottomRight="bottomRight",s))(sr||{}),rr=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(rr||{}),nr=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))(nr||{}),ar=(s=>(s.quadratic="Quadratic",s.cubic="Cubic",s.quartic="Quartic",s.quintic="Quintic",s.sine="Sine",s.exponential="Exponential",s.circular="Circular",s.elastic="Elastic",s.bounce="Bounce",s.back="Back",s))(ar||{}),ir=(s=>(s.bounce="bounce",s.flash="flash",s.headshake="headShake",s.heartbeat="heartbeat",s.pulse="pulse",s.rubberBand="rubberBand",s.vertical="vertical",s.horizontal="horizontal",s.swing="swing",s.tada="tada",s))(ir||{}),or=(s=>(s.preview="preview",s.normal="normal",s))(or||{}),cr=(s=>(s.linear="linear",s))(cr||{}),hr=(s=>(s.local="linearLocal",s.linearBrandKit="linearBrandKit",s))(hr||{}),lr=(s=>(s.Square="square",s.Line="line",s))(lr||{}),dr=(s=>(s.thumbnail="thumbnail",s.highest="highest",s.medium="medium",s))(dr||{}),ur=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(ur||{}),gr=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(gr||{}),yr=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(yr||{}),pr=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(pr||{}),Cr=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Cr||{}),wr=(s=>(s.none="none",s.bullet="bullet",s.number="number",s))(wr||{}),mr=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(mr||{}),fr=(s=>(s.PARAGRAPH="paragraphStyleId",s.CHARACTER="characterStyleId",s.FONT_FAMILY="fontKey",s.FONT_STYLE="fontStyle",s.FONT_SIZE="fontSize",s.LETTER_SPACING="letterSpacing",s.LINE_HEIGHT="lineHeight",s.TEXT_ALIGN="textAlign",s.VERTICAL_ALIGN="verticalAlign",s.TYPOGRAPHIC_CASE="typographicCase",s.SUB_SUPER_SCRIPT="subSuperScript",s.UNDERLINE="underline",s.LINE_THROUGH="lineThrough",s.FILL_COLOR="fillColor",s.COLOR="color",s.FILL_COLOR_APPLIED="fillColorApplied",s.STROKE_COLOR="strokeColor",s.STROKE_COLOR_APPLIED="strokeColorApplied",s.DROP_SHADOW_COLOR="dropShadowColor",s.BLEND_MODE="blendMode",s.OPACITY="opacity",s.TRACKING_RIGHT="trackingRight",s.BASELINE_SHIFT="baselineShiftValue",s.STROKE_WIDTH="strokeWidth",s.MARKED_LIST_TYPE="markedListType",s.MARKED_LIST_GROUP="markedListGroup",s.MARKED_LIST_LEVEL="markedListLevel",s))(fr||{}),Sr=(s=>(s.arabic="arabic",s.romanUpperCase="romanUpperCase",s.romanLowerCase="romanLowerCase",s.latinUpperCase="latinUpperCase",s.latinLowerCase="latinLowerCase",s))(Sr||{}),br=(s=>(s.none="none",s.dash="dash",s.dot="dot",s.colon="colon",s.roundBracket="roundBracket",s))(br||{}),vr=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(vr||{}),Ir=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s))(Ir||{}),Ar=(s=>(s.all="all",s.only="only",s.none="none",s))(Ar||{}),Pr=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s.gradient="gradient",s))(Pr||{}),Fr=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Fr||{});const jn=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:Fr},Symbol.toStringTag,{value:"Module"}));h.ActionAsyncError=Ts,h.ActionEditorEvent=vr,h.Alignment=gr,h.AnchorTargetEdgeType=As,h.AnchorTargetType=Is,h.AuthCredentialsTypeEnum=rs,h.AuthRefreshTypeEnum=ns,h.AutoGrowDirection=ds,h.BarcodeCharacterSet=Ct,h.BarcodeErrorCorrectionLevel=At,h.BarcodeSourceTypeEnum=ys,h.BarcodeType=x,h.BarcodeValidationResult=Te,h.BasicAnimationsEmphasisStyles=ir,h.BlendMode=ms,h.Case=pr,h.ColorType=Q,h.ColorUsageType=re,h.ComponentPreviewType=dr,h.ComponentSourceTypeEnum=us,h.ConnectorConfigContextType=Xe,h.ConnectorConfigValueType=Qe,h.ConnectorEventType=ss,h.ConnectorHttpError=Ne,h.ConnectorMapping=Fn,h.ConnectorMappingDirection=es,h.ConnectorMappingSource=ts,h.ConnectorRegistrationSource=Et,h.ConnectorStateType=ie,h.ConnectorType=qe,h.ConstraintMode=Ue,h.CornerRadiusType=Ar,h.CropType=fe,h.DataRowAsyncError=Bs,h.Day=Gs,h.DeprecatedMediaConnectorDownloadType=ae,h.DeprecatedMediaType=Pt,h.DocumentIssueTypeEnum=Me,h.DocumentType=ge,h.DownloadFormats=Ks,h.EaseTypes=nr,h.EngineEditModeType=Pr,h.EnvironmentType=he,h.FitMode=fs,h.FitModePosition=Ss,h.FlowDirection=Cs,h.FontPreviewFormat=lr,h.FontWeights=ur,h.FrameAnchorTarget=Nn,h.FrameAnchorType=vs,h.FrameEditingMode=Le,h.FramePropertyNames=Hs,h.FrameTypeEnum=gs,h.GradientType=cr,h.GradientUsageType=hr,h.GrafxTokenAuthCredentials=Dn,h.ImageSourceTypeEnum=Ht,h.LayoutIntent=Je,h.LayoutPropertyNames=xs,h.LayoutType=Ge,h.Locale=Js,h.MarkedListType=wr,h.MeasurementUnit=Be,h.MediaDownloadIntent=be,h.MediaDownloadType=oe,h.MediaType=Ft,h.Next=jn,h.NumberListFormat=Sr,h.NumberListSeparatorSymbol=br,h.PageAnchorTarget=Mn,h.PositionEnum=Z,h.RefreshedAuthCredendentials=On,h.Scripting=Cr,h.SelectedTextStyleSections=mr,h.SelectedTextStyles=fr,h.ShakeDirections=rr,h.ShapeType=Ir,h.SlideDirections=sr,h.SortBy=Ye,h.SortOrder=Ze,h.TextDirection=ps,h.TextPosition=yr,h.ToolType=$,h.TweenTypes=ar,h.UpdateZIndexMethod=bs,h.UploadAssetValidationError=as,h.UploadAssetValidationErrorType=we,h.VariableType=ce,h.VariableVisibilityOperator=ks,h.VariableVisibilityTargetType=Us,h.VariableVisibilityType=Dt,h.VerticalAlign=ws,h.ViewMode=or,h.WellKnownConfigurationKeys=Y,h.default=Wn,h.grafxMediaConnectorRegistration=En,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
21
69
  //# sourceMappingURL=main.js.map