@chili-publish/studio-sdk 1.46.1 → 1.47.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 (63) hide show
  1. package/_bundles/main.js +4 -4
  2. package/_bundles/main.js.map +1 -1
  3. package/lib/src/controllers/ComponentGridController.cjs.js.map +1 -1
  4. package/lib/src/controllers/ComponentGridController.es.js.map +1 -1
  5. package/lib/src/controllers/FrameController.cjs.js +8 -0
  6. package/lib/src/controllers/FrameController.cjs.js.map +1 -1
  7. package/lib/src/controllers/FrameController.d.ts +14 -0
  8. package/lib/src/controllers/FrameController.es.js +8 -0
  9. package/lib/src/controllers/FrameController.es.js.map +1 -1
  10. package/lib/src/controllers/UtilsController.cjs.js +4 -1
  11. package/lib/src/controllers/UtilsController.cjs.js.map +1 -1
  12. package/lib/src/controllers/UtilsController.es.js +4 -1
  13. package/lib/src/controllers/UtilsController.es.js.map +1 -1
  14. package/lib/src/interactions/Connector.cjs.js +29 -10
  15. package/lib/src/interactions/Connector.cjs.js.map +1 -1
  16. package/lib/src/interactions/Connector.d.ts +2 -2
  17. package/lib/src/interactions/Connector.es.js +29 -10
  18. package/lib/src/interactions/Connector.es.js.map +1 -1
  19. package/lib/src/next/controllers/PageController.cjs.js +1 -0
  20. package/lib/src/next/controllers/PageController.cjs.js.map +1 -1
  21. package/lib/src/next/controllers/PageController.es.js +1 -0
  22. package/lib/src/next/controllers/PageController.es.js.map +1 -1
  23. package/lib/src/sdk/editor-engine.json.cjs.js +1 -1
  24. package/lib/src/sdk/editor-engine.json.es.js +1 -1
  25. package/lib/src/sdk/package.json.cjs.js +1 -1
  26. package/lib/src/sdk/package.json.es.js +1 -1
  27. package/lib/src/sdk.cjs.js +26 -13
  28. package/lib/src/sdk.cjs.js.map +1 -1
  29. package/lib/src/sdk.d.ts +14 -0
  30. package/lib/src/sdk.es.js +26 -13
  31. package/lib/src/sdk.es.js.map +1 -1
  32. package/lib/src/types/BarcodeTypes.cjs.js.map +1 -1
  33. package/lib/src/types/BarcodeTypes.d.ts +3 -1
  34. package/lib/src/types/BarcodeTypes.es.js.map +1 -1
  35. package/lib/src/types/BrandKitTypes.d.ts +4 -2
  36. package/lib/src/types/CharacterStyleTypes.d.ts +6 -2
  37. package/lib/src/types/ColorStyleTypes.cjs.js.map +1 -1
  38. package/lib/src/types/ColorStyleTypes.es.js.map +1 -1
  39. package/lib/src/types/ComponentGridTypes.cjs.js.map +1 -1
  40. package/lib/src/types/ComponentGridTypes.es.js.map +1 -1
  41. package/lib/src/types/ConnectorTypes.cjs.js.map +1 -1
  42. package/lib/src/types/ConnectorTypes.es.js.map +1 -1
  43. package/lib/src/types/FrameTypes.cjs.js.map +1 -1
  44. package/lib/src/types/FrameTypes.d.ts +5 -0
  45. package/lib/src/types/FrameTypes.es.js.map +1 -1
  46. package/lib/src/types/ParagraphStyleTypes.cjs.js.map +1 -1
  47. package/lib/src/types/ParagraphStyleTypes.d.ts +6 -2
  48. package/lib/src/types/ParagraphStyleTypes.es.js.map +1 -1
  49. package/lib/src/types/RichTextRuleTypes.cjs.js.map +1 -1
  50. package/lib/src/types/RichTextRuleTypes.es.js.map +1 -1
  51. package/lib/src/types/ShapeTypes.cjs.js.map +1 -1
  52. package/lib/src/types/ShapeTypes.d.ts +2 -0
  53. package/lib/src/types/ShapeTypes.es.js.map +1 -1
  54. package/lib/src/types/TextStyleTypes.cjs.js.map +1 -1
  55. package/lib/src/types/TextStyleTypes.d.ts +2 -1
  56. package/lib/src/types/TextStyleTypes.es.js.map +1 -1
  57. package/lib/src/types/VariableTypes.cjs.js.map +1 -1
  58. package/lib/src/types/VariableTypes.es.js.map +1 -1
  59. package/lib/src/utils/EngineCallbackHandler.cjs.js.map +1 -1
  60. package/lib/src/utils/EngineCallbackHandler.es.js.map +1 -1
  61. package/lib/src/utils/EngineEvent.cjs.js.map +1 -1
  62. package/lib/src/utils/EngineEvent.es.js.map +1 -1
  63. package/package.json +17 -20
package/_bundles/main.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(c,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(c=typeof globalThis<"u"?globalThis:c||self,D(c.StudioSDK=c.StudioSDK||{}))})(this,(function(c){"use strict";var hr=c=>{throw TypeError(c)};var cr=(c,D,k)=>D.has(c)||hr("Cannot "+k);var a=(c,D,k)=>(cr(c,D,"read from private field"),k?k.call(c):D.get(c)),g=(c,D,k)=>D.has(c)?hr("Cannot add the same private member more than once"):D instanceof WeakSet?D.add(c):D.set(c,k),y=(c,D,k,me)=>(cr(c,D,"write to private field"),me?me.call(c,k):D.set(c,k),k);var V,T,K,P,ot,_,ht,qt,H,J,Mt,ft,$n,St,bt,et,Rt,ct,Yt,dt,It,x,lt,Vt,E,Tt,l,N,f,Zt,st,Qt,R,Xt,jn,$,vt,kt,X,q,te,ut,ee,Bt,se,ne,j,Jt,w,Ut,Gt,zn,gt,nt,re,At,_t,pe,yt,Ht,z,Pt,ae,pt,tt;const k={current:"2.29.latest"},De={version:"1.46.1"};var Y;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})(Y||(Y={}));var mt;(function(s){s.Fulfilled="fulfilled",s.Rejected="rejected"})(mt||(mt={}));var jt;(function(s){s.ConnectionDestroyed="ConnectionDestroyed",s.ConnectionTimeout="ConnectionTimeout",s.NoIframeSrc="NoIframeSrc"})(jt||(jt={}));var we;(function(s){s.DataCloneError="DataCloneError"})(we||(we={}));var at;(function(s){s.Message="message"})(at||(at={}));const dr=(s,o)=>{const e=[];let t=!1;return{destroy(n){t||(t=!0,o(`${s}: Destroying connection`),e.forEach(r=>{r(n)}))},onDestroy(n){t?n():e.push(n)}}},lr=s=>(...o)=>{s&&console.log("[Penpal]",...o)},ur={"http:":"80","https:":"443"},gr=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,yr=["file:","data:"],pr=s=>{if(s&&yr.find(d=>s.startsWith(d)))return"null";const o=document.location,e=gr.exec(s);let t,n,r;e?(t=e[1]?e[1]:o.protocol,n=e[2],r=e[4]):(t=o.protocol,n=o.hostname,r=o.port);const h=r&&r!==ur[t]?`:${r}`:"";return`${t}//${n}${h}`},Le=({name:s,message:o,stack:e})=>({name:s,message:o,stack:e}),mr=s=>{const o=new Error;return Object.keys(s).forEach(e=>o[e]=s[e]),o},wr=(s,o,e)=>{const{localName:t,local:n,remote:r,originForSending:h,originForReceiving:d}=s;let u=!1;const m=p=>{if(p.source!==r||p.data.penpal!==Y.Call)return;if(p.origin!==d){e(`${t} received message from origin ${p.origin} which did not match expected origin ${d}`);return}const S=p.data,{methodName:b,args:v,id:O}=S;e(`${t}: Received ${b}() call`);const A=L=>F=>{if(e(`${t}: Sending ${b}() reply`),u){e(`${t}: Unable to send ${b}() reply due to destroyed connection`);return}const M={penpal:Y.Reply,id:O,resolution:L,returnValue:F};L===mt.Rejected&&F instanceof Error&&(M.returnValue=Le(F),M.returnValueIsError=!0);try{r.postMessage(M,h)}catch(I){if(I.name===we.DataCloneError){const U={penpal:Y.Reply,id:O,resolution:mt.Rejected,returnValue:Le(I),returnValueIsError:!0};r.postMessage(U,h)}throw I}};new Promise(L=>L(o[b].apply(o,v))).then(A(mt.Fulfilled),A(mt.Rejected))};return n.addEventListener(at.Message,m),()=>{u=!0,n.removeEventListener(at.Message,m)}};let Cr=0;const fr=()=>++Cr,Ne=".",Me=s=>s?s.split(Ne):[],Sr=s=>s.join(Ne),br=(s,o)=>{const e=Me(o||"");return e.push(s),Sr(e)},Ir=(s,o,e)=>{const t=Me(o);return t.reduce((n,r,h)=>(typeof n[r]>"u"&&(n[r]={}),h===t.length-1&&(n[r]=e),n[r]),s),s},Re=(s,o)=>{const e={};return Object.keys(s).forEach(t=>{const n=s[t],r=br(t,o);typeof n=="object"&&Object.assign(e,Re(n,r)),typeof n=="function"&&(e[r]=n)}),e},vr=s=>{const o={};for(const e in s)Ir(o,e,s[e]);return o},Ar=(s,o,e,t,n)=>{const{localName:r,local:h,remote:d,originForSending:u,originForReceiving:m}=o;let p=!1;n(`${r}: Connecting call sender`);const S=v=>(...O)=>{n(`${r}: Sending ${v}() call`);let A;try{d.closed&&(A=!0)}catch{A=!0}if(A&&t(),p){const L=new Error(`Unable to send ${v}() call due to destroyed connection`);throw L.code=jt.ConnectionDestroyed,L}return new Promise((L,F)=>{const M=fr(),I=rt=>{if(rt.source!==d||rt.data.penpal!==Y.Reply||rt.data.id!==M)return;if(rt.origin!==m){n(`${r} received message from origin ${rt.origin} which did not match expected origin ${m}`);return}const xt=rt.data;n(`${r}: Received ${v}() reply`),h.removeEventListener(at.Message,I);let $t=xt.returnValue;xt.returnValueIsError&&($t=mr($t)),(xt.resolution===mt.Fulfilled?L:F)($t)};h.addEventListener(at.Message,I);const U={penpal:Y.Call,id:M,methodName:v,args:O};d.postMessage(U,u)})},b=e.reduce((v,O)=>(v[O]=S(O),v),{});return Object.assign(s,vr(b)),()=>{p=!0}},Pr=(s,o,e,t,n)=>{const{destroy:r,onDestroy:h}=t;let d,u;const m={};return p=>{if(p.origin!==o){n(`Parent: Handshake - Received ACK message from origin ${p.origin} which did not match expected origin ${o}`);return}n("Parent: Handshake - Received ACK");const S={localName:"Parent",local:window,remote:p.source,originForSending:e,originForReceiving:o};d&&d(),d=wr(S,s,n),h(d),u&&u.forEach(v=>{delete m[v]}),u=p.data.methodNames;const b=Ar(m,S,u,r,n);return h(b),m}},Er=(s,o,e,t)=>n=>{if(n.origin!==e){s(`Parent: Handshake - Received SYN message from origin ${n.origin} which did not match expected origin ${e}`);return}s("Parent: Handshake - Received SYN, responding with SYN-ACK");const r={penpal:Y.SynAck,methodNames:Object.keys(o)};n.source.postMessage(r,t)},Or=6e4,Fr=(s,o)=>{const{destroy:e,onDestroy:t}=o,n=setInterval(()=>{s.isConnected||(clearInterval(n),e())},Or);t(()=>{clearInterval(n)})},Dr=(s,o)=>{let e;return s!==void 0&&(e=window.setTimeout(()=>{const t=new Error(`Connection timed out after ${s}ms`);t.code=jt.ConnectionTimeout,o(t)},s)),()=>{clearTimeout(e)}},Lr=s=>{if(!s.src&&!s.srcdoc){const o=new Error("Iframe must have src or srcdoc property defined.");throw o.code=jt.NoIframeSrc,o}},Nr=s=>{let{iframe:o,methods:e={},childOrigin:t,timeout:n,debug:r=!1}=s;const h=lr(r),d=dr("Parent",h),{onDestroy:u,destroy:m}=d;t||(Lr(o),t=pr(o.src));const p=t==="null"?"*":t,S=Re(e),b=Er(h,S,t,p),v=Pr(S,t,p,d,h);return{promise:new Promise((A,L)=>{const F=Dr(n,m),M=I=>{if(!(I.source!==o.contentWindow||!I.data)){if(I.data.penpal===Y.Syn){b(I);return}if(I.data.penpal===Y.Ack){const U=v(I);U&&(F(),A(U));return}}};window.addEventListener(at.Message,M),h("Parent: Awaiting handshake"),Fr(o,d),u(I=>{window.removeEventListener(at.Message,M),I&&L(I)})}),destroy(){m()}}},Mr=s=>{const o=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w]+\/$/);let e="";return o.test(s)?e=s:s.indexOf("/index.html")>-1?e=s.replace("/index.html","/"):s.charAt(-1)!=="/"&&(e=`${s}/`),e},Rr=(s,o,e)=>{const t=Mr(o),r=`<html>
1
+ (function(h,L){typeof exports=="object"&&typeof module<"u"?L(exports):typeof define=="function"&&define.amd?define(["exports"],L):(h=typeof globalThis<"u"?globalThis:h||self,L(h.StudioSDK=h.StudioSDK||{}))})(this,(function(h){"use strict";var ir=h=>{throw TypeError(h)};var or=(h,L,T)=>L.has(h)||ir("Cannot "+T);var a=(h,L,T)=>(or(h,L,"read from private field"),T?T.call(h):L.get(h)),g=(h,L,T)=>L.has(h)?ir("Cannot add the same private member more than once"):L instanceof WeakSet?L.add(h):L.set(h,T),y=(h,L,T,ye)=>(or(h,L,"write to private field"),ye?ye.call(h,T):L.set(h,T),T);var V,k,K,O,it,_,ot,Kt,H,J,Nt,Ct,Hn,ft,St,et,Mt,ct,qt,ht,bt,x,dt,Rt,D,Vt,u,N,S,Yt,st,Zt,R,Qt,xn,$,It,kt,X,q,Xt,lt,Tt,te,ee,se,j,Bt,w,Jt,Ut,$n,ut,nt,ne,vt,Gt,ge,gt,_t,z,At,re,yt,tt;const T={current:"2.30.latest"},Oe={version:"1.47.0"};var Y;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})(Y||(Y={}));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 pe;(function(s){s.DataCloneError="DataCloneError"})(pe||(pe={}));var at;(function(s){s.Message="message"})(at||(at={}));const cr=(s,o)=>{const e=[];let t=!1;return{destroy(n){t||(t=!0,o(`${s}: Destroying connection`),e.forEach(r=>{r(n)}))},onDestroy(n){t?n():e.push(n)}}},hr=s=>(...o)=>{s&&console.log("[Penpal]",...o)},dr={"http:":"80","https:":"443"},lr=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,ur=["file:","data:"],gr=s=>{if(s&&ur.find(d=>s.startsWith(d)))return"null";const o=document.location,e=lr.exec(s);let t,n,r;e?(t=e[1]?e[1]:o.protocol,n=e[2],r=e[4]):(t=o.protocol,n=o.hostname,r=o.port);const c=r&&r!==dr[t]?`:${r}`:"";return`${t}//${n}${c}`},Fe=({name:s,message:o,stack:e})=>({name:s,message:o,stack:e}),yr=s=>{const o=new Error;return Object.keys(s).forEach(e=>o[e]=s[e]),o},pr=(s,o,e)=>{const{localName:t,local:n,remote:r,originForSending:c,originForReceiving:d}=s;let l=!1;const m=p=>{if(p.source!==r||p.data.penpal!==Y.Call)return;if(p.origin!==d){e(`${t} received message from origin ${p.origin} which did not match expected origin ${d}`);return}const f=p.data,{methodName:b,args:I,id:A}=f;e(`${t}: Received ${b}() call`);const v=E=>F=>{if(e(`${t}: Sending ${b}() reply`),l){e(`${t}: Unable to send ${b}() reply due to destroyed connection`);return}const M={penpal:Y.Reply,id:A,resolution:E,returnValue:F};E===pt.Rejected&&F instanceof Error&&(M.returnValue=Fe(F),M.returnValueIsError=!0);try{r.postMessage(M,c)}catch(P){if(P.name===pe.DataCloneError){const U={penpal:Y.Reply,id:A,resolution:pt.Rejected,returnValue:Fe(P),returnValueIsError:!0};r.postMessage(U,c)}throw P}};new Promise(E=>E(o[b].apply(o,I))).then(v(pt.Fulfilled),v(pt.Rejected))};return n.addEventListener(at.Message,m),()=>{l=!0,n.removeEventListener(at.Message,m)}};let mr=0;const wr=()=>++mr,De=".",Le=s=>s?s.split(De):[],Cr=s=>s.join(De),fr=(s,o)=>{const e=Le(o||"");return e.push(s),Cr(e)},Sr=(s,o,e)=>{const t=Le(o);return t.reduce((n,r,c)=>(typeof n[r]>"u"&&(n[r]={}),c===t.length-1&&(n[r]=e),n[r]),s),s},Ne=(s,o)=>{const e={};return Object.keys(s).forEach(t=>{const n=s[t],r=fr(t,o);typeof n=="object"&&Object.assign(e,Ne(n,r)),typeof n=="function"&&(e[r]=n)}),e},br=s=>{const o={};for(const e in s)Sr(o,e,s[e]);return o},Ir=(s,o,e,t,n)=>{const{localName:r,local:c,remote:d,originForSending:l,originForReceiving:m}=o;let p=!1;n(`${r}: Connecting call sender`);const f=I=>(...A)=>{n(`${r}: Sending ${I}() call`);let v;try{d.closed&&(v=!0)}catch{v=!0}if(v&&t(),p){const E=new Error(`Unable to send ${I}() call due to destroyed connection`);throw E.code=$t.ConnectionDestroyed,E}return new Promise((E,F)=>{const M=wr(),P=rt=>{if(rt.source!==d||rt.data.penpal!==Y.Reply||rt.data.id!==M)return;if(rt.origin!==m){n(`${r} received message from origin ${rt.origin} which did not match expected origin ${m}`);return}const Ht=rt.data;n(`${r}: Received ${I}() reply`),c.removeEventListener(at.Message,P);let xt=Ht.returnValue;Ht.returnValueIsError&&(xt=yr(xt)),(Ht.resolution===pt.Fulfilled?E:F)(xt)};c.addEventListener(at.Message,P);const U={penpal:Y.Call,id:M,methodName:I,args:A};d.postMessage(U,l)})},b=e.reduce((I,A)=>(I[A]=f(A),I),{});return Object.assign(s,br(b)),()=>{p=!0}},vr=(s,o,e,t,n)=>{const{destroy:r,onDestroy:c}=t;let d,l;const m={};return p=>{if(p.origin!==o){n(`Parent: Handshake - Received ACK message from origin ${p.origin} which did not match expected origin ${o}`);return}n("Parent: Handshake - Received ACK");const f={localName:"Parent",local:window,remote:p.source,originForSending:e,originForReceiving:o};d&&d(),d=pr(f,s,n),c(d),l&&l.forEach(I=>{delete m[I]}),l=p.data.methodNames;const b=Ir(m,f,l,r,n);return c(b),m}},Ar=(s,o,e,t)=>n=>{if(n.origin!==e){s(`Parent: Handshake - Received SYN message from origin ${n.origin} which did not match expected origin ${e}`);return}s("Parent: Handshake - Received SYN, responding with SYN-ACK");const r={penpal:Y.SynAck,methodNames:Object.keys(o)};n.source.postMessage(r,t)},Pr=6e4,Er=(s,o)=>{const{destroy:e,onDestroy:t}=o,n=setInterval(()=>{s.isConnected||(clearInterval(n),e())},Pr);t(()=>{clearInterval(n)})},Or=(s,o)=>{let e;return s!==void 0&&(e=window.setTimeout(()=>{const t=new Error(`Connection timed out after ${s}ms`);t.code=$t.ConnectionTimeout,o(t)},s)),()=>{clearTimeout(e)}},Fr=s=>{if(!s.src&&!s.srcdoc){const o=new Error("Iframe must have src or srcdoc property defined.");throw o.code=$t.NoIframeSrc,o}},Dr=s=>{let{iframe:o,methods:e={},childOrigin:t,timeout:n,debug:r=!1}=s;const c=hr(r),d=cr("Parent",c),{onDestroy:l,destroy:m}=d;t||(Fr(o),t=gr(o.src));const p=t==="null"?"*":t,f=Ne(e),b=Ar(c,f,t,p),I=vr(f,t,p,d,c);return{promise:new Promise((v,E)=>{const F=Or(n,m),M=P=>{if(!(P.source!==o.contentWindow||!P.data)){if(P.data.penpal===Y.Syn){b(P);return}if(P.data.penpal===Y.Ack){const U=I(P);U&&(F(),v(U));return}}};window.addEventListener(at.Message,M),c("Parent: Awaiting handshake"),Er(o,d),l(P=>{window.removeEventListener(at.Message,M),P&&E(P)})}),destroy(){m()}}},Lr=s=>{const o=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w]+\/$/);let e="";return o.test(s)?e=s:s.indexOf("/index.html")>-1?e=s.replace("/index.html","/"):s.charAt(-1)!=="/"&&(e=`${s}/`),e},Nr=(s,o,e)=>{const t=Lr(o),n=JSON.stringify(e||{}),r=`<html>
2
2
  <head>
3
- <base href="/" />
3
+ <base href="${t}" />
4
4
  <meta charset="UTF-8"/>
5
5
  <!-- use this property to pass the StudioStyling to the engine -->
6
- <meta name="studio-styling" content='${JSON.stringify(e||{})}'>
6
+ <meta name="studio-styling" content='${n}'>
7
7
  </head>
8
8
  <body>
9
9
  <script>
@@ -65,5 +65,5 @@
65
65
  }
66
66
  <\/script>
67
67
  </body>
68
- </html>`;s.srcdoc=r};let oe=null;const Vr=(s,o,e,t="chili-editor",n,r)=>{oe&&window.removeEventListener("message",oe);const h=`#${t}`,d=document.createElement("iframe");d.setAttribute("srcdoc"," "),d.setAttribute("title","Chili-Editor"),d.setAttribute("style","width: 100%; height: 100%;"),d.setAttribute("frameBorder","0"),d.setAttribute("referrerpolicy","origin");const u=()=>{const m=document.querySelector(h);if(m){m==null||m.appendChild(d),d.addEventListener("error",()=>{const p=new Error("Failed to setup frame: iframe failed to load");r==null||r(p)},{capture:!0,once:!0});try{Rr(d,s,n)}catch(p){p instanceof Error?r==null||r(p):r==null||r(new Error(`Failed to setup frame: ${p}`))}}};document.readyState==="complete"||document.readyState==="interactive"?u():document.addEventListener("DOMContentLoaded",()=>{u()}),oe=m=>{var p;if(m.source===d.contentWindow&&((p=m.data)==null?void 0:p.type)==="iframe-error"){const S=m.data.error,b=new Error(S.message||"Failed to setup frame: error in iframe");r==null||r(b)}},window.addEventListener("message",oe),e(Nr({iframe:d,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,injectedDataChanged:o.onInjectedDataChanged,documentIssueListChanged:o.onDocumentIssueListChanged,customUndoDataChanged:o.onCustomUndoDataChanged,engineEditingModeChanged:o.onEngineEditModeChanged,brandKitMediaChanged:o.onBrandKitMediaChanged,frameManipulated:o.onCanvasFramesManipulated}}))};var Z=(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))(Z||{}),Ve=(s=>(s.full="full",s.followConstraints="followConstraints",s))(Ve||{});const Tr={shortcutOptions:{debugPanel:{enabled:!1},ellipse:{enabled:!1},hand:{enabled:!1},temporaryHand:{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},componentGrid:{enabled:!1}},frameEditingMode:"full"};var Te=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(Te||{}),Ce=(s=>(s.project="project",s.template="template",s.component="component",s))(Ce||{});class ke{constructor(o,e,t,n){this.type="action",this.message=o,this.id=e,this.event=t,this.eventChain=n}}class Be{constructor(o,e,t){this.type="dataRow",this.count=o,this.message=e,this.exceptions=t}}class Je extends Error{constructor(o,e,t){super(e,t),this.statusCode=o}}class Ue extends Error{constructor(o,e,t){super(e,t),this.context=o}}const kr=404075,Br=403032;function wt(s){const o=s.error??"Yikes, something went wrong",e={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===kr){const n=JSON.parse(s.data).statusCode;throw new Je(n,o,e)}else throw new Error(o,e)}function Jr(s){const o=[/DateVariable '([^']+)' should not be part of excludedDays, ".*" was given/,/DateVariable '([^']+)' expects \$date to be > startDate:.*$/,/DateVariable '([^']+)' expects \$date to be < endDate:.*$/,/NumberVariable '([^']+)' expects \$extractedValue to be >= .+$/,/NumberVariable '([^']+)' expects \$extractedValue to be <= .+$/];for(const e of o)if(s.match(e))return{valid:!0};return{valid:!1}}function Ur(s,o){if(s.status===Br&&s.error){const e=s.error;if(Jr(e).valid)throw new Ue(o,e,{cause:{name:String(s.status),message:e}})}}function Gr(s){wt(s)}function i(s,o){let e=!0,t=!1,n=Gr;typeof o=="function"?(t=!0,n=o):typeof o=="boolean"&&(e=o);try{s.success||(n(s),t&&wt(s));const r=s.data&&e;return{...s,parsedData:r?JSON.parse(s.data):s.data}}catch(r){throw console.error(r),r}}class Ge{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getActions().then(t=>i(t)),this.getById=async e=>(await a(this,V)).getActionById(e).then(n=>i(n)),this.create=async()=>(await a(this,V)).createAction().then(t=>i(t)),this.duplicate=async e=>(await a(this,V)).duplicateAction(e).then(n=>i(n)),this.remove=async e=>(await a(this,V)).removeAction(e).then(n=>i(n)),this.update=async(e,t)=>(await a(this,V)).updateAction(e,JSON.stringify(t)).then(r=>i(r)),this.rename=async(e,t)=>this.update(e,{name:t}),this.updateScript=async(e,t)=>this.update(e,{script:t}),this.updateTriggers=async(e,t)=>this.update(e,{triggers:t}),this.move=async(e,t)=>(await a(this,V)).moveActions(e,t).then(r=>i(r)),this.setTypeError=async(e,t)=>this.update(e,{hasTypeError:t}),this.disable=async()=>(await a(this,V)).disableActions().then(t=>i(t)),this.enable=async()=>(await a(this,V)).enableActions().then(t=>i(t)),this.enableForComponents=async e=>(await a(this,V)).enableComponentActions(e).then(n=>i(n)),y(this,V,o)}}V=new WeakMap;class _e{constructor(o){g(this,T);this.getAllOnSelectedLayout=async()=>(await a(this,T)).getAnimationsOnSelectedLayout().then(t=>i(t)),this.getByFrameId=async(e,t)=>(await a(this,T)).getAnimationByFrameId(e,t).then(r=>i(r)),this.getByLayoutId=async e=>(await a(this,T)).getAnimationsByLayoutId(e).then(n=>i(n)),this.setFrameAnimation=async e=>(await a(this,T)).setFrameAnimation(JSON.stringify(e)).then(n=>i({...n,data:JSON.stringify(e)})),this.play=async()=>(await a(this,T)).playAnimation().then(t=>i(t)),this.pause=async()=>(await a(this,T)).pauseAnimation().then(t=>i(t)),this.setScrubberPosition=async e=>(await a(this,T)).setScrubberPosition(e).then(n=>i(n)),this.setDuration=async e=>(await a(this,T)).setAnimationDuration(e).then(n=>i(n)),this.resetFrameAnimation=async e=>(await a(this,T)).resetFrameAnimation(e).then(n=>i(n)),this.reset=async()=>(await a(this,T)).resetAnimation().then(t=>i(t)),y(this,T,o)}}T=new WeakMap;var W=(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))(W||{}),Et=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(Et||{}),Ct=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(Ct||{}),He=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(He||{}),xe=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(xe||{}),Q=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(Q||{}),$e=(s=>(s.top="top",s.child="child",s))($e||{}),je=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(je||{}),ze=(s=>(s.locked="locked",s.range="range",s.none="none",s))(ze||{});class We{constructor(o){g(this,K);this.setBarcodeProperties=async(e,t)=>(await a(this,K)).setBarcodeProperties(e,JSON.stringify(t)).then(r=>i(r)),this.setEnableBackground=async(e,t)=>{const n={enableBackground:t};return this.setBarcodeProperties(e,n)},this.setBackgroundColor=async(e,t)=>{const n={backgroundColor:t};return this.setBarcodeProperties(e,n)},this.setEnableBars=async(e,t)=>{const n={enableBars:t};return this.setBarcodeProperties(e,n)},this.setBarColor=async(e,t)=>{const n={barColor:t};return this.setBarcodeProperties(e,n)},this.setBarcodeSource=async(e,t)=>(await a(this,K)).setBarcodeSource(e,JSON.stringify(t)).then(r=>i(r)),this.removeBarcodeSource=async e=>(await a(this,K)).setBarcodeSource(e,null).then(n=>i(n)),this.setEnableText=async(e,t)=>{const n={enableText:t};return this.setBarcodeProperties(e,n)},this.setBarHeight=async(e,t)=>{const n={barHeight:t};return this.setBarcodeProperties(e,n)},this.setMagnification=async(e,t)=>{const n={magnification:t};return this.setBarcodeProperties(e,n)},this.setQuietZoneValue=async(e,t,n)=>{const r=n?{left:n===Q.left?t:void 0,top:n===Q.top?t:void 0,right:n===Q.right?t:void 0,bottom:n===Q.bottom?t:void 0}:{left:t,top:t,right:t,bottom:t};return(await a(this,K)).setBarcodeProperties(e,JSON.stringify({quietZone:r})).then(d=>i(d))},this.setAreQuietZoneValuesCombined=async(e,t)=>{const n={areQuietZoneValuesCombined:t};return(await a(this,K)).setBarcodeProperties(e,JSON.stringify({quietZone:n})).then(h=>i(h))},this.setErrorCorrectionLevel=async(e,t)=>(await a(this,K)).setBarcodeProperties(e,JSON.stringify({errorCorrectionLevel:t})).then(r=>i(r)),this.setCharacterSet=async(e,t)=>(await a(this,K)).setBarcodeProperties(e,JSON.stringify({characterSet:t})).then(r=>i(r)),this.setDrawLightMarginIndicator=async(e,t)=>{const n={drawStartStopChars:t};return this.setBarcodeProperties(e,n)},this.setDrawStartStopChars=async(e,t)=>{const n={drawStartStopChars:t};return this.setBarcodeProperties(e,n)},this.getBarcodeConfigationOptions=e=>{let t=!0,n=!0,r=!0,h,d,u=!1,m=!1,p=!1;switch(e){case W.qr:h=[Ct.iso8859_1,Ct.utf8],d=[Et.low,Et.medium,Et.quartile,Et.high];case W.dataMatrix:t=!1,n=!1,r=!1,u=!0;break;case W.ean13:t=!1,m=!0;break;case W.ean8:m=!0;case W.upca:case W.upce:t=!1;break;case W.code128:case W.gs1128:h=[Ct.code128a,Ct.code128b,Ct.code128c];break;case W.code39:p=!0;break}return{allowEnableMagnification:r,allowBarHeight:n,allowQuietZone:!0,allowedCharacterSets:h,allowedErrorCorrectionLevels:d,allowToggleText:t,quietZoneAlwaysCombined:u,allowToggleLightMarginIndicator:m,allowToggleDrawStartAndEndChar:p}},y(this,K,o)}}K=new WeakMap;class Ke{constructor(o,e){g(this,P);this.getId=async()=>(await a(this,P)).getBrandKitId().then(n=>i(n)),this.getVersion=async()=>(await a(this,P)).getBrandKitVersion().then(n=>i(n)),this.getName=async()=>(await a(this,P)).getBrandKitName().then(n=>i(n)),this.rename=async t=>(await a(this,P)).renameBrandKit(t).then(r=>i(r)),this.updateIdAndVersion=async(t,n)=>(await a(this,P)).updateBrandKitIdAndVersion(t,n).then(h=>i(h)),this.get=async()=>(await a(this,P)).getBrandKit().then(n=>i(n)),this.getAllMedia=async()=>(await a(this,P)).getAllBrandKitMedia().then(n=>i(n)),this.addMedia=async(t,n,r)=>(await a(this,P)).addBrandKitMedia(t,n,r).then(d=>i(d)),this.updateMedia=async(t,n,r)=>(await a(this,P)).updateBrandKitMedia(t,n,r).then(d=>i(d)),this.renameMedia=async(t,n)=>(await a(this,P)).renameBrandKitMedia(t,n).then(h=>i(h)),this.removeMedia=async t=>(await a(this,P)).removeBrandKitMedia(t).then(r=>i(r)),this.set=async t=>(await a(this,P)).setBrandKit(JSON.stringify(t)).then(r=>i(r)),this.sync=async t=>(await a(this,P)).syncBrandKit(JSON.stringify(t)).then(r=>i(r)),this.isAutoSync=async()=>(await a(this,P)).isBrandKitAutoSync().then(n=>i(n)),this.enableAutoSync=async t=>(await a(this,P)).enableBrandKitAutoSync(t).then(r=>i(r)),this.switchTheme=async t=>(await a(this,P)).switchBrandKitTheme(t).then(r=>i(r)),y(this,P,o),this.sdk=e}}P=new WeakMap;class fe{constructor(o){g(this,ot);this.zoomToPage=async(e,t,n,r,h)=>(e!==void 0&&console.warn("id has no effect and will be deprecated in the future"),(await a(this,ot)).zoomToPage(t,n,r,h).then(u=>i(u))),this.getZoomPercentage=async()=>(await a(this,ot)).getZoomPercentage().then(t=>i(t)),this.setZoomPercentage=async e=>(await a(this,ot)).setZoomPercentage(e).then(n=>i(n)),this.setViewMode=async e=>(await a(this,ot)).setViewMode(e).then(n=>i(n)),y(this,ot,o)}}ot=new WeakMap;class qe{constructor(o){g(this,_);this.getAll=async()=>(await a(this,_)).getCharacterStyles().then(t=>i(t)),this.getById=async e=>(await a(this,_)).getCharacterStyleById(e).then(n=>i(n)),this.create=async()=>(await a(this,_)).createCharacterStyle().then(t=>i(t)),this.update=async(e,t)=>(await a(this,_)).updateCharacterStyle(e,JSON.stringify(t)).then(r=>i(r)),this.remove=async e=>(await a(this,_)).removeCharacterStyle(e).then(n=>i(n)),this.duplicate=async e=>(await a(this,_)).duplicateCharacterStyle(e).then(n=>i(n)),this.rename=async(e,t)=>(await a(this,_)).renameCharacterStyle(e,t).then(r=>i(r)),this.move=async(e,t)=>(await a(this,_)).moveCharacterStyles(e,t).then(r=>i(r)),y(this,_,o)}}_=new WeakMap;class Ye{constructor(o){g(this,ht);this.copyFrames=async e=>{const n=await(await a(this,ht)).copyFrames(e);return n.data&&await navigator.clipboard.writeText(n.data),i(n)},this.cutFrames=async e=>{const n=await(await a(this,ht)).cutFrames(e);return n.data&&await navigator.clipboard.writeText(n.data),i(n)},this.pasteFrames=async()=>{const e=await a(this,ht),t=await navigator.clipboard.readText(),n=await e.pasteFrames(t);return i(n)},this.getContentType=async()=>{const e=await a(this,ht),t=await navigator.clipboard.readText(),n=await e.getClipboardContentType(t);return i(n)},y(this,ht,o)}}ht=new WeakMap;class Ze{constructor(o){g(this,qt);this.convertToRgb=async e=>(await a(this,qt)).colorToRgb(JSON.stringify(e)).then(n=>i(n)),y(this,qt,o)}}qt=new WeakMap;var Qe=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(Qe||{}),he=(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))(he||{}),Xe=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(Xe||{});class ts{constructor(o){g(this,H);this.getAll=async()=>(await a(this,H)).getColors().then(t=>i(t)),this.getById=async e=>(await a(this,H)).getColorById(e).then(n=>i(n)),this.create=async()=>(await a(this,H)).createColor().then(t=>i(t)),this.duplicate=async e=>(await a(this,H)).duplicateColor(e).then(n=>i(n)),this.move=async(e,t)=>(await a(this,H)).moveColors(e,t).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,H)).renameColor(e,t).then(r=>i(r)),this.update=async(e,t)=>{const n=await a(this,H),r=t;return r.type===he.spot&&(r.type=he.spotCMYK),n.updateColor(e,JSON.stringify(r)).then(h=>i(h))},this.remove=async e=>(await a(this,H)).removeColor(e).then(n=>i(n)),y(this,H,o)}}H=new WeakMap;var Ot=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(Ot||{}),ce=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(ce||{}),Ft=(s=>(s.file="file",s.collection="collection",s))(Ft||{}),es=(s=>(s.media="media",s.fonts="fonts",s.data="data",s.components="components",s))(es||{}),ss=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(ss||{}),ns=(s=>(s.ascending="asc",s.descending="desc",s))(ns||{}),rs=(s=>(s.text="text",s.boolean="boolean",s.number="number",s))(rs||{}),as=(s=>(s.query="query",s.upload="upload",s))(as||{}),Dt=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Dt||{});class _r{constructor(o,e,t,n="engineToConnector",r){this.direction="engineToConnector",this.name=o,this.direction=n,e==="var"?(this.value=`var.${t}`,this.id=t,this.type="var",this.sourceField=r):(this.value=t,this.type="value")}}var is=(s=>(s.variable="var",s.value="value",s))(is||{}),os=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(os||{}),de=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(de||{}),hs=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(hs||{});const Hr={url:"grafx-media.json",source:"local"};class xr{constructor(o,e){this.type="grafxToken",this.token=o,this.headers=e}}class $r{constructor(o){this.type="refreshed",this.headers=o}}var cs=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(cs||{}),ds=(s=>(s.grafxToken="grafxToken",s.any="any",s))(ds||{}),Se=(s=>(s.minDimension="minDimension",s))(Se||{});class ls extends Error{constructor(o,e){super(o),this.type=e}}var us=(s=>(s.StaticKey="staticKey",s.OAuth2ClientCredentials="oAuth2ClientCredentials",s.OAuth2AuthorizationCode="oAuth2AuthorizationCode",s.OAuth2ResourceOwnerPassword="oAuth2ResourceOwnerPassword",s.OAuth2JwtBearer="oAuth2JwtBearer",s.None="none",s))(us||{});class le{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=Dt.grafx||this.isSourceMigrated(o))return o;let e=o.url;for(;e.endsWith("/");)e=e.substring(0,e.length-1);const t=e.split("/");return{id:t[t.length-1],source:Dt.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,e)=>o.map(t=>this.makeSingleConnectorBackwardsCompatible(t,e)),this.makeSingleConnectorBackwardsCompatible=(o,e)=>o.source.source!=Dt.grafx?o:{id:o.id,name:o.name,iconUrl:o.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(o.source,e)},this.makeConnectorSourceBackwardsCompatible=(o,e)=>{let t=e;for(;t!=null&&t.endsWith("/");)t=t.substring(0,t.length-1);return{url:`${t}/connectors/${o.id}`,source:Dt.grafx}},this.isSourceMigrated=o=>"id"in o}}let gs=($n=class{constructor(o,e){g(this,J);g(this,Mt);g(this,ft);this.getById=async t=>(await a(this,J)).getConnectorById(t).then(r=>i(r)).then(r=>{const h={...r,parsedData:null};return r.parsedData&&(h.parsedData=a(this,ft).makeSingleConnectorBackwardsCompatible(r.parsedData,a(this,Mt).get(Z.GraFxStudioEnvironmentApiUrl))),h}),this.getAllByType=async t=>(await a(this,J)).getConnectors(t).then(r=>i(r)).then(r=>{const h={...r,parsedData:null};return r.parsedData&&(h.parsedData=a(this,ft).makeMultipleConnectorsBackwardsCompatible(r.parsedData,a(this,Mt).get(Z.GraFxStudioEnvironmentApiUrl))),h}),this.register=async t=>{const n=await a(this,J),r=a(this,ft).makeConnectorSourceForwardsCompatible(t);return n.registerConnector(JSON.stringify(r)).then(h=>i(h))},this.unregister=async t=>(await a(this,J)).unregisterConnector(t).then(r=>i(r)),this.configure=async(t,n)=>{const r=await a(this,J);return await this.waitToBeReady(t),await n(new jr(t,r)),r.updateConnectorConfiguration(t).then(h=>i(h))},this.getState=async t=>(await a(this,J)).getConnectorState(t).then(r=>i(r)),this.getOptions=async t=>(await a(this,J)).getConnectorOptions(t).then(r=>i(r)),this.waitToBeReady=async(t,n=2e3)=>{let r=Math.max(n,500);r=Math.min(r,5e3);const h=100;let d=0;try{for(;d*h<r;){const u=await this.getState(t);if(u.success&&u.parsedData&&(u.parsedData.type===de.running||u.parsedData.type===de.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(m=>setTimeout(m,h)),d++}}catch(u){return i({data:null,success:!1,error:`Error while getting connector state ${u}`,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(t,n)=>await this.configure(t,async r=>{const{parsedData:h}=await this.getMappings(t),d=(h==null?void 0:h.filter(p=>!n.some(S=>S.name===p.name&&S.direction===p.direction)))??[],u=n.filter(p=>p.name!==""&&p.value!==""),m=[...d,...u];await r.setMappings(m)}),this.applyMappings=async(t,n)=>await this.configure(t,async r=>{const h=n.filter(d=>d.name!==""&&d.value!=="");await r.setMappings(h)}),this.setHttpHeaders=async(t,n)=>(await a(this,J)).remoteConnectorAuthenticationSetHttpHeaders(t,JSON.stringify(n)).then(h=>i(h)),y(this,J,o),y(this,Mt,e),y(this,ft,new le)}async getMappings(o,e){return(await a(this,J)).getConnectorMappings(o).then(n=>i(n)).then(n=>{var r;return e?{...n,parsedData:(r=n.parsedData)==null?void 0:r.filter(h=>h.direction===e)}:n})}},J=new WeakMap,Mt=new WeakMap,ft=new WeakMap,$n);class jr{constructor(o,e){g(this,St);g(this,bt);this.setOptions=async t=>a(this,bt).setConnectorOptions(a(this,St),JSON.stringify(t)).then(n=>i(n)),this.setMappings=async t=>{const n=await a(this,bt).setConnectorMappings(a(this,St),t.map(function(r){return JSON.stringify(r)}));return i(n)},this.setHttpHeader=async(t,n)=>a(this,bt).connectorAuthenticationSetHttpHeader(a(this,St),t,n).then(r=>i(r)),y(this,St,o),y(this,bt,e)}}St=new WeakMap,bt=new WeakMap;class ys{constructor(o,e){g(this,et);g(this,Rt);this.getPageItemById=async(t,n,r,h={})=>{const u=await(await a(this,et)).dataConnectorGetPageItemById(t,n,JSON.stringify(r),JSON.stringify(h)),m=i(u),p={...m,parsedData:null};return m.parsedData&&(p.parsedData={...m.parsedData,data:a(this,Rt).mapEngineToDataItem(m.parsedData.data)}),p},this.getConfigurationOptions=async t=>(await a(this,et)).dataConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,et)).dataConnectorGetCapabilities(t).then(r=>i(r)),y(this,et,o),y(this,Rt,e)}async getPage(o,e,t={}){const{previousPageToken:n,continuationToken:r}=e;if(n!=null&&r!=null)throw new Error('Invalid page config: "previousPageToken" and "continuationToken" are mutually exclusive. Provide only one to indicate navigation direction.');const d=await(await a(this,et)).dataConnectorGetPage(o,JSON.stringify(e),JSON.stringify(t)),u=i(d),m={...u,parsedData:null};return u.parsedData&&(m.parsedData={...u.parsedData,data:u.parsedData.data.map(p=>a(this,Rt).mapEngineToDataItem(p))}),m}async getModel(o,e={}){return(await a(this,et)).dataConnectorGetModel(o,JSON.stringify(e)).then(n=>i(n))}}et=new WeakMap,Rt=new WeakMap;class ps{constructor(o,e){g(this,ct);g(this,Yt);this.setDataSource=async t=>(await a(this,ct)).setDataSource(t).then(r=>i(r)),this.getDataSource=async()=>(await a(this,ct)).getDataSource().then(n=>i(n)),this.removeDataSource=async()=>(await a(this,ct)).removeDataSource().then(n=>i(n)),this.setDataRow=async t=>{const n=await a(this,ct),r=a(this,Yt).mapDataItemToEngine(t);return n.setDataRow(JSON.stringify(r)).then(h=>i(h))},y(this,ct,o),y(this,Yt,e)}}ct=new WeakMap,Yt=new WeakMap;class ms{constructor(o){g(this,dt);this.getAllLogs=async()=>(await a(this,dt)).getLogs().then(t=>i(t)),this.toggleDebugPanel=async()=>(await a(this,dt)).toggleDebugPanel().then(t=>i(t)),this.enableDebug=async()=>(await a(this,dt)).enableDebug().then(t=>i(t)),this.disableDebug=async()=>(await a(this,dt)).disableDebug().then(t=>i(t)),y(this,dt,o)}}dt=new WeakMap;class ws{constructor(o){g(this,It);this.getCurrentState=async()=>(await a(this,It)).getCurrentDocumentState().then(t=>i(t)),this.load=async(e,t={keepConnectors:!1})=>{const n=await a(this,It),r=typeof e!="string"?JSON.stringify(e):e;return n.loadDocument(r,JSON.stringify(t)).then(h=>i(h))},this.createAndLoad=async e=>{const t=await a(this,It),n=JSON.stringify(e);return t.createAndLoadDocument(n).then(r=>i(r))},y(this,It,o)}}It=new WeakMap;var Cs=(s=>(s.resize="resize",s.scale="scale",s.scaleAndResize="scaleAndResize",s))(Cs||{}),fs=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(fs||{}),zt=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(zt||{}),Ss=(s=>(s.connector="connector",s))(Ss||{}),bs=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s.component="component",s.componentGrid="componentGrid",s))(bs||{}),Is=(s=>(s.variable="variable",s.text="text",s))(Is||{}),vs=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(vs||{}),As=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(As||{}),Ps=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(Ps||{}),Es=(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))(Es||{}),Os=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(Os||{}),Fs=(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))(Fs||{}),Ds=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(Ds||{}),Ls=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(Ls||{}),Ns=(s=>(s.page="page",s.frame="frame",s))(Ns||{}),Ms=(s=>(s.start="start",s.end="end",s.center="center",s))(Ms||{});class zr{constructor(){this.type="page"}}class Wr{constructor(o,e){this.type="frame",this.frameId=o,this.edge=e}}var be=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(be||{}),Rs=(s=>(s.v1="v1",s.v2="v2",s))(Rs||{});const Kr="v2";var Vs=(s=>(s.start="start",s.center="center",s.end="end",s))(Vs||{});class Ts{constructor(o){g(this,x);this.insertImageVariableToFrame=async(e,t)=>{const n=await a(this,x),r={id:t,type:zt.variable};return n.setImageSource(e,JSON.stringify(r)).then(h=>i(h))},this.insertTextVariable=async e=>(await a(this,x)).insertTextVariable(e).then(n=>i(n)),this.enterTextEditMode=async e=>(await a(this,x)).enterTextEditMode(e).then(n=>i(n)),this.exitTextEditMode=async()=>(await a(this,x)).exitTextEditMode().then(t=>i(t)),this.getText=async(e,t)=>(await a(this,x)).getTextByFrameId(e,t).then(r=>i(r)),this.setText=async(e,t)=>(await a(this,x)).setTextByFrameId(e,t).then(r=>i(r)),this.selectText=async(e,t,n)=>(await a(this,x)).selectTextById(e,t,n).then(h=>i(h)),this.addCustomUndoData=async(e,t,n)=>(await a(this,x)).setCustomUndoData(e,t,n??!1).then(h=>i(h)),y(this,x,o)}}x=new WeakMap;class ks{constructor(o){g(this,lt);g(this,Vt);this.query=async(e,t,n={})=>(await a(this,lt)).fontConnectorQuery(e,JSON.stringify(t),JSON.stringify(n)).then(h=>i(h)),this.detail=async(e,t,n={})=>(await a(this,lt)).fontConnectorDetail(e,t,JSON.stringify(n)).then(h=>i(h)),this.download=async(e,t,n={})=>(await a(this,Vt)).fontConnectorDownload(e,t,JSON.stringify(n)).then(h=>h??h),this.preview=async(e,t,n,r={})=>(await a(this,Vt)).fontConnectorPreview(e,t,n,JSON.stringify(r)).then(d=>d??d),this.getConfigurationOptions=async e=>(await a(this,lt)).fontConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,lt)).fontConnectorGetCapabilities(e).then(n=>i(n)),this.parseDeprecatedFontType=e=>{if(e===Ot.file)return Ft.file;if(e===Ot.collection)return Ft.collection},y(this,lt,o),y(this,Vt,o)}}lt=new WeakMap,Vt=new WeakMap;class Bs{constructor(o){g(this,E);this.addFontFamily=async(e,t)=>(await a(this,E)).addFontFamily(e,JSON.stringify(t)).then(r=>i(r)),this.removeFontFamily=async e=>(await a(this,E)).removeFontFamily(e).then(n=>i(n)),this.addFontStyle=async(e,t)=>(await a(this,E)).addFontStyle(e,JSON.stringify(t)).then(r=>i(r)),this.removeFontStyle=async e=>(await a(this,E)).removeFontStyle(e).then(n=>i(n)),this.getFontFamilies=async()=>(await a(this,E)).getFontFamilies().then(t=>i(t)),this.getFontStyles=async e=>(await a(this,E)).getFontStyles(e).then(n=>i(n)),this.getFontFamilyById=async e=>(await a(this,E)).getFontFamilyById(e).then(n=>i(n)),this.getFontStyleById=async e=>(await a(this,E)).getFontStyleById(e).then(n=>i(n)),this.getDefaultFontStyle=async()=>(await a(this,E)).getDefaultFontStyle().then(t=>i(t)),this.getDefaultFontFamily=async()=>(await a(this,E)).getDefaultFontFamily().then(t=>i(t)),this.isFontFamilyUsed=async e=>(await a(this,E)).isFontFamilyUsed(e).then(n=>i(n)),this.isFontStyleUsed=async e=>(await a(this,E)).isFontStyleUsed(e).then(n=>i(n)),this.moveFontFamilies=async(e,t)=>(await a(this,E)).moveFontFamilies(e,t).then(r=>i(r)),this.getPreviewsOfCharacterStrings=async(e,t)=>(await a(this,E)).getPreviewsOfCharacterStrings(e,JSON.stringify(t)).then(r=>i(r)),y(this,E,o)}}E=new WeakMap;class Ie{constructor(o){g(this,Tt);this.setShapeProperties=async(e,t)=>(await a(this,Tt)).setShapeProperties(e,JSON.stringify(t)).then(r=>i(r)),this.setEnableFill=async(e,t)=>{const n={enableFill:t};return this.setShapeProperties(e,n)},this.setFillColor=async(e,t)=>{const n={fillColor:t};return this.setShapeProperties(e,n)},this.setEnableStroke=async(e,t)=>{const n={enableStroke:t};return this.setShapeProperties(e,n)},this.setStrokeColor=async(e,t)=>{const n={strokeColor:t};return this.setShapeProperties(e,n)},this.setStrokeWeight=async(e,t)=>{const n={strokeWeight:t};return this.setShapeProperties(e,n)},this.setFlagAllCornersSame=async(e,t)=>{const n={allCornersSame:t};return this.setShapeProperties(e,n)},this.setShapeCorners=async(e,t)=>(await a(this,Tt)).setShapeCorners(e,JSON.stringify(t)).then(r=>i(r)),this.setRadiusAll=async(e,t)=>{const n={radiusAll:t};return this.setShapeCorners(e,n)},this.setRadiusTopLeft=async(e,t)=>{const n={topLeft:t};return this.setShapeCorners(e,n)},this.setRadiusBottomLeft=async(e,t)=>{const n={bottomLeft:t};return this.setShapeCorners(e,n)},this.setRadiusTopRight=async(e,t)=>{const n={topRight:t};return this.setShapeCorners(e,n)},this.setRadiusBottomRight=async(e,t)=>{const n={bottomRight:t};return this.setShapeCorners(e,n)},y(this,Tt,o)}}Tt=new WeakMap;class Js{constructor(o){g(this,l);this.getAll=async()=>(await a(this,l)).getFrames().then(t=>i(t)),this.getSelected=async()=>(await a(this,l)).getSelectedFrames().then(t=>i(t)),this.getAllByPageId=async e=>(await a(this,l)).getFramesByPageId(e).then(n=>i(n)),this.getByName=async e=>(await a(this,l)).getFrameByName(e).then(n=>i(n)),this.getById=async e=>(await a(this,l)).getFrameById(e).then(n=>i(n)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,l)).getFramePropertiesOnSelectedLayout().then(t=>i(t)),this.getLayoutProperties=async(e,t)=>(await a(this,l)).getFramePropertiesByFrameId(e,t).then(r=>i(r)),this.getAllLayoutProperties=async e=>(await a(this,l)).getFramesProperties(e).then(n=>i(n)),this.resetTransformation=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetSize=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.select=async e=>(await a(this,l)).selectFrames([e]).then(n=>i(n)),this.selectMultiple=async e=>(await a(this,l)).selectFrames(e).then(n=>i(n)),this.deselectAll=async()=>(await a(this,l)).deselectFrames().then(t=>i(t)),this.reorderFrames=async(e,t)=>(await a(this,l)).reorderFrames(e,t).then(r=>i(r)),this.setZIndex=async(e,t)=>(await a(this,l)).setFrameZIndex(e,t).then(r=>i(r)),this.setHeight=async(e,t)=>(await a(this,l)).setFrameHeight(e,t).then(r=>i(r)),this.setRotation=async(e,t)=>(await a(this,l)).setFrameRotation(e,t).then(r=>i(r)),this.setWidth=async(e,t)=>(await a(this,l)).setFrameWidth(e,t).then(r=>i(r)),this.setX=async(e,t)=>(await a(this,l)).setFrameX(e,t).then(r=>i(r)),this.setY=async(e,t)=>(await a(this,l)).setFrameY(e,t).then(r=>i(r)),this.setOpacity=async(e,t)=>(await a(this,l)).setFrameOpacity(e,t).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,l)).renameFrame(e,t).then(r=>i(r)),this.reset=async e=>(await a(this,l)).resetFrame(e).then(n=>i(n)),this.resetX=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetY=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetRotation=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetWidth=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetHeight=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetImageFrameFitMode=async e=>(await a(this,l)).resetImageFrameFitMode(e).then(n=>i(n)),this.setVisibility=async(e,t)=>(await a(this,l)).setFrameIsVisible(e,t).then(r=>i(r)),this.setIsVisible=async(e,t)=>(await a(this,l)).setFrameIsVisible(e,t).then(r=>i(r)),this.remove=async e=>(await a(this,l)).removeFrames([e]).then(n=>i(n)),this.removeFrames=async e=>(await a(this,l)).removeFrames(e).then(n=>i(n)),this.create=async(e,t,n,r,h)=>(await a(this,l)).addFrame(e,t,n,r,h).then(u=>i(u)),this.createShapeFrame=async(e,t,n,r,h)=>(await a(this,l)).addFrame(e,t,n,r,h).then(u=>i(u)),this.createBarcodeFrame=async(e,t)=>(await a(this,l)).addBarcodeFrame(e,t==null?void 0:t.x,t==null?void 0:t.y).then(r=>i(r)),this.createComponentFrame=async(e,t,n,r,h)=>(await a(this,l)).addComponentFrame(t,n,r,h,JSON.stringify(e)).then(u=>i(u)),this.duplicateFrames=async e=>(await a(this,l)).duplicateFrames(e).then(n=>i(n)),this.updateImageSource=async(e,t)=>{const n=await a(this,l),r=t!==null?JSON.stringify(t):null;return n.setImageSource(e,r).then(h=>i(h))},this.removeImageSource=async e=>this.updateImageSource(e,null),this.setImageFromConnector=async(e,t,n)=>{const r={id:t,assetId:n,type:zt.connector};return this.updateImageSource(e,r)},this.setImageFromUrl=async(e,t)=>{const n={url:t,type:zt.url};return this.updateImageSource(e,n)},this.setImageFrameFitMode=async(e,t)=>(await a(this,l)).setImageFrameFitMode(e,t).then(r=>i(r)),this.setImageFrameFitModePosition=async(e,t)=>(await a(this,l)).setImageFrameFitModePosition(e,t).then(r=>i(r)),this.setImageFrameSmartCropSettings=async(e,t)=>(await a(this,l)).setImageFrameSmartCropSettings(e,JSON.stringify(t)).then(r=>i(r)),this.setFrameConstrainProportions=async(e,t)=>(console.error("setFrameConstrainProportions is not supported anymore"),i({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(e,t)=>(await a(this,l)).setVerticalAlignment(e,t).then(r=>i(r)),this.setNumberOfColumns=async(e,t)=>(await a(this,l)).setNumberOfColumns(e,t).then(r=>i(r)),this.setColumnGap=async(e,t)=>(await a(this,l)).setColumnGap(e,t).then(r=>i(r)),this.setMinCopyfitting=async(e,t)=>(await a(this,l)).setMinCopyfitting(e,t).then(r=>i(r)),this.setMaxCopyfitting=async(e,t)=>(await a(this,l)).setMaxCopyfitting(e,t).then(r=>i(r)),this.setEnableCopyfitting=async(e,t)=>(await a(this,l)).setEnableCopyfitting(e,t).then(r=>i(r)),this.resetMinCopyfitting=async e=>(await a(this,l)).resetMinCopyfitting(e).then(n=>i(n)),this.resetMaxCopyfitting=async e=>(await a(this,l)).resetMaxCopyfitting(e).then(n=>i(n)),this.resetEnableCopyfitting=async e=>(await a(this,l)).resetEnableCopyfitting(e).then(n=>i(n)),this.setShapeFrameEnableFill=async(e,t)=>this.shapeController.setEnableFill(e,t),this.setShapeFrameFillColor=async(e,t)=>this.shapeController.setFillColor(e,t),this.setShapeFrameEnableStroke=async(e,t)=>this.shapeController.setEnableStroke(e,t),this.setShapeFrameStrokeColor=async(e,t)=>this.shapeController.setStrokeColor(e,t),this.setShapeFrameStrokeWeight=async(e,t)=>this.shapeController.setStrokeWeight(e,t),this.setBlendMode=async(e,t)=>(await a(this,l)).setFrameBlendMode(e,t).then(r=>i(r)),this.setFrameContainerShape=async(e,t)=>(await a(this,l)).setFrameContainerShape(e,JSON.stringify(t)).then(r=>i(r)),this.enterCropMode=async(e,t=be.frameCrop)=>(await a(this,l)).enterCropMode(e,t).then(r=>i(r)),this.applyCropMode=async()=>(await a(this,l)).applyCropMode().then(t=>i(t)),this.exitCropMode=async()=>(await a(this,l)).cancelCropMode().then(t=>i(t)),this.enterSubjectMode=async e=>(await a(this,l)).enterSubjectMode(e).then(n=>i(n)),this.applySubjectMode=async()=>(await a(this,l)).applySubjectMode().then(t=>i(t)),this.exitSubjectMode=async()=>(await a(this,l)).cancelSubjectMode().then(t=>i(t)),this.enterGradientMode=async e=>(await a(this,l)).enterGradientMode(e).then(n=>i(n)),this.applyGradientMode=async()=>(await a(this,l)).applyGradientMode().then(t=>i(t)),this.cancelGradientMode=async()=>(await a(this,l)).cancelGradientMode().then(t=>i(t)),this.resetCropMode=async e=>(console.error("resetCropMode is not supported anymore"),i({success:!1,status:0,error:"resetCropMode is not supported anymore",parsedData:null})),this.setEnableAutoGrow=async(e,t)=>{const n={enabled:{value:t}};return(await a(this,l)).updateAutoGrowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setAutoGrowMinWidth=async(e,t)=>{const n={minWidth:{value:t}};return(await a(this,l)).updateAutoGrowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setAutoGrowMaxWidth=async(e,t)=>{const n={maxWidth:{value:t}};return(await a(this,l)).updateAutoGrowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setAutoGrowMinHeight=async(e,t)=>{const n={minHeight:{value:t}};return(await a(this,l)).updateAutoGrowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setAutoGrowMaxHeight=async(e,t)=>{const n={maxHeight:{value:t}};return(await a(this,l)).updateAutoGrowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setAutoGrowDirections=async(e,t)=>{const n={directions:{value:t}};return(await a(this,l)).updateAutoGrowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.resetAutoGrowSettingsEnabled=async e=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async e=>(console.error("resetAutoGrowMinWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async e=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async e=>(console.error("resetAutoGrowMinHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async e=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async e=>(console.error("resetAutoGrowDirections is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async e=>(console.error("resetAutoGrow is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setShadowEnabled=async(e,t)=>{const n={enabled:{value:t}};return(await a(this,l)).updateFrameShadowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setShadowDistance=async(e,t)=>{const n={distance:{value:t}};return(await a(this,l)).updateFrameShadowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setShadowAngleDegrees=async(e,t)=>{const n={angleDegrees:{value:t}};return(await a(this,l)).updateFrameShadowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setShadowBlurRadius=async(e,t)=>{const n={blurRadius:{value:t}};return(await a(this,l)).updateFrameShadowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setShadowColor=async(e,t)=>{const n={color:{value:t}};return(await a(this,l)).updateFrameShadowSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setAnchor=async(e,t,n,r,h)=>{const d={horizontal:t,type:n,target:r,endTarget:h};return(await a(this,l)).setAnchorProperties(e,JSON.stringify(d)).then(m=>i(m))},this.setVerticalAnchor=async(e,t,n,r)=>this.setAnchor(e,!1,t,n,r),this.setHorizontalAnchor=async(e,t,n,r)=>this.setAnchor(e,!0,t,n,r),this.resetAnchoring=async e=>(await a(this,l)).resetFrameTransformation(e).then(n=>i(n)),this.resetVisibility=async e=>(await a(this,l)).setFrameIsVisible(e,null).then(n=>i(n)),this.getConfiguration=async e=>(await a(this,l)).getFrameConfiguration(e).then(n=>i(n)),this.resetAssetCropOverride=async e=>(await a(this,l)).resetAssetCropOverride(e).then(n=>i(n)),this.resetAllAssetCropOverrides=async e=>(await a(this,l)).resetAllAssetCropOverrides(e).then(n=>i(n)),this.setGradientApplied=async(e,t)=>{const n={isApplied:t};return(await a(this,l)).updateFrameGradientSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setLocalGradient=async(e,t)=>{const n={gradient:t};return(await a(this,l)).updateFrameGradientSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setBrandKitGradient=async(e,t)=>{const n={id:t};return(await a(this,l)).updateFrameGradientSettings(e,JSON.stringify(n)).then(h=>i(h))},this.setSmartCropSubjectId=async(e,t)=>(await a(this,l)).setSmartCropSubjectId(e,t).then(r=>i(r)),y(this,l,o),this.shapeController=new Ie(a(this,l)),this.constraints=new qr(a(this,l))}}l=new WeakMap;class qr{constructor(o){g(this,N);this.get=async e=>(await a(this,N)).getFrameConstraints(e).then(n=>i(n)),this.setSelectable=async(e,t)=>{const n={selectionAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setHorizontalMovement=async(e,t)=>{const n={horizontalMovementAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setVerticalMovement=async(e,t)=>{const n={verticalMovementAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setRotation=async(e,t)=>{const n={rotationAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setResize=async(e,t,n)=>{const r={resizeAllowed:{value:t},...n!==void 0&&{proportionLocked:{value:n}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(r)).then(d=>i(d))},this.setCrop=async(e,t)=>{const n={image:{cropAllowed:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setTextEditingAllowed=async(e,t)=>{const n={text:{editingAllowed:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setAllowedParagraphStyles=async(e,t)=>{const n={text:{paragraphStyles:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setAllowedCharacterStyles=async(e,t)=>{const n={text:{characterStyles:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setAllowedColors=async(e,t)=>{const n={text:{colors:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},this.setAllowedFontSizes=async(e,t)=>{const n={text:{fontSizes:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(h=>i(h))},y(this,N,o)}}N=new WeakMap;class Us{constructor(){this.currentEngineVersion=k.current,this.currentSDKVersion=De.version}}class Gs{constructor(o){g(this,f);g(this,Zt);this.getAll=async()=>(await a(this,f)).getLayouts().then(t=>i(t)),this.getById=async e=>(await a(this,f)).getLayoutById(e).then(n=>i(n)),this.getByName=async e=>(await a(this,f)).getLayoutByName(e).then(n=>i(n)),this.getSelected=async()=>(await a(this,f)).getSelectedLayout().then(t=>i(t)),this.remove=async e=>(await a(this,f)).removeLayout(e).then(n=>i(n)),this.create=async(e,t)=>{const n=await a(this,f);return t!=null&&t.length?n.addLayouts(e,JSON.stringify(t)).then(r=>i(r)):n.addLayout(e).then(r=>i(r))},this.rename=async(e,t)=>(await a(this,f)).renameLayout(e,t).then(r=>i(r)),this.select=async e=>(await a(this,f)).selectLayoutWithOptions(e,null).then(n=>i(n)),this.selectWithPageSize=async(e,t)=>{const n=await a(this,f),r={pageSize:t};return n.selectLayoutWithOptions(e,JSON.stringify(r)).then(h=>i(h))},this.duplicate=async e=>(await a(this,f)).duplicateLayout(e).then(n=>i(n)),this.reset=async e=>(await a(this,f)).resetLayout(e).then(n=>i(n)),this.setHeight=async(e,t)=>(await a(this,f)).setLayoutHeight(e,t).then(r=>i(r)),this.setWidth=async(e,t)=>(await a(this,f)).setLayoutWidth(e,t).then(r=>i(r)),this.setUnit=async(e,t)=>(await a(this,f)).setLayoutUnit(e,t).then(r=>i(r)),this.resetHeight=async e=>(await a(this,f)).resetLayoutHeight(e).then(n=>i(n)),this.resetWidth=async e=>(await a(this,f)).resetLayoutWidth(e).then(n=>i(n)),this.resetUnit=async e=>(await a(this,f)).resetLayoutUnit(e).then(n=>i(n)),this.getSelectedSnapshot=async()=>(await a(this,Zt)).getPageSnapshot().then(t=>t??t),this.setIntent=async(e,t)=>(await a(this,f)).setLayoutIntent(e,t).then(r=>i(r)),this.resetIntent=async e=>(await a(this,f)).resetLayoutIntent(e).then(n=>i(n)),this.setFillColor=async(e,t)=>(await a(this,f)).setLayoutFillColor(e,JSON.stringify(t)).then(r=>i(r)),this.setFillColorEnabled=async(e,t)=>(await a(this,f)).setLayoutFillColorEnabled(e,t).then(r=>i(r)),this.resetFillColor=async e=>(await a(this,f)).resetLayoutFillColor(e).then(n=>i(n)),this.setBleedValue=async(e,t,n)=>{const r=n?{left:n===Q.left?t:void 0,top:n===Q.top?t:void 0,right:n===Q.right?t:void 0,bottom:n===Q.bottom?t:void 0}:{left:t,top:t,right:t,bottom:t};return(await a(this,f)).updateLayoutBleed(e,JSON.stringify(r)).then(d=>i(d))},this.setAreBleedValuesCombined=async(e,t)=>{const n={areBleedValuesCombined:t};return(await a(this,f)).updateLayoutBleed(e,JSON.stringify(n)).then(h=>i(h))},this.resetBleedValues=async e=>(await a(this,f)).updateLayoutBleed(e,null).then(n=>i(n)),this.setPrivateData=async(e,t)=>(await a(this,f)).setLayoutPrivateData(e,JSON.stringify(t)).then(r=>i(r)),this.getPrivateData=async e=>(await a(this,f)).getLayoutPrivateData(e).then(n=>i(n)),this.setDisplayName=async(e,t)=>(await a(this,f)).setLayoutDisplayName(e,t).then(r=>i(r)),this.getDisplayName=async e=>(await a(this,f)).getLayoutDisplayName(e).then(n=>i(n)),this.resetDisplayName=async e=>(await a(this,f)).setLayoutDisplayName(e,null).then(n=>i(n)),this.setAvailableForUser=async(e,t)=>(await a(this,f)).setLayoutAvailableForUser(e,t).then(r=>i(r)),this.setSelectedByUser=async(e,t)=>(await a(this,f)).setLayoutSelectedByUser(e,t).then(r=>i(r)),this.setResizableByUser=async(e,t)=>(await a(this,f)).setLayoutResizableByUser(e,JSON.stringify(t)).then(r=>i(r)),y(this,f,o),y(this,Zt,o)}}f=new WeakMap,Zt=new WeakMap;var ue=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(ue||{}),ve=(s=>(s.web="web",s.print="print",s.animation="animation",s))(ve||{});class _s{constructor(o){g(this,st);g(this,Qt);this.query=async(e,t,n={})=>(await a(this,st)).mediaConnectorQuery(e,JSON.stringify(t),JSON.stringify(n)).then(h=>i(h)),this.detail=async(e,t,n={})=>(await a(this,st)).mediaConnectorDetail(e,t,JSON.stringify(n)).then(h=>i(h)),this.download=async(e,t,n,r={})=>{const h=this.parseDeprecatedMediaDownloadType(n);return(await a(this,Qt)).mediaConnectorDownload(e,t,h,ve.web,JSON.stringify(r)).then(u=>{if(u instanceof Uint8Array)return u;throw typeof u=="object"&&u!==null&&"success"in u&&!u.success&&wt(u),new Error(`Unexpected response type: ${typeof u}.`)})},this.getConfigurationOptions=async e=>(await a(this,st)).mediaConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,st)).mediaConnectorGetCapabilities(e).then(n=>i(n)),this.parseDeprecatedMediaType=e=>{if(e===Ot.file)return Ft.file;if(e===Ot.collection)return Ft.collection},this.upload=async(e,t,n={})=>(await a(this,st)).mediaConnectorUpload(e,JSON.stringify(t),JSON.stringify(n)).then(h=>i(h)),y(this,st,o),y(this,Qt,o)}parseDeprecatedMediaDownloadType(o){switch(o){case ce.HighResolutionWeb:return ue.highres;case ce.LowResolutionWeb:return ue.thumbnail;default:return o}}}st=new WeakMap,Qt=new WeakMap;let Hs=(jn=class{constructor(o){g(this,R);g(this,Xt);this.add=async()=>(await a(this,R)).addPage().then(t=>i(t)),this.remove=async e=>(await a(this,R)).removePage(e).then(n=>i(n)),this.select=async e=>(await a(this,R)).selectPage(e).then(n=>i(n)),this.setVisibility=async(e,t)=>(await a(this,R)).setPageIsVisible(e,t).then(r=>i(r)),this.duplicate=async e=>(await a(this,R)).duplicatePage(e).then(n=>i(n)),this.getAll=async()=>(await a(this,R)).getPages().then(t=>i(t)),this.getById=async e=>(await a(this,R)).getPageById(e).then(n=>i(n)),this.getSnapshot=async(e,t)=>(await a(this,Xt)).getPageSnapshotWithSettings(e,t==null?null:JSON.stringify(t)).then(r=>{if(r instanceof Uint8Array)return r;throw typeof r=="object"&&r!==null&&"success"in r&&!r.success&&wt(r),new Error(`Unexpected response type: ${typeof r}.`)}),this.setWidth=async(e,t)=>(e!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,R)).setPageWidth(t).then(r=>i(r))),this.setHeight=async(e,t)=>(e!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,R)).setPageHeight(t).then(r=>i(r))),this.setSize=async(e,t)=>(await a(this,R)).setPageSize(e,t).then(r=>i(r)),this.move=async(e,t)=>(await a(this,R)).reorderPages(e,t).then(r=>i(r)),y(this,R,o),y(this,Xt,o)}},R=new WeakMap,Xt=new WeakMap,jn);class xs{constructor(o){g(this,$);this.getAll=async()=>(await a(this,$)).getParagraphStyles().then(t=>i(t)),this.getById=async e=>(await a(this,$)).getParagraphStyleById(e).then(n=>i(n)),this.create=async()=>(await a(this,$)).createParagraphStyle().then(t=>i(t)),this.duplicate=async e=>(await a(this,$)).duplicateParagraphStyle(e).then(n=>i(n)),this.update=async(e,t)=>(await a(this,$)).updateParagraphStyle(e,JSON.stringify(t)).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,$)).renameParagraphStyle(e,t).then(r=>i(r)),this.remove=async e=>(await a(this,$)).removeParagraphStyle(e).then(n=>i(n)),this.move=async(e,t)=>(await a(this,$)).moveParagraphStyles(e,t).then(r=>i(r)),y(this,$,o)}}$=new WeakMap;var Wt=(s=>(s.shortText="shortText",s.longText="longText",s.richText="richText",s.image="image",s.list="list",s.boolean="boolean",s.group="group",s.number="number",s.date="date",s.dataSource="dataSource",s))(Wt||{}),$s=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))($s||{}),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||{}),Lt=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Lt||{}),zs=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(zs||{}),Ws=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(Ws||{}),Ae=(s=>(s.injected="injected",s.connector="connector",s))(Ae||{}),Ks=(s=>(s.table="table",s.list="list",s))(Ks||{});let Yr=class{constructor(o,e){this.onActionsChanged=t=>{this.config.events.onActionsChanged.trigger(JSON.parse(t))},this.onAnimationChanged=t=>{this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(t))},this.onAnimationPlaybackChanged=t=>{this.config.events.onScrubberPositionChanged.trigger(JSON.parse(t))},this.onSelectedLayoutPropertiesChanged=t=>{this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(t))},this.onSelectedLayoutUnitChanged=t=>{this.config.events.onSelectedLayoutUnitChanged.trigger(t)},this.onFramesLayoutChanged=t=>{const n=JSON.parse(t);this.config.events.onFramesLayoutChanged.trigger(n)},this.onSelectedFramesLayoutChanged=t=>{const n=JSON.parse(t);this.config.events.onSelectedFramesLayoutChanged.trigger(n);const r=this.config.onSelectedFrameLayoutChanged;r&&r(n.length>1?void 0:n[0])},this.onSelectedFramesContentChanged=t=>{const n=JSON.parse(t);this.config.events.onSelectedFramesContentChanged.trigger(n);const r=this.config.onSelectedFrameContentChanged;r&&r(n.length>1?null:n[0])},this.onStateChanged=()=>{this.config.events.onStateChanged.trigger()},this.onAuthExpired=async t=>{const n=await this.config.handlers.onAuthExpired.trigger(JSON.parse(t));return n!=null?JSON.stringify(n):null},this.onViewportRequested=()=>{const t=this.config.handlers.onViewportRequested.trigger();return t!=null?JSON.stringify(t):null},this.onDocumentLoaded=()=>{this.config.events.onDocumentLoaded.trigger()},this.onPageSelectionChanged=t=>{this.config.events.onPageSelectionChanged.trigger(t)},this.onVariableListChanged=t=>{const r=JSON.parse(t).map(h=>{var d;return h.type===Wt.list?{...h,items:h.items.map(u=>u.value),selected:(d=h.selected)==null?void 0:d.value}:h});this.config.events.onVariableListChanged.trigger(r)},this.onSelectedToolChanged=t=>{this.config.events.onSelectedToolChanged.trigger(t)},this.onUndoStateChanged=t=>{this.config.events.onUndoStackStateChanged.trigger(JSON.parse(t))},this.onCustomUndoDataChanged=t=>{this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(t))},this.onSelectedLayoutFramesChanged=t=>{this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(t))},this.onSelectedTextStyleChanged=t=>{this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(t))},this.onColorsChanged=t=>{this.config.events.onColorsChanged.trigger(JSON.parse(t))},this.onParagraphStylesChanged=t=>{this.config.events.onParagraphStylesChanged.trigger(JSON.parse(t))},this.onCharacterStylesChanged=t=>{this.config.events.onCharacterStylesChanged.trigger(JSON.parse(t))},this.onFontFamiliesChanged=t=>{this.config.events.onFontFamiliesChanged.trigger(JSON.parse(t))},this.onSelectedLayoutIdChanged=t=>{this.config.events.onSelectedLayoutIdChanged.trigger(t)},this.onLayoutsChanged=t=>{this.config.events.onLayoutsChanged.trigger(JSON.parse(t))},this.onZoomChanged=t=>{this.config.events.onZoomChanged.trigger(JSON.parse(t))},this.onConnectorEvent=t=>{this.config.events.onConnectorEvent.trigger(JSON.parse(t))},this.onConnectorsChanged=t=>{const r=new le().makeMultipleConnectorsBackwardsCompatible(JSON.parse(t),this.localConfig.get(Z.GraFxStudioEnvironmentApiUrl));this.config.events.onConnectorsChanged.trigger(r)},this.onSelectedPageIdChanged=t=>{this.config.events.onSelectedPageIdChanged.trigger(t)},this.onPagesChanged=t=>{this.config.events.onPagesChanged.trigger(JSON.parse(t))},this.onPageSnapshotInvalidated=t=>{this.config.events.onPageSnapshotInvalidated.trigger(t)},this.onPageSizeChanged=t=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(t))},this.onShapeCornerRadiusChanged=t=>{this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(t))},this.onCropActiveFrameIdChanged=t=>{this.config.events.onCropActiveFrameIdChanged.trigger(t)},this.onAsyncError=t=>{const n=JSON.parse(t);if((n==null?void 0:n.type)==="dataRow"){const r=new Be(n.count,n.message,n.exceptions);this.config.events.onAsyncError.trigger(r)}else if((n==null?void 0:n.type)==="action"){const r=new ke(n.message,n.id,n.event,n.eventChain);this.config.events.onAsyncError.trigger(r)}else this.config.events.onAsyncError.trigger(n)},this.onViewModeChanged=t=>{this.config.events.onViewModeChanged.trigger(t)},this.onBarcodeValidationChanged=t=>{this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(t))},this.onDataSourceIdChanged=t=>{this.config.events.onDataSourceIdChanged.trigger(t)},this.onInjectedDataChanged=t=>{this.config.events.onInjectedDataChanged.trigger(t)},this.onDocumentIssueListChanged=t=>{this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(t))},this.onEngineEditModeChanged=t=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(t))},this.onBrandKitMediaChanged=t=>{this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(t))},this.onCanvasFramesManipulated=t=>{this.config.events.onCanvasFramesManipulated.trigger(JSON.parse(t))},this.config=o,this.localConfig=e}};class qs{constructor(o){g(this,vt);this.set=async e=>(await a(this,vt)).selectedTextStyleDeltaUpdate(JSON.stringify(e)).then(n=>i(n)),this.removeSelected=async()=>(await a(this,vt)).selectedTextStyleClean().then(t=>i(t)),this.getSelected=async()=>(await a(this,vt)).getSelectedTextStyle().then(t=>i(t)),y(this,vt,o)}}vt=new WeakMap;var Ys=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Ys||{}),Zs=(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))(Zs||{}),G=(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.COMPONENT_GRID_FRAME="componentGridFrame",s))(G||{}),Qs=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s.HTML="html",s))(Qs||{}),ge=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(ge||{});class Xs{constructor(o){g(this,kt);this.setTool=async e=>(await a(this,kt)).setTool(e).then(n=>i(n)),this.getSelected=async()=>(await a(this,kt)).getSelectedTool().then(t=>i(t)),this.setPointer=async()=>this.setTool(G.SELECT),this.setSelect=async()=>this.setTool(G.SELECT),this.setHand=async()=>this.setTool(G.HAND),this.setZoom=async()=>this.setTool(G.ZOOM),this.setTextFrame=async()=>this.setTool(G.TEXT_FRAME),this.setImageFrame=async()=>this.setTool(G.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool(G.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool(G.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool(G.SHAPE_POLYGON),this.setComponentGrid=async()=>this.setTool(G.COMPONENT_GRID_FRAME),y(this,kt,o)}}kt=new WeakMap;class tn{constructor(o,e){g(this,X);g(this,q);g(this,te);this.undo=async()=>(await a(this,X)).undo().then(n=>i(n)),this.redo=async()=>(await a(this,X)).redo().then(n=>i(n)),this.addCustomData=async(t,n)=>(await a(this,X)).setCustomUndoData(t,n,!1).then(h=>i(h)),this.record=async(t,n)=>{try{await a(this,q).beginIfNoneActive(t),await n(a(this,te)),await a(this,q).end()}catch(r){throw await a(this,q).abort(),r}},this.pause=async()=>(await a(this,X)).pause().then(n=>i(n)),this.resume=async()=>(await a(this,X)).resume().then(n=>i(n)),this.clear=async()=>(await a(this,X)).clear().then(n=>i(n)),this.advanced={begin:async t=>a(this,q).begin(t),beginIfNoneActive:async t=>a(this,q).beginIfNoneActive(t),end:async()=>a(this,q).end(),abort:async()=>a(this,q).abort()},y(this,X,o),y(this,te,e),y(this,q,new Zr(o))}}X=new WeakMap,q=new WeakMap,te=new WeakMap;class Zr{constructor(o){g(this,ut);this.begin=async e=>(await a(this,ut)).begin(e).then(n=>i(n)),this.beginIfNoneActive=async e=>(await a(this,ut)).beginIfNoneActive(e).then(n=>i(n)),this.end=async()=>(await a(this,ut)).end().then(t=>i(t)),this.abort=async()=>(await a(this,ut)).abort().then(t=>i(t)),y(this,ut,o)}}ut=new WeakMap;var B=(s=>(s.info="info",s.warn="warn",s.error="error",s))(B||{}),ye=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s.sdk="sdk",s))(ye||{}),Nt=(s=>(s.throw="throw",s.log="log",s))(Nt||{});class en extends Error{constructor(o){super(o)}}const Qr=(s,o=2)=>{const e=Math.pow(10,o);return Math.round(s*e)/e};class sn{constructor(o,e){g(this,ee);g(this,Bt);this.round=(t,n)=>i({data:String(Qr(t,n)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=t=>{const{type:n=ge.SANDBOX,environment:r="ft-nostress",version:h="1"}=t,d=n==ge.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${r}.${d}.online/grafx/api/v${h}/environment/${r}`},this.stageFiles=async(t,n,r)=>{const h=a(this,Bt).get(Z.GraFxStudioEnvironmentApiUrl);if(!h)throw new Error("GraFx Studio Environment API URL is not set");const d=`${h}connectors/${n}/stage`,u=a(this,Bt).get(Z.GraFxStudioAuthToken);if(!u)throw new Error("GraFx Studio Auth Token is not set");const m=new FormData;t.forEach((b,v)=>{const O=b instanceof File?b.name:`blob-${v}`;m.append("files",b,O)}),r&&m.append("validationJson",JSON.stringify({allowedMimeTypes:r.mimeTypes,minDimensions:{width:r.minWidthPixels,height:r.minHeightPixels}}));const p=await fetch(d,{method:"POST",body:m,headers:{Authorization:`Bearer ${u}`}});if(p.status===422){const b=await p.json();throw new ls(b.message,Se.minDimension)}if(p.status===401){const b=await p.json();throw new en(b.message)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},this.unitEvaluate=async(t,n)=>(await a(this,ee)).unitEvaluate(t,n).then(h=>i(h)),y(this,ee,o),y(this,Bt,e)}}ee=new WeakMap,Bt=new WeakMap;const Xr=s=>s.type===Wt.dataSource,ta=s=>{var o;return s?Xr(s)&&((o=s==null?void 0:s.value)==null?void 0:o.type)===Ae.injected:!1};class ea{constructor(o){g(this,se);this.setMinimum=async(e,t)=>{const n={minValue:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setMaximum=async(e,t)=>{const n={maxValue:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setShowStepper=async(e,t)=>{const n={showStepper:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setStepSize=async(e,t)=>{const n={stepSize:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setThousandsSeparator=async(e,t)=>{const n={thousandsSeparator:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setDecimalSeparator=async(e,t)=>{const n={decimalSeparator:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setDecimalCharacterStyle=async(e,t)=>{const n={decimalCharacterStyleId:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setNumberOfDecimals=async(e,t)=>{const n={numberOfDecimals:{value:t}};return this.applyPropertiesUpdate(e,n)},y(this,se,o)}async applyPropertiesUpdate(o,e){const n=await(await a(this,se)).updateNumberVariableProperties(o,JSON.stringify(e));return i(n)}}se=new WeakMap;class sa{constructor(o){g(this,ne);this.setDisplayFormat=async(e,t)=>{const n={displayFormat:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setLocale=async(e,t)=>{const n={locale:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setStartDate=async(e,t)=>{const n={startDate:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setEndDate=async(e,t)=>{const n={endDate:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setExcludedDays=async(e,t)=>{const n={excludedDays:{value:t}};return this.applyPropertiesUpdate(e,n)},y(this,ne,o)}async applyPropertiesUpdate(o,e){const n=await(await a(this,ne)).updateDateVariableProperties(o,JSON.stringify(e));return i(n)}}ne=new WeakMap;class na{constructor(o,e){g(this,j);g(this,Jt);this.setValue=async(t,n)=>{const r=await a(this,j);let h;return Array.isArray(n)?h=n.map(d=>a(this,Jt).mapDataItemToEngine(d)):h=n,r.setVariableValue(t,h).then(d=>i(d))},this.getInjectedData=async t=>(await a(this,j)).getInjectedDataSourceVariableData(t).then(r=>i(r)).then(r=>{const h={...r,parsedData:null};return r.parsedData&&(h.parsedData={...r.parsedData,data:r.parsedData.data.map(d=>a(this,Jt).mapEngineToDataItem(d))}),h}),this.getInjectedItemById=async(t,n)=>{var p;const h=await(await a(this,j)).getVariableById(t).then(S=>i(S));ta(h.parsedData)||wt({status:400,error:"Variable is not an injected data source variable"});const d=h.parsedData.value.itemIdPropertyName,m=(p=(await this.getInjectedData(t)).parsedData)==null?void 0:p.data.find(S=>{var b;return((b=S[d])==null?void 0:b.toString())===n.toString()});return m||wt({status:404,error:`Item not found in injected data for variable ${t}`}),{success:!0,status:200,parsedData:{data:m,continuationToken:null,previousPageToken:null}}},this.setInjectedModel=async(t,n)=>{const r=n.properties,h=n.itemIdPropertyName;return(await a(this,j)).setInjectedDataSourceVariableModel(t,JSON.stringify(r),h).then(u=>i(u))},this.setSourceType=async(t,n)=>(await a(this,j)).setDataSourceVariableSourceType(t,n).then(h=>i(h)),this.setConnector=async(t,n)=>{const r=await a(this,j),d=new le().makeConnectorSourceForwardsCompatible(n);return r.setDataSourceVariableConnector(t,JSON.stringify(d)).then(u=>i(u))},this.removeConnector=async t=>(await a(this,j)).setDataSourceVariableConnector(t,null).then(r=>i(r)),y(this,j,o),y(this,Jt,e)}async setDisplayOptions(o,e,t){return(await a(this,j)).setDataSourceVariableDisplayOptions(o,e,t??void 0).then(r=>i(r))}}j=new WeakMap,Jt=new WeakMap;let nn=(zn=class{constructor(o,e){g(this,w);g(this,Ut);g(this,Gt);this.getAll=async()=>(await a(this,w)).getVariables().then(n=>i(n)).then(n=>{const r=n;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 h=r;return h.parsedData&&(h.parsedData=this.makeVariableBackwardsCompatible(h.parsedData)),h}),this.getByName=async t=>(await a(this,w)).getVariableByName(t).then(r=>i(r)).then(r=>{const h=r;return h.parsedData&&(h.parsedData=this.makeVariableBackwardsCompatible(h.parsedData)),h}),this.create=async(t,n)=>(await a(this,w)).addVariable(t,n).then(h=>i(h)),this.remove=async t=>(await a(this,w)).removeVariables(t).then(r=>i(r)),this.rename=async(t,n)=>(await a(this,w)).setVariableName(t,n).then(h=>i(h)),this.setLabel=async(t,n)=>(await a(this,w)).setVariableLabel(t,n).then(h=>i(h)),y(this,Ut,async(t,n)=>(await a(this,w)).setVariablePlaceholder(t,n).then(h=>i(h))),this.setPlaceholder=async(t,n)=>a(this,Ut).call(this,t,n),this.resetPlaceholder=async t=>a(this,Ut).call(this,t,null),y(this,Gt,async(t,n)=>(await a(this,w)).setVariableHelpText(t,n).then(h=>i(h))),this.setHelpText=async(t,n)=>a(this,Gt).call(this,t,n),this.resetHelpText=async t=>a(this,Gt).call(this,t,null),this.setType=async(t,n)=>(await a(this,w)).setVariableType(t,n).then(h=>i(h)),this.setRuleSetId=async(t,n)=>(await a(this,w)).setVariableRuleSetId(t,n).then(h=>i(h)),this.setListVariable=async(t,n)=>(await a(this,w)).setListVariableItems(t,n.map(h=>JSON.stringify({value:h}))).then(h=>i(h)),this.setValue=async(t,n)=>(await a(this,w)).setVariableValue(t,n).then(h=>i(h,d=>Ur(d,{id:t}))),this.duplicate=async t=>(await a(this,w)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,n)=>(await a(this,w)).groupVariables(t,n).then(h=>i(h)),this.ungroupVariables=async t=>(await a(this,w)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,n,r)=>(await a(this,w)).moveVariable(n,r,t).then(d=>i(d)),this.moveVariables=async(t,n,r)=>(await a(this,w)).moveVariables(n,r,t).then(d=>i(d)),this.setIsVisible=async(t,n)=>{const r=n?{type:Lt.visible}:{type:Lt.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,n)=>{const r=n?{type:Lt.invisible}:{type:Lt.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,n)=>(await a(this,w)).setVariableVisibility(t,JSON.stringify(n)).then(h=>i(h)),this.setLayoutsForVariableVisibility=async t=>(await a(this,w)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,n)=>(await a(this,w)).setVariableIsRequired(t,n).then(h=>i(h)),this.setRemoveParagraphIfEmpty=async(t,n)=>(await a(this,w)).setVariableRemoveParagraphIfEmpty(t,n).then(h=>i(h)),this.setVariableCharacterLimit=async(t,n)=>(await a(this,w)).setVariableCharacterLimit(t,n).then(h=>i(h)),this.setIsReadonly=async(t,n)=>(await a(this,w)).setVariableIsReadonly(t,n).then(h=>i(h)),this.getImageVariableConnectorId=async t=>(await a(this,w)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,n)=>{const r=await a(this,w),d=new le().makeConnectorSourceForwardsCompatible(n);return r.setImageVariableConnector(t,JSON.stringify(d)).then(u=>i(u))},this.setImageVariableValueWithContext=async(t,n,r)=>(await a(this,w)).setImageVariableValueWithContext(t,n,JSON.stringify(r)).then(d=>i(d)),this.removeSource=async t=>this.setValue(t,null),this.setPrefix=async(t,n)=>{const r={prefix:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffix=async(t,n)=>{const r={suffix:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrefixCharacterStyle=async(t,n)=>{const r={prefixCharacterStyleId:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffixCharacterStyle=async(t,n)=>{const r={suffixCharacterStyleId:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrivateData=async(t,n)=>(await a(this,w)).setVariablePrivateData(t,JSON.stringify(n)).then(h=>i(h)),this.getPrivateData=async t=>(await a(this,w)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,n)=>(await a(this,w)).setImageVariableAllowQuery(t,n).then(h=>i(h)),this.setAllowImageUpload=async(t,n)=>(await a(this,w)).setImageVariableAllowUpload(t,n).then(h=>i(h)),this.setMinImageUploadSize=async(t,n,r)=>(await a(this,w)).setImageVariableUploadMinSize(t,n,r).then(d=>i(d)),this.setIsDontBreak=async(t,n)=>(await a(this,w)).setVariableIsDontBreak(t,n).then(h=>i(h)),this.highlightUsages=async t=>(await a(this,w)).highlightVariableUsages(t).then(r=>i(r)),this.setRichTextRules=async t=>(await a(this,w)).setRichTextRulesets(JSON.stringify(t)).then(r=>i(r)),y(this,w,o),this.number=new ea(a(this,w)),this.date=new sa(a(this,w)),this.dataSource=new na(a(this,w),e)}makeVariablesBackwardsCompatible(o){return o.map(e=>this.makeVariableBackwardsCompatible(e))}makeVariableBackwardsCompatible(o){return o.type!==Wt.list?o:this.makeListVariableBackwardsCompatible(o)}makeListVariableBackwardsCompatible(o){const e=o,t=o.items,n=o.selected,r=t.map(h=>h.value);return e.items=r,e.selected=n==null?void 0:n.value,e}async applyPrefixSuffixDeltaUpdate(o,e){const n=await(await a(this,w)).updateVariablePrefixSuffixProperties(o,JSON.stringify(e));return i(n)}},w=new WeakMap,Ut=new WeakMap,Gt=new WeakMap,zn);class ra{constructor(o){this.onVariableListChanged=e=>{this.config.events.onVariableListChanged.trigger(JSON.parse(e))},this.onConnectorsChanged=e=>{this.config.events.onConnectorsChanged.trigger(JSON.parse(e))},this.onPageSizeChanged=e=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(e))},this.onEngineEditModeChanged=e=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(e))},this.config=o}}class aa{constructor(o){g(this,gt);this.getAll=async()=>(await a(this,gt)).getVariables().then(t=>i(t)),this.getById=async e=>(await a(this,gt)).getVariableById(e).then(n=>i(n)),this.getByName=async e=>(await a(this,gt)).getVariableByName(e).then(n=>i(n)),this.setListVariable=async(e,t)=>(await a(this,gt)).setListVariableItems(e,t.map(r=>JSON.stringify(r))).then(r=>i(r)),y(this,gt,o),this.image=new ia(o),this.dataSource=new oa(o)}}gt=new WeakMap;class ia{constructor(o){g(this,nt);this.setAllowQuery=async(e,t)=>(await a(this,nt)).setImageVariableAllowQuery(e,t).then(r=>i(r)),this.setAllowUpload=async(e,t)=>(await a(this,nt)).setImageVariableAllowUpload(e,t).then(r=>i(r)),this.setMinUploadSize=async(e,t,n)=>(await a(this,nt)).setImageVariableUploadMinSize(e,t,n).then(h=>i(h)),this.setConnector=async(e,t)=>(await a(this,nt)).setImageVariableConnector(e,JSON.stringify(t)).then(r=>i(r)),this.setConnectorContext=async(e,t)=>(await a(this,nt)).setImageVariableConnectorContext(e,JSON.stringify(t)).then(r=>i(r)),y(this,nt,o)}}nt=new WeakMap;class oa{constructor(o){g(this,re);this.setConnector=async(e,t)=>(await a(this,re)).setDataSourceVariableConnector(e,JSON.stringify(t)).then(r=>i(r)),y(this,re,o)}}re=new WeakMap;class ha{constructor(o){g(this,At);this.register=async e=>(await a(this,At)).registerConnector(JSON.stringify(e)).then(n=>i(n)),this.getById=async e=>(await a(this,At)).getConnectorById(e).then(n=>i(n)),this.getAllByType=async e=>(await a(this,At)).getConnectors(e).then(n=>i(n)),y(this,At,o)}}At=new WeakMap;class ca{constructor(o){g(this,_t);g(this,pe);this.setWidth=async e=>(await a(this,_t)).setPageWidth(e).then(n=>i(n)),this.setHeight=async e=>(await a(this,_t)).setPageHeight(e).then(n=>i(n)),y(this,_t,o),y(this,pe,o)}}_t=new WeakMap,pe=new WeakMap;class rn{constructor(o,e,t){this.config=o,this.connection=e,this.editorAPI=t,this.subscriber=new ra(o),this.variable=new aa(this.editorAPI),this.connector=new ha(this.editorAPI),this.page=new ca(this.editorAPI),this.canvas=new fe(this.editorAPI)}}class Pe{constructor(o){this.logger=o}getLogCategory(){return ye.event}createEventHandlerFn(o,e){return(...n)=>{try{const r=o(...n);return r instanceof Promise?r.catch(h=>this.handleError(h,e,o.name)):r}catch(r){this.handleError(r,e,o.name)}}}handleError(o,e,t){var n;if(e===Nt.log)(n=this.logger)==null||n.call(this,B.error,this.getLogCategory(),`Error in callback ${t}: ${o}`);else throw o}}class an extends Pe{constructor(o,e){super(e),this.handler=o}trigger(...o){const e=this.handler();if(e)return this.createEventHandlerFn(e,Nt.throw)(...o)}}class C extends Pe{constructor(o,e){super(e),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const e=this.legacyHandler();e&&this.createEventHandlerFn(e,Nt.log)(...o);for(const t of this.subscriptions)t(...o)}registerCallback(o,e=Nt.log){const t=this.createEventHandlerFn(o,e);return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}}class Ee{static createRuntimeConfig(o){var t,n,r,h,d,u,m,p,S,b,v,O,A,L,F,M,I,U,rt,xt,$t,Wn,Kn,qn,Yn,Zn,Qn,Xn,tr,er,sr,nr,rr,ar,ir;const e={...o};return e.logging={logLevel:((t=o.logging)==null?void 0:t.logLevel)||B.error,logger:((n=o.logging)==null?void 0:n.logger)||((ie,Oe,Fe)=>{var or;if(Ee.isLoggingEnabled(ie,((or=e.logging)==null?void 0:or.logLevel)??B.error))switch(ie){case B.error:console.error(`[${Oe}] [${ie}] ${Fe}`);break;case B.warn:console.warn(`[${Oe}] [${ie}] ${Fe}`);break;default:console.log(`[${Oe}] [${ie}] ${Fe}`)}})},e.handlers={onAuthExpired:new an(()=>e.onAuthExpired,(r=e.logging)==null?void 0:r.logger),onViewportRequested:new an(()=>e.onViewportRequested,(h=e.logging)==null?void 0:h.logger)},e.events={onActionsChanged:new C(()=>e.onActionsChanged,(d=e.logging)==null?void 0:d.logger),onStateChanged:new C(()=>e.onStateChanged,(u=e.logging)==null?void 0:u.logger),onDocumentLoaded:new C(()=>e.onDocumentLoaded,(m=e.logging)==null?void 0:m.logger),onSelectedFramesLayoutChanged:new C(()=>e.onSelectedFramesLayoutChanged,(p=e.logging)==null?void 0:p.logger),onFramesLayoutChanged:new C(()=>e.onFramesLayoutChanged,(S=e.logging)==null?void 0:S.logger),onSelectedFramesContentChanged:new C(()=>e.onSelectedFramesContentChanged,(b=e.logging)==null?void 0:b.logger),onPageSelectionChanged:new C(()=>e.onPageSelectionChanged,(v=e.logging)==null?void 0:v.logger),onSelectedLayoutPropertiesChanged:new C(()=>e.onSelectedLayoutPropertiesChanged,(O=e.logging)==null?void 0:O.logger),onSelectedLayoutUnitChanged:new C(()=>e.onSelectedLayoutUnitChanged,(A=e.logging)==null?void 0:A.logger),onScrubberPositionChanged:new C(()=>e.onScrubberPositionChanged,(L=e.logging)==null?void 0:L.logger),onFrameAnimationsChanged:new C(()=>e.onFrameAnimationsChanged,(F=e.logging)==null?void 0:F.logger),onVariableListChanged:new C(()=>e.onVariableListChanged,(M=e.logging)==null?void 0:M.logger),onSelectedToolChanged:new C(()=>e.onSelectedToolChanged,(I=e.logging)==null?void 0:I.logger),onUndoStackStateChanged:new C(()=>e.onUndoStackStateChanged,(U=e.logging)==null?void 0:U.logger),onSelectedLayoutFramesChanged:new C(()=>e.onSelectedLayoutFramesChanged,(rt=e.logging)==null?void 0:rt.logger),onSelectedTextStyleChanged:new C(()=>e.onSelectedTextStyleChanged,(xt=e.logging)==null?void 0:xt.logger),onColorsChanged:new C(()=>e.onColorsChanged,($t=e.logging)==null?void 0:$t.logger),onParagraphStylesChanged:new C(()=>e.onParagraphStylesChanged,(Wn=e.logging)==null?void 0:Wn.logger),onCharacterStylesChanged:new C(()=>e.onCharacterStylesChanged,(Kn=e.logging)==null?void 0:Kn.logger),onFontFamiliesChanged:new C(()=>e.onFontFamiliesChanged,(qn=e.logging)==null?void 0:qn.logger),onSelectedLayoutIdChanged:new C(()=>e.onSelectedLayoutIdChanged,(Yn=e.logging)==null?void 0:Yn.logger),onLayoutsChanged:new C(()=>e.onLayoutsChanged,(Zn=e.logging)==null?void 0:Zn.logger),onConnectorEvent:new C(()=>e.onConnectorEvent,(Qn=e.logging)==null?void 0:Qn.logger),onConnectorsChanged:new C(()=>e.onConnectorsChanged,(Xn=e.logging)==null?void 0:Xn.logger),onZoomChanged:new C(()=>e.onZoomChanged,(tr=e.logging)==null?void 0:tr.logger),onSelectedPageIdChanged:new C(()=>e.onSelectedPageIdChanged,e.logging.logger),onPagesChanged:new C(()=>e.onPagesChanged,e.logging.logger),onPageSnapshotInvalidated:new C(()=>e.onPageSnapshotInvalidated,e.logging.logger),onPageSizeChanged:new C(()=>e.onPageSizeChanged,(er=e.logging)==null?void 0:er.logger),onShapeCornerRadiusChanged:new C(()=>e.onShapeCornerRadiusChanged,(sr=e.logging)==null?void 0:sr.logger),onCropActiveFrameIdChanged:new C(()=>e.onCropActiveFrameIdChanged,(nr=e.logging)==null?void 0:nr.logger),onAsyncError:new C(()=>e.onAsyncError,(rr=e.logging)==null?void 0:rr.logger),onViewModeChanged:new C(()=>e.onViewModeChanged,(ar=e.logging)==null?void 0:ar.logger),onBarcodeValidationChanged:new C(()=>e.onBarcodeValidationChanged,(ir=e.logging)==null?void 0:ir.logger),onDataSourceIdChanged:new C(()=>e.onDataSourceIdChanged,e.logging.logger),onInjectedDataChanged:new C(()=>e.onInjectedDataChanged,e.logging.logger),onDocumentIssueListChanged:new C(()=>e.onDocumentIssueListChanged,e.logging.logger),onCustomUndoDataChanged:new C(()=>e.onCustomUndoDataChanged,e.logging.logger),onEngineEditModeChanged:new C(()=>e.onEngineEditModeChanged,e.logging.logger),onBrandKitMediaChanged:new C(()=>e.onBrandKitMediaChanged,e.logging.logger),onCanvasFramesManipulated:new C(()=>e.onCanvasFramesManipulated,e.logging.logger)},e}static isLoggingEnabled(o,e){return e==B.info||e==B.warn&&(o==B.warn||o==B.error)?!0:e==B.error&&o==B.error}}class da{isDatePropertyWrapper(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)&&"type"in o&&o.type==="date"&&"chiliReservedTag"in o&&o.chiliReservedTag==="date"}isDateObject(o){return o instanceof Date}mapEngineToDataItem(o){const e={};return Object.entries(o).forEach(([t,n])=>{e[t]=this.isDatePropertyWrapper(n)?new Date(n.value):n}),e}mapDataItemToEngine(o){const e={};return Object.entries(o).forEach(([t,n])=>{e[t]=this.isDateObject(n)?{value:n.getTime(),type:"date",chiliReservedTag:"date"}:n}),e}}class la{constructor(o){g(this,yt);y(this,yt,o)}async getValue(o){return(await a(this,yt)).getConfigValue(o).then(t=>i(t))}async setValue(o,e){return(await a(this,yt)).setConfigValue(o,e).then(n=>i(n))}async updateStudioOptions(o){return(await a(this,yt)).updateStudioOptions(JSON.stringify(o)).then(t=>i(t))}async getEngineSessionId(){return(await a(this,yt)).getEngineSessionId().then(e=>i(e))}getLatestSmartCropVersion(){return Kr}}yt=new WeakMap;class on extends la{constructor(e,t){super(e);g(this,Ht);y(this,Ht,t)}async getValue(e){const t=a(this,Ht).get(e);return t!=null?i({status:200,success:!0,parsedData:t,data:t},!1):super.getValue(e)}async setValue(e,t){const n=super.setValue(e,t);return a(this,Ht).set(e,t),n}}Ht=new WeakMap;class hn{constructor(o){g(this,z);this.getAll=async()=>(await a(this,z)).getGradients().then(t=>i(t)),this.getById=async e=>(await a(this,z)).getGradientById(e).then(n=>i(n)),this.create=async()=>(await a(this,z)).createGradient().then(t=>i(t)),this.duplicate=async e=>(await a(this,z)).duplicateGradient(e).then(n=>i(n)),this.move=async(e,t)=>(await a(this,z)).moveGradients(e,t).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,z)).renameGradient(e,t).then(r=>i(r)),this.update=async(e,t)=>{const n=await a(this,z),r=t;return n.updateGradient(e,JSON.stringify(r)).then(h=>i(h))},this.remove=async e=>(await a(this,z)).removeGradient(e).then(n=>i(n)),y(this,z,o)}}z=new WeakMap;class cn{constructor(o){g(this,Pt);g(this,ae);this.query=async(e,t,n={})=>(await a(this,Pt)).componentConnectorQuery(e,JSON.stringify(t),JSON.stringify(n)).then(h=>i(h)),this.preview=async(e,t,n,r={})=>(await a(this,ae)).componentConnectorPreview(e,t,n,JSON.stringify(r)).then(d=>{if(d instanceof Uint8Array)return d;throw typeof d=="object"&&d!==null&&"success"in d&&!d.success&&wt(d),new Error(`Unexpected response type: ${typeof d}.`)}),this.getConfigurationOptions=async e=>(await a(this,Pt)).componentConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,Pt)).componentConnectorGetCapabilities(e).then(n=>i(n)),y(this,Pt,o),y(this,ae,o)}}Pt=new WeakMap,ae=new WeakMap;class dn{constructor(o){g(this,pt);this.linkVariable=async(e,t,n,r)=>(await a(this,pt)).linkComponentVariable(e,t,n,r??null).then(d=>i(d)),this.getComponentVariables=async e=>(await a(this,pt)).getComponentVariables(e).then(n=>i(n)),this.setFitMode=async(e,t)=>(await a(this,pt)).setComponentLayoutFit(e,t).then(r=>i(r)),this.resetFitMode=async e=>(await a(this,pt)).resetComponentLayoutFit(e).then(n=>i(n)),y(this,pt,o)}}pt=new WeakMap;class ln{constructor(o){g(this,tt);this.updateSettings=async(e,t)=>(await a(this,tt)).updateComponentGridSettings(e,JSON.stringify(t)).then(r=>i(r)),this.setMapping=async(e,t,n,r,h)=>(await a(this,tt)).setComponentGridMapping(e,t,n,r,h).then(u=>i(u)),this.resetSettings=async e=>(await a(this,tt)).resetComponentGridSettings(e).then(n=>i(n)),this.setComponentSource=async(e,t)=>(await a(this,tt)).setComponentGridComponentSource(e,t?JSON.stringify(t):null).then(r=>i(r)),this.setDataSourceVariable=async(e,t)=>(await a(this,tt)).setComponentGridDataSourceVariable(e,t).then(r=>i(r)),this.setResizeMode=async(e,t)=>(await a(this,tt)).setComponentGridResizeMode(e,t).then(r=>i(r)),y(this,tt,o)}}tt=new WeakMap;const ua=()=>{};class ga{constructor(){this.listeners=new Map}add(o,e){if(typeof e!="function")return ua;const t=this.listeners.get(o)??new Set;return t.add(e),this.listeners.set(o,t),()=>{this.remove(o,e)}}remove(o,e){const t=this.listeners.get(o);t&&(t.delete(e),t.size===0&&this.listeners.delete(o))}getListeners(o){return[...this.listeners.get(o)??[]]}}const ya=s=>!s||typeof s!="object"?!1:typeof s.then=="function",pa=s=>!(!s||typeof s!="object"||Array.isArray(s)),un=(s,o,e)=>{e==null||e(B.error,ye.sdk,`Error in method listener for ${s}: ${String(o)}`)},Kt=(s,o,e,t,n)=>{for(const r of e.getListeners(s))try{r(o)}catch(h){un(s,h,n)}try{o.phase==="invoke"?t.onMethodInvoked.trigger(o):t.onMethodCompleted.trigger(o)}catch(r){un(s,r,n)}};function gn(s,o,e,t,n){const r=new Map,h=new Map;return new Proxy(s,{get(d,u,m){const p=Reflect.get(d,u,m);if(typeof u=="symbol")return p;if(typeof p=="function"){if(r.has(u))return r.get(u);const S=`${o}.${String(u)}`,b=o.split(".")[0]||o,v=String(u),O=((...A)=>{const L={phase:"invoke",path:S,controller:b,method:v,args:[...A]};Kt(S,L,e,t,n);try{const F=p.apply(d,A);if(ya(F))return F.then(I=>{const U={phase:"complete",path:S,controller:b,method:v,args:[...A],success:!0,result:I};return Kt(S,U,e,t,n),I}).catch(I=>{const U={phase:"complete",path:S,controller:b,method:v,args:[...A],success:!1,error:I};throw Kt(S,U,e,t,n),I});const M={phase:"complete",path:S,controller:b,method:v,args:[...A],success:!0,result:F};return Kt(S,M,e,t,n),F}catch(F){const M={phase:"complete",path:S,controller:b,method:v,args:[...A],success:!1,error:F};throw Kt(S,M,e,t,n),F}});return O.addEventListener=A=>e.add(S,A),O.removeEventListener=A=>{e.remove(S,A)},r.set(u,O),O}if(pa(p)){if(h.has(u))return h.get(u);const S=`${o}.${String(u)}`,b=gn(p,S,e,t,n);return h.set(u,b),b}return p}})}class yn extends Pe{constructor(o){super(o),this.subscriptions=new Set}getLogCategory(){return ye.sdk}trigger(...o){const e=Array.from(this.subscriptions);for(const t of e)t(...o)}registerCallback(o,e=Nt.log){const t=this.createEventHandlerFn(o,e);return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}}class ma{constructor(o){this.onMethodInvoked=new yn(o),this.onMethodCompleted=new yn(o)}}const wa=`https://studio-cdn.chiligrafx.com/editor/${k.current}/web`;let it;const pn=Symbol("pendingInstrumentation"),Ca=s=>{Object.defineProperty(s,pn,{value:!0,enumerable:!1,configurable:!0})},fa=s=>typeof s=="object"&&s!==null&&s[pn]===!0;class Sa{constructor(o){var e;this.localConfig=new Map,this.dataItemMappingTools=new da,this.methodListeners=new ga,this.loadEditor=()=>{var t;Vr(this.config.editorLink||wa,{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:n=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onVariableListChanged?this.next.subscriber.onVariableListChanged(n):this.subscriber.onVariableListChanged(n)},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:n=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onConnectorsChanged?this.next.subscriber.onConnectorsChanged(n):this.subscriber.onConnectorsChanged(n)},onZoomChanged:this.subscriber.onZoomChanged,onSelectedPageIdChanged:this.subscriber.onSelectedPageIdChanged,onPagesChanged:this.subscriber.onPagesChanged,onPageSnapshotInvalidated:this.subscriber.onPageSnapshotInvalidated,onPageSizeChanged:n=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onPageSizeChanged?this.next.subscriber.onPageSizeChanged(n):this.subscriber.onPageSizeChanged(n)},onShapeCornerRadiusChanged:this.subscriber.onShapeCornerRadiusChanged,onCropActiveFrameIdChanged:this.subscriber.onCropActiveFrameIdChanged,onAsyncError:this.subscriber.onAsyncError,onViewModeChanged:this.subscriber.onViewModeChanged,onBarcodeValidationChanged:this.subscriber.onBarcodeValidationChanged,onDataSourceIdChanged:this.subscriber.onDataSourceIdChanged,onInjectedDataChanged:this.subscriber.onInjectedDataChanged,onDocumentIssueListChanged:this.subscriber.onDocumentIssueListChanged,onCustomUndoDataChanged:this.subscriber.onCustomUndoDataChanged,onEngineEditModeChanged:this.subscriber.onEngineEditModeChanged,onBrandKitMediaChanged:this.subscriber.onBrandKitMediaChanged,onCanvasFramesManipulated:this.subscriber.onCanvasFramesManipulated},this.setConnection,this.config.editorId,this.config.studioStyling,n=>{var r,h;(h=(r=this.config).onConnectionError)==null||h.call(r,n)}),this.editorAPI=it==null?void 0:it.promise.then(n=>n),this.action=this.toInstrumented(new Ge(this.editorAPI)),this.layout=this.toInstrumented(new Gs(this.editorAPI)),this.frame=this.toInstrumented(new Js(this.editorAPI)),this.barcode=this.toInstrumented(new We(this.editorAPI)),this.component=this.toInstrumented(new dn(this.editorAPI)),this.animation=this.toInstrumented(new _e(this.editorAPI)),this.document=this.toInstrumented(new ws(this.editorAPI)),this.configuration=this.toInstrumented(new on(this.editorAPI,this.localConfig)),this.utils=this.toInstrumented(new sn(this.editorAPI,this.localConfig)),this.tool=this.toInstrumented(new Xs(this.editorAPI)),this.page=this.toInstrumented(new Hs(this.editorAPI)),this.debug=this.toInstrumented(new ms(this.editorAPI)),this.undoManager=this.toInstrumented(new tn(this.editorAPI,this)),this.textSelection=this.toInstrumented(new qs(this.editorAPI)),this.colorStyle=this.toInstrumented(new ts(this.editorAPI)),this.gradientStyle=this.toInstrumented(new hn(this.editorAPI)),this.paragraphStyle=this.toInstrumented(new xs(this.editorAPI)),this.characterStyle=this.toInstrumented(new qe(this.editorAPI)),this.mediaConnector=this.toInstrumented(new _s(this.editorAPI)),this.fontConnector=this.toInstrumented(new ks(this.editorAPI)),this.componentConnector=this.toInstrumented(new cn(this.editorAPI)),this.dataConnector=this.toInstrumented(new ys(this.editorAPI,this.dataItemMappingTools)),this.dataSource=this.toInstrumented(new ps(this.editorAPI,this.dataItemMappingTools)),this.connector=this.toInstrumented(new gs(this.editorAPI,this.localConfig)),this.variable=this.toInstrumented(new nn(this.editorAPI,this.dataItemMappingTools)),this.font=this.toInstrumented(new Bs(this.editorAPI)),this.experiment=this.toInstrumented(new Ts(this.editorAPI)),this.canvas=this.toInstrumented(new fe(this.editorAPI)),this.shape=this.toInstrumented(new Ie(this.editorAPI)),this.colorConversion=this.toInstrumented(new Ze(this.editorAPI)),this.info=this.toInstrumented(new Us),this.clipboard=this.toInstrumented(new Ye(this.editorAPI)),this.brandKit=this.toInstrumented(new Ke(this.editorAPI,this)),this.componentGrid=this.toInstrumented(new ln(this.editorAPI)),this.next=new rn(this.config,this.connection,this.editorAPI),this.applyMethodInstrumentation(),this.configuration.setValue(Z.GraFxStudioSdkVersion,De.version),this.configuration.setValue(Z.GraFxStudioDocumentType,this.config.documentType||Ce.template),this.configuration.updateStudioOptions(this.config.studioOptions||Tr),this.configuration.setValue(Z.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{it=t},this.toInstrumented=t=>(Ca(t),t),this.applyMethodInstrumentation=()=>{var n;const t=this;for(const r of Object.keys(t)){const h=t[r];fa(h)&&(t[r]=gn(h,r,this.methodListeners,this.sdkEvents,(n=this.config.logging)==null?void 0:n.logger))}},this.config=Ee.createRuntimeConfig(o),this.sdkEvents=new ma((e=this.config.logging)==null?void 0:e.logger),this.connection=it,this.editorAPI=it==null?void 0:it.promise.then(t=>t),this.action=this.toInstrumented(new Ge(this.editorAPI)),this.layout=this.toInstrumented(new Gs(this.editorAPI)),this.frame=this.toInstrumented(new Js(this.editorAPI)),this.shape=this.toInstrumented(new Ie(this.editorAPI)),this.barcode=this.toInstrumented(new We(this.editorAPI)),this.component=this.toInstrumented(new dn(this.editorAPI)),this.undoManager=this.toInstrumented(new tn(this.editorAPI,this)),this.connector=this.toInstrumented(new gs(this.editorAPI,this.localConfig)),this.mediaConnector=this.toInstrumented(new _s(this.editorAPI)),this.fontConnector=this.toInstrumented(new ks(this.editorAPI)),this.componentConnector=this.toInstrumented(new cn(this.editorAPI)),this.dataConnector=this.toInstrumented(new ys(this.editorAPI,this.dataItemMappingTools)),this.dataSource=this.toInstrumented(new ps(this.editorAPI,this.dataItemMappingTools)),this.animation=this.toInstrumented(new _e(this.editorAPI)),this.document=this.toInstrumented(new ws(this.editorAPI)),this.configuration=this.toInstrumented(new on(this.editorAPI,this.localConfig)),this.variable=this.toInstrumented(new nn(this.editorAPI,this.dataItemMappingTools)),this.utils=this.toInstrumented(new sn(this.editorAPI,this.localConfig)),this.subscriber=new Yr(this.config,this.localConfig),this.tool=this.toInstrumented(new Xs(this.editorAPI)),this.page=this.toInstrumented(new Hs(this.editorAPI)),this.debug=this.toInstrumented(new ms(this.editorAPI)),this.textSelection=this.toInstrumented(new qs(this.editorAPI)),this.colorStyle=this.toInstrumented(new ts(this.editorAPI)),this.gradientStyle=this.toInstrumented(new hn(this.editorAPI)),this.paragraphStyle=this.toInstrumented(new xs(this.editorAPI)),this.characterStyle=this.toInstrumented(new qe(this.editorAPI)),this.font=this.toInstrumented(new Bs(this.editorAPI)),this.experiment=this.toInstrumented(new Ts(this.editorAPI)),this.canvas=this.toInstrumented(new fe(this.editorAPI)),this.colorConversion=this.toInstrumented(new Ze(this.editorAPI)),this.info=this.toInstrumented(new Us),this.clipboard=this.toInstrumented(new Ye(this.editorAPI)),this.next=new rn(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=this.toInstrumented(new Ke(this.editorAPI,this)),this.componentGrid=this.toInstrumented(new ln(this.editorAPI)),this.applyMethodInstrumentation()}}var mn=(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))(mn||{}),wn=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(wn||{}),Cn=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))(Cn||{}),fn=(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))(fn||{}),Sn=(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))(Sn||{}),bn=(s=>(s.preview="preview",s.normal="normal",s))(bn||{}),In=(s=>(s.linear="linear",s))(In||{}),vn=(s=>(s.local="linearLocal",s.linearBrandKit="linearBrandKit",s))(vn||{}),An=(s=>(s.Square="square",s.Line="line",s))(An||{}),Pn=(s=>(s.thumbnail="thumbnail",s.highest="highest",s.medium="medium",s))(Pn||{}),En=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(En||{}),On=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(On||{}),Fn=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(Fn||{}),Dn=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(Dn||{}),Ln=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Ln||{}),Nn=(s=>(s.none="none",s.bullet="bullet",s.number="number",s))(Nn||{}),Mn=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(Mn||{}),Rn=(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.BACKGROUND_COLOR="backgroundColor",s.BACKGROUND_COLOR_APPLIED="backgroundColorApplied",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))(Rn||{}),Vn=(s=>(s.arabic="arabic",s.romanUpperCase="romanUpperCase",s.romanLowerCase="romanLowerCase",s.latinUpperCase="latinUpperCase",s.latinLowerCase="latinLowerCase",s))(Vn||{}),Tn=(s=>(s.none="none",s.dash="dash",s.dot="dot",s.colon="colon",s.roundBracket="roundBracket",s))(Tn||{}),kn=(s=>(s.fixed="fixed",s))(kn||{}),Bn=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(Bn||{}),Jn=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s.custom="custom",s))(Jn||{}),Un=(s=>(s.all="all",s.only="only",s.none="none",s))(Un||{}),Gn=(s=>(s.paragraph="paragraph",s.character="character",s.lineBreak="lineBreak",s.inlineStyle="inlineStyle",s))(Gn||{}),_n=(s=>(s.exists="exists",s.missing="missing",s.equals="equals",s.notEquals="notEquals",s.contains="contains",s.startsWith="startsWith",s.endsWith="endsWith",s))(_n||{}),Hn=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s.gradient="gradient",s))(Hn||{}),xn=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(xn||{});const ba=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:xn},Symbol.toStringTag,{value:"Module"}));c.APIColorType=Qe,c.ActionAsyncError=ke,c.ActionEditorEvent=Bn,c.Alignment=On,c.AnchorTargetEdgeType=Ms,c.AnchorTargetType=Ns,c.AuthCredentialsTypeEnum=cs,c.AuthRefreshTypeEnum=ds,c.AutoGrowDirection=fs,c.BarcodeCharacterSet=Ct,c.BarcodeErrorCorrectionLevel=Et,c.BarcodeSourceTypeEnum=Is,c.BarcodeType=W,c.BarcodeValidationResult=He,c.BasicAnimationsEmphasisStyles=Sn,c.BlendMode=Es,c.Case=Dn,c.ColorType=he,c.ColorUsageType=Xe,c.ComponentFitEnum=Cs,c.ComponentGridLayoutAlgorithm=kn,c.ComponentPreviewType=Pn,c.ComponentSourceTypeEnum=Ss,c.ConnectorConfigContextType=as,c.ConnectorConfigValueType=rs,c.ConnectorEventType=hs,c.ConnectorHttpError=Je,c.ConnectorMapping=_r,c.ConnectorMappingDirection=os,c.ConnectorMappingSource=is,c.ConnectorRegistrationSource=Dt,c.ConnectorStateType=de,c.ConnectorSupportedAuth=us,c.ConnectorType=es,c.ConstraintMode=ze,c.CornerRadiusType=Un,c.CropType=be,c.DataRowAsyncError=Be,c.DataSourceVariableDisplayOptionsType=Ks,c.DataSourceVariableSourceType=Ae,c.Day=$s,c.DeprecatedMediaConnectorDownloadType=ce,c.DeprecatedMediaType=Ot,c.DocumentIssueTypeEnum=Te,c.DocumentType=Ce,c.DownloadFormats=Qs,c.EaseTypes=Cn,c.EngineEditModeType=Hn,c.EnvironmentType=ge,c.FitMode=Os,c.FitModePosition=Fs,c.FlowDirection=As,c.FontPreviewFormat=An,c.FontWeights=En,c.FrameAnchorTarget=Wr,c.FrameAnchorType=Ls,c.FrameEditingMode=Ve,c.FramePropertyNames=Ys,c.FrameTypeEnum=bs,c.GradientType=In,c.GradientUsageType=vn,c.GrafxTokenAuthCredentials=xr,c.ImageSourceTypeEnum=zt,c.LayoutIntent=je,c.LayoutPropertyNames=Zs,c.LayoutType=$e,c.Locale=js,c.MarkedListType=Nn,c.MeasurementUnit=xe,c.MediaDownloadIntent=ve,c.MediaDownloadType=ue,c.MediaType=Ft,c.Next=ba,c.NumberListFormat=Vn,c.NumberListSeparatorSymbol=Tn,c.PageAnchorTarget=zr,c.PositionEnum=Q,c.RefreshedAuthCredendentials=$r,c.SDKUnauthorizedError=en,c.Scripting=Ln,c.SelectedTextStyleSections=Mn,c.SelectedTextStyles=Rn,c.ShakeDirections=wn,c.ShapeType=Jn,c.SlideDirections=mn,c.SmartCropAxisBias=Vs,c.SmartCropVersion=Rs,c.SortBy=ss,c.SortOrder=ns,c.StructuredTextAttributeMatchOperator=_n,c.StructuredTextStyleKind=Gn,c.TextDirection=vs,c.TextPosition=Fn,c.ToolType=G,c.TweenTypes=fn,c.UpdateZIndexMethod=Ds,c.UploadAssetValidationError=ls,c.UploadAssetValidationErrorType=Se,c.VariableType=Wt,c.VariableValueConstrainsViolationError=Ue,c.VariableVisibilityOperator=Ws,c.VariableVisibilityTargetType=zs,c.VariableVisibilityType=Lt,c.VerticalAlign=Ps,c.ViewMode=bn,c.WellKnownConfigurationKeys=Z,c.default=Sa,c.grafxMediaConnectorRegistration=Hr,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
68
+ </html>`,c=URL.createObjectURL(new Blob([r],{type:"text/html"}));return s.setAttribute("src",c),c},Mr=(s,o,e,t="chili-editor",n,r)=>{const c=`#${t}`,d=document.createElement("iframe");d.setAttribute("src","about:blank"),d.setAttribute("title","Chili-Editor"),d.setAttribute("style","width: 100%; height: 100%;"),d.setAttribute("frameBorder","0"),d.setAttribute("referrerpolicy","origin");let l=null,m=null,p=null;const f=()=>{l&&(window.removeEventListener("message",l),l=null),m&&(document.removeEventListener("DOMContentLoaded",m),m=null),d.remove(),p&&(URL.revokeObjectURL(p),p=null)},b=()=>{const I=document.querySelector(c);if(I){I==null||I.appendChild(d),d.addEventListener("error",()=>{const A=new Error("Failed to setup frame: iframe failed to load");r==null||r(A)},{capture:!0,once:!0});try{p=Nr(d,s,n)}catch(A){A instanceof Error?r==null||r(A):r==null||r(new Error(`Failed to setup frame: ${A}`))}}};return document.readyState==="complete"||document.readyState==="interactive"?b():(m=()=>{m=null,b()},document.addEventListener("DOMContentLoaded",m,{once:!0})),l=I=>{var A;if(I.source===d.contentWindow&&((A=I.data)==null?void 0:A.type)==="iframe-error"){const v=I.data.error,E=new Error(v.message||"Failed to setup frame: error in iframe");r==null||r(E)}},window.addEventListener("message",l),e(Dr({iframe:d,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,injectedDataChanged:o.onInjectedDataChanged,documentIssueListChanged:o.onDocumentIssueListChanged,customUndoDataChanged:o.onCustomUndoDataChanged,engineEditingModeChanged:o.onEngineEditModeChanged,brandKitMediaChanged:o.onBrandKitMediaChanged,frameManipulated:o.onCanvasFramesManipulated}})),f};var Z=(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))(Z||{}),Me=(s=>(s.full="full",s.followConstraints="followConstraints",s))(Me||{});const Rr={shortcutOptions:{debugPanel:{enabled:!1},ellipse:{enabled:!1},hand:{enabled:!1},temporaryHand:{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},componentGrid:{enabled:!1}},frameEditingMode:"full"};var Re=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(Re||{}),me=(s=>(s.project="project",s.template="template",s.component="component",s))(me||{});class Ve{constructor(o,e,t,n){this.type="action",this.message=o,this.id=e,this.event=t,this.eventChain=n}}class ke{constructor(o,e,t){this.type="dataRow",this.count=o,this.message=e,this.exceptions=t}}class Te extends Error{constructor(o,e,t){super(e,t),this.statusCode=o}}class Be extends Error{constructor(o,e,t){super(e,t),this.context=o}}const Vr=404075,kr=403032;function mt(s){const o=s.error??"Yikes, something went wrong",e={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===Vr){const n=JSON.parse(s.data).statusCode;throw new Te(n,o,e)}else throw new Error(o,e)}function Tr(s){const o=[/DateVariable '([^']+)' should not be part of excludedDays, ".*" was given/,/DateVariable '([^']+)' expects \$date to be > startDate:.*$/,/DateVariable '([^']+)' expects \$date to be < endDate:.*$/,/NumberVariable '([^']+)' expects \$extractedValue to be >= .+$/,/NumberVariable '([^']+)' expects \$extractedValue to be <= .+$/];for(const e of o)if(s.match(e))return{valid:!0};return{valid:!1}}function Br(s,o){if(s.status===kr&&s.error){const e=s.error;if(Tr(e).valid)throw new Be(o,e,{cause:{name:String(s.status),message:e}})}}function Jr(s){mt(s)}function i(s,o){let e=!0,t=!1,n=Jr;typeof o=="function"?(t=!0,n=o):typeof o=="boolean"&&(e=o);try{s.success||(n(s),t&&mt(s));const r=s.data&&e;return{...s,parsedData:r?JSON.parse(s.data):s.data}}catch(r){throw console.error(r),r}}class Je{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getActions().then(t=>i(t)),this.getById=async e=>(await a(this,V)).getActionById(e).then(n=>i(n)),this.create=async()=>(await a(this,V)).createAction().then(t=>i(t)),this.duplicate=async e=>(await a(this,V)).duplicateAction(e).then(n=>i(n)),this.remove=async e=>(await a(this,V)).removeAction(e).then(n=>i(n)),this.update=async(e,t)=>(await a(this,V)).updateAction(e,JSON.stringify(t)).then(r=>i(r)),this.rename=async(e,t)=>this.update(e,{name:t}),this.updateScript=async(e,t)=>this.update(e,{script:t}),this.updateTriggers=async(e,t)=>this.update(e,{triggers:t}),this.move=async(e,t)=>(await a(this,V)).moveActions(e,t).then(r=>i(r)),this.setTypeError=async(e,t)=>this.update(e,{hasTypeError:t}),this.disable=async()=>(await a(this,V)).disableActions().then(t=>i(t)),this.enable=async()=>(await a(this,V)).enableActions().then(t=>i(t)),this.enableForComponents=async e=>(await a(this,V)).enableComponentActions(e).then(n=>i(n)),y(this,V,o)}}V=new WeakMap;class Ue{constructor(o){g(this,k);this.getAllOnSelectedLayout=async()=>(await a(this,k)).getAnimationsOnSelectedLayout().then(t=>i(t)),this.getByFrameId=async(e,t)=>(await a(this,k)).getAnimationByFrameId(e,t).then(r=>i(r)),this.getByLayoutId=async e=>(await a(this,k)).getAnimationsByLayoutId(e).then(n=>i(n)),this.setFrameAnimation=async e=>(await a(this,k)).setFrameAnimation(JSON.stringify(e)).then(n=>i({...n,data:JSON.stringify(e)})),this.play=async()=>(await a(this,k)).playAnimation().then(t=>i(t)),this.pause=async()=>(await a(this,k)).pauseAnimation().then(t=>i(t)),this.setScrubberPosition=async e=>(await a(this,k)).setScrubberPosition(e).then(n=>i(n)),this.setDuration=async e=>(await a(this,k)).setAnimationDuration(e).then(n=>i(n)),this.resetFrameAnimation=async e=>(await a(this,k)).resetFrameAnimation(e).then(n=>i(n)),this.reset=async()=>(await a(this,k)).resetAnimation().then(t=>i(t)),y(this,k,o)}}k=new WeakMap;var W=(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))(W||{}),Pt=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(Pt||{}),wt=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(wt||{}),Ge=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Ge||{}),_e=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(_e||{}),Q=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(Q||{}),He=(s=>(s.top="top",s.child="child",s))(He||{}),xe=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(xe||{}),$e=(s=>(s.locked="locked",s.range="range",s.none="none",s))($e||{});class je{constructor(o){g(this,K);this.setBarcodeProperties=async(e,t)=>(await a(this,K)).setBarcodeProperties(e,JSON.stringify(t)).then(r=>i(r)),this.setEnableBackground=async(e,t)=>{const n={enableBackground:t};return this.setBarcodeProperties(e,n)},this.setBackgroundColor=async(e,t)=>{const n={backgroundColor:t};return this.setBarcodeProperties(e,n)},this.setEnableBars=async(e,t)=>{const n={enableBars:t};return this.setBarcodeProperties(e,n)},this.setBarColor=async(e,t)=>{const n={barColor:t};return this.setBarcodeProperties(e,n)},this.setBarcodeSource=async(e,t)=>(await a(this,K)).setBarcodeSource(e,JSON.stringify(t)).then(r=>i(r)),this.removeBarcodeSource=async e=>(await a(this,K)).setBarcodeSource(e,null).then(n=>i(n)),this.setEnableText=async(e,t)=>{const n={enableText:t};return this.setBarcodeProperties(e,n)},this.setBarHeight=async(e,t)=>{const n={barHeight:t};return this.setBarcodeProperties(e,n)},this.setMagnification=async(e,t)=>{const n={magnification:t};return this.setBarcodeProperties(e,n)},this.setQuietZoneValue=async(e,t,n)=>{const r=n?{left:n===Q.left?t:void 0,top:n===Q.top?t:void 0,right:n===Q.right?t:void 0,bottom:n===Q.bottom?t:void 0}:{left:t,top:t,right:t,bottom:t};return(await a(this,K)).setBarcodeProperties(e,JSON.stringify({quietZone:r})).then(d=>i(d))},this.setAreQuietZoneValuesCombined=async(e,t)=>{const n={areQuietZoneValuesCombined:t};return(await a(this,K)).setBarcodeProperties(e,JSON.stringify({quietZone:n})).then(c=>i(c))},this.setErrorCorrectionLevel=async(e,t)=>(await a(this,K)).setBarcodeProperties(e,JSON.stringify({errorCorrectionLevel:t})).then(r=>i(r)),this.setCharacterSet=async(e,t)=>(await a(this,K)).setBarcodeProperties(e,JSON.stringify({characterSet:t})).then(r=>i(r)),this.setDrawLightMarginIndicator=async(e,t)=>{const n={drawStartStopChars:t};return this.setBarcodeProperties(e,n)},this.setDrawStartStopChars=async(e,t)=>{const n={drawStartStopChars:t};return this.setBarcodeProperties(e,n)},this.getBarcodeConfigationOptions=e=>{let t=!0,n=!0,r=!0,c,d,l=!1,m=!1,p=!1;switch(e){case W.qr:c=[wt.iso8859_1,wt.utf8],d=[Pt.low,Pt.medium,Pt.quartile,Pt.high];case W.dataMatrix:t=!1,n=!1,r=!1,l=!0;break;case W.ean13:t=!1,m=!0;break;case W.ean8:m=!0;case W.upca:case W.upce:t=!1;break;case W.code128:case W.gs1128:c=[wt.code128a,wt.code128b,wt.code128c];break;case W.code39:p=!0;break}return{allowEnableMagnification:r,allowBarHeight:n,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:d,allowToggleText:t,quietZoneAlwaysCombined:l,allowToggleLightMarginIndicator:m,allowToggleDrawStartAndEndChar:p}},y(this,K,o)}}K=new WeakMap;class ze{constructor(o,e){g(this,O);this.getId=async()=>(await a(this,O)).getBrandKitId().then(n=>i(n)),this.getVersion=async()=>(await a(this,O)).getBrandKitVersion().then(n=>i(n)),this.getName=async()=>(await a(this,O)).getBrandKitName().then(n=>i(n)),this.rename=async t=>(await a(this,O)).renameBrandKit(t).then(r=>i(r)),this.updateIdAndVersion=async(t,n)=>(await a(this,O)).updateBrandKitIdAndVersion(t,n).then(c=>i(c)),this.get=async()=>(await a(this,O)).getBrandKit().then(n=>i(n)),this.getAllMedia=async()=>(await a(this,O)).getAllBrandKitMedia().then(n=>i(n)),this.addMedia=async(t,n,r)=>(await a(this,O)).addBrandKitMedia(t,n,r).then(d=>i(d)),this.updateMedia=async(t,n,r)=>(await a(this,O)).updateBrandKitMedia(t,n,r).then(d=>i(d)),this.renameMedia=async(t,n)=>(await a(this,O)).renameBrandKitMedia(t,n).then(c=>i(c)),this.removeMedia=async t=>(await a(this,O)).removeBrandKitMedia(t).then(r=>i(r)),this.set=async t=>(await a(this,O)).setBrandKit(JSON.stringify(t)).then(r=>i(r)),this.sync=async t=>(await a(this,O)).syncBrandKit(JSON.stringify(t)).then(r=>i(r)),this.isAutoSync=async()=>(await a(this,O)).isBrandKitAutoSync().then(n=>i(n)),this.enableAutoSync=async t=>(await a(this,O)).enableBrandKitAutoSync(t).then(r=>i(r)),this.switchTheme=async t=>(await a(this,O)).switchBrandKitTheme(t).then(r=>i(r)),y(this,O,o),this.sdk=e}}O=new WeakMap;class we{constructor(o){g(this,it);this.zoomToPage=async(e,t,n,r,c)=>(e!==void 0&&console.warn("id has no effect and will be deprecated in the future"),(await a(this,it)).zoomToPage(t,n,r,c).then(l=>i(l))),this.getZoomPercentage=async()=>(await a(this,it)).getZoomPercentage().then(t=>i(t)),this.setZoomPercentage=async e=>(await a(this,it)).setZoomPercentage(e).then(n=>i(n)),this.setViewMode=async e=>(await a(this,it)).setViewMode(e).then(n=>i(n)),y(this,it,o)}}it=new WeakMap;class We{constructor(o){g(this,_);this.getAll=async()=>(await a(this,_)).getCharacterStyles().then(t=>i(t)),this.getById=async e=>(await a(this,_)).getCharacterStyleById(e).then(n=>i(n)),this.create=async()=>(await a(this,_)).createCharacterStyle().then(t=>i(t)),this.update=async(e,t)=>(await a(this,_)).updateCharacterStyle(e,JSON.stringify(t)).then(r=>i(r)),this.remove=async e=>(await a(this,_)).removeCharacterStyle(e).then(n=>i(n)),this.duplicate=async e=>(await a(this,_)).duplicateCharacterStyle(e).then(n=>i(n)),this.rename=async(e,t)=>(await a(this,_)).renameCharacterStyle(e,t).then(r=>i(r)),this.move=async(e,t)=>(await a(this,_)).moveCharacterStyles(e,t).then(r=>i(r)),y(this,_,o)}}_=new WeakMap;class Ke{constructor(o){g(this,ot);this.copyFrames=async e=>{const n=await(await a(this,ot)).copyFrames(e);return n.data&&await navigator.clipboard.writeText(n.data),i(n)},this.cutFrames=async e=>{const n=await(await a(this,ot)).cutFrames(e);return n.data&&await navigator.clipboard.writeText(n.data),i(n)},this.pasteFrames=async()=>{const e=await a(this,ot),t=await navigator.clipboard.readText(),n=await e.pasteFrames(t);return i(n)},this.getContentType=async()=>{const e=await a(this,ot),t=await navigator.clipboard.readText(),n=await e.getClipboardContentType(t);return i(n)},y(this,ot,o)}}ot=new WeakMap;class qe{constructor(o){g(this,Kt);this.convertToRgb=async e=>(await a(this,Kt)).colorToRgb(JSON.stringify(e)).then(n=>i(n)),y(this,Kt,o)}}Kt=new WeakMap;var Ye=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(Ye||{}),ie=(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))(ie||{}),Ze=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(Ze||{});class Qe{constructor(o){g(this,H);this.getAll=async()=>(await a(this,H)).getColors().then(t=>i(t)),this.getById=async e=>(await a(this,H)).getColorById(e).then(n=>i(n)),this.create=async()=>(await a(this,H)).createColor().then(t=>i(t)),this.duplicate=async e=>(await a(this,H)).duplicateColor(e).then(n=>i(n)),this.move=async(e,t)=>(await a(this,H)).moveColors(e,t).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,H)).renameColor(e,t).then(r=>i(r)),this.update=async(e,t)=>{const n=await a(this,H),r=t;return r.type===ie.spot&&(r.type=ie.spotCMYK),n.updateColor(e,JSON.stringify(r)).then(c=>i(c))},this.remove=async e=>(await a(this,H)).removeColor(e).then(n=>i(n)),y(this,H,o)}}H=new WeakMap;var Et=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(Et||{}),oe=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(oe||{}),Ot=(s=>(s.file="file",s.collection="collection",s))(Ot||{}),Xe=(s=>(s.media="media",s.fonts="fonts",s.data="data",s.components="components",s))(Xe||{}),ts=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(ts||{}),es=(s=>(s.ascending="asc",s.descending="desc",s))(es||{}),ss=(s=>(s.text="text",s.boolean="boolean",s.number="number",s))(ss||{}),ns=(s=>(s.query="query",s.upload="upload",s))(ns||{}),Ft=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Ft||{});class Ur{constructor(o,e,t,n="engineToConnector",r){this.direction="engineToConnector",this.name=o,this.direction=n,e==="var"?(this.value=`var.${t}`,this.id=t,this.type="var",this.sourceField=r):(this.value=t,this.type="value")}}var rs=(s=>(s.variable="var",s.value="value",s))(rs||{}),as=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(as||{}),ce=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(ce||{}),is=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(is||{});const Gr={url:"grafx-media.json",source:"local"};class _r{constructor(o,e){this.type="grafxToken",this.token=o,this.headers=e}}class Hr{constructor(o){this.type="refreshed",this.headers=o}}var os=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(os||{}),cs=(s=>(s.grafxToken="grafxToken",s.any="any",s))(cs||{}),Ce=(s=>(s.minDimension="minDimension",s))(Ce||{});class hs extends Error{constructor(o,e){super(o),this.type=e}}var ds=(s=>(s.StaticKey="staticKey",s.OAuth2ClientCredentials="oAuth2ClientCredentials",s.OAuth2AuthorizationCode="oAuth2AuthorizationCode",s.OAuth2ResourceOwnerPassword="oAuth2ResourceOwnerPassword",s.OAuth2JwtBearer="oAuth2JwtBearer",s.None="none",s))(ds||{});class he{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=Ft.grafx||this.isSourceMigrated(o))return o;let e=o.url;for(;e.endsWith("/");)e=e.substring(0,e.length-1);const t=e.split("/");return{id:t[t.length-1],source:Ft.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,e)=>o.map(t=>this.makeSingleConnectorBackwardsCompatible(t,e)),this.makeSingleConnectorBackwardsCompatible=(o,e)=>o.source.source!=Ft.grafx?o:{id:o.id,name:o.name,iconUrl:o.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(o.source,e)},this.makeConnectorSourceBackwardsCompatible=(o,e)=>{let t=e;for(;t!=null&&t.endsWith("/");)t=t.substring(0,t.length-1);return{url:`${t}/connectors/${o.id}`,source:Ft.grafx}},this.isSourceMigrated=o=>"id"in o}}let ls=(Hn=class{constructor(o,e){g(this,J);g(this,Nt);g(this,Ct);this.getById=async t=>(await a(this,J)).getConnectorById(t).then(r=>i(r)).then(r=>{const c={...r,parsedData:null};return r.parsedData&&(c.parsedData=a(this,Ct).makeSingleConnectorBackwardsCompatible(r.parsedData,a(this,Nt).get(Z.GraFxStudioEnvironmentApiUrl))),c}),this.getAllByType=async t=>(await a(this,J)).getConnectors(t).then(r=>i(r)).then(r=>{const c={...r,parsedData:null};return r.parsedData&&(c.parsedData=a(this,Ct).makeMultipleConnectorsBackwardsCompatible(r.parsedData,a(this,Nt).get(Z.GraFxStudioEnvironmentApiUrl))),c}),this.register=async t=>{const n=await a(this,J),r=a(this,Ct).makeConnectorSourceForwardsCompatible(t);return n.registerConnector(JSON.stringify(r)).then(c=>i(c))},this.unregister=async t=>(await a(this,J)).unregisterConnector(t).then(r=>i(r)),this.configure=async(t,n)=>{const r=await a(this,J);return await this.waitToBeReady(t),await n(new xr(t,r)),r.updateConnectorConfiguration(t).then(c=>i(c))},this.getState=async t=>(await a(this,J)).getConnectorState(t).then(r=>i(r)),this.getOptions=async t=>(await a(this,J)).getConnectorOptions(t).then(r=>i(r)),this.waitToBeReady=async(t,n=2e3)=>{let r=Math.max(n,500);r=Math.min(r,5e3);const c=100;let d=0;try{for(;d*c<r;){const l=await this.getState(t);if(l.success&&l.parsedData&&(l.parsedData.type===ce.running||l.parsedData.type===ce.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(m=>setTimeout(m,c)),d++}}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(t,n)=>await this.configure(t,async r=>{const{parsedData:c}=await this.getMappings(t),d=(c==null?void 0:c.filter(p=>!n.some(f=>f.name===p.name&&f.direction===p.direction)))??[],l=n.filter(p=>p.name!==""&&p.value!==""),m=[...d,...l];await r.setMappings(m)}),this.applyMappings=async(t,n)=>await this.configure(t,async r=>{const c=n.filter(d=>d.name!==""&&d.value!=="");await r.setMappings(c)}),this.setHttpHeaders=async(t,n)=>(await a(this,J)).remoteConnectorAuthenticationSetHttpHeaders(t,JSON.stringify(n)).then(c=>i(c)),y(this,J,o),y(this,Nt,e),y(this,Ct,new he)}async getMappings(o,e){return(await a(this,J)).getConnectorMappings(o).then(n=>i(n)).then(n=>{var r;return e?{...n,parsedData:(r=n.parsedData)==null?void 0:r.filter(c=>c.direction===e)}:n})}},J=new WeakMap,Nt=new WeakMap,Ct=new WeakMap,Hn);class xr{constructor(o,e){g(this,ft);g(this,St);this.setOptions=async t=>a(this,St).setConnectorOptions(a(this,ft),JSON.stringify(t)).then(n=>i(n)),this.setMappings=async t=>{const n=await a(this,St).setConnectorMappings(a(this,ft),t.map(function(r){return JSON.stringify(r)}));return i(n)},this.setHttpHeader=async(t,n)=>a(this,St).connectorAuthenticationSetHttpHeader(a(this,ft),t,n).then(r=>i(r)),y(this,ft,o),y(this,St,e)}}ft=new WeakMap,St=new WeakMap;class us{constructor(o,e){g(this,et);g(this,Mt);this.getPageItemById=async(t,n,r,c={})=>{const l=await(await a(this,et)).dataConnectorGetPageItemById(t,n,JSON.stringify(r),JSON.stringify(c)),m=i(l),p={...m,parsedData:null};return m.parsedData&&(p.parsedData={...m.parsedData,data:a(this,Mt).mapEngineToDataItem(m.parsedData.data)}),p},this.getConfigurationOptions=async t=>(await a(this,et)).dataConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,et)).dataConnectorGetCapabilities(t).then(r=>i(r)),y(this,et,o),y(this,Mt,e)}async getPage(o,e,t={}){const{previousPageToken:n,continuationToken:r}=e;if(n!=null&&r!=null)throw new Error('Invalid page config: "previousPageToken" and "continuationToken" are mutually exclusive. Provide only one to indicate navigation direction.');const d=await(await a(this,et)).dataConnectorGetPage(o,JSON.stringify(e),JSON.stringify(t)),l=i(d),m={...l,parsedData:null};return l.parsedData&&(m.parsedData={...l.parsedData,data:l.parsedData.data.map(p=>a(this,Mt).mapEngineToDataItem(p))}),m}async getModel(o,e={}){return(await a(this,et)).dataConnectorGetModel(o,JSON.stringify(e)).then(n=>i(n))}}et=new WeakMap,Mt=new WeakMap;class gs{constructor(o,e){g(this,ct);g(this,qt);this.setDataSource=async t=>(await a(this,ct)).setDataSource(t).then(r=>i(r)),this.getDataSource=async()=>(await a(this,ct)).getDataSource().then(n=>i(n)),this.removeDataSource=async()=>(await a(this,ct)).removeDataSource().then(n=>i(n)),this.setDataRow=async t=>{const n=await a(this,ct),r=a(this,qt).mapDataItemToEngine(t);return n.setDataRow(JSON.stringify(r)).then(c=>i(c))},y(this,ct,o),y(this,qt,e)}}ct=new WeakMap,qt=new WeakMap;class ys{constructor(o){g(this,ht);this.getAllLogs=async()=>(await a(this,ht)).getLogs().then(t=>i(t)),this.toggleDebugPanel=async()=>(await a(this,ht)).toggleDebugPanel().then(t=>i(t)),this.enableDebug=async()=>(await a(this,ht)).enableDebug().then(t=>i(t)),this.disableDebug=async()=>(await a(this,ht)).disableDebug().then(t=>i(t)),y(this,ht,o)}}ht=new WeakMap;class ps{constructor(o){g(this,bt);this.getCurrentState=async()=>(await a(this,bt)).getCurrentDocumentState().then(t=>i(t)),this.load=async(e,t={keepConnectors:!1})=>{const n=await a(this,bt),r=typeof e!="string"?JSON.stringify(e):e;return n.loadDocument(r,JSON.stringify(t)).then(c=>i(c))},this.createAndLoad=async e=>{const t=await a(this,bt),n=JSON.stringify(e);return t.createAndLoadDocument(n).then(r=>i(r))},y(this,bt,o)}}bt=new WeakMap;var ms=(s=>(s.resize="resize",s.scale="scale",s.scaleAndResize="scaleAndResize",s))(ms||{}),ws=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(ws||{}),jt=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(jt||{}),Cs=(s=>(s.connector="connector",s))(Cs||{}),fs=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s.component="component",s.componentGrid="componentGrid",s))(fs||{}),Ss=(s=>(s.variable="variable",s.text="text",s))(Ss||{}),bs=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(bs||{}),Is=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(Is||{}),vs=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(vs||{}),As=(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))(As||{}),Ps=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(Ps||{}),Es=(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))(Es||{}),Os=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(Os||{}),Fs=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(Fs||{}),Ds=(s=>(s.page="page",s.frame="frame",s))(Ds||{}),Ls=(s=>(s.start="start",s.end="end",s.center="center",s))(Ls||{});class $r{constructor(){this.type="page"}}class jr{constructor(o,e){this.type="frame",this.frameId=o,this.edge=e}}var fe=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(fe||{}),Ns=(s=>(s.v1="v1",s.v2="v2",s))(Ns||{});const zr="v2";var Ms=(s=>(s.start="start",s.center="center",s.end="end",s))(Ms||{});class Rs{constructor(o){g(this,x);this.insertImageVariableToFrame=async(e,t)=>{const n=await a(this,x),r={id:t,type:jt.variable};return n.setImageSource(e,JSON.stringify(r)).then(c=>i(c))},this.insertTextVariable=async e=>(await a(this,x)).insertTextVariable(e).then(n=>i(n)),this.enterTextEditMode=async e=>(await a(this,x)).enterTextEditMode(e).then(n=>i(n)),this.exitTextEditMode=async()=>(await a(this,x)).exitTextEditMode().then(t=>i(t)),this.getText=async(e,t)=>(await a(this,x)).getTextByFrameId(e,t).then(r=>i(r)),this.setText=async(e,t)=>(await a(this,x)).setTextByFrameId(e,t).then(r=>i(r)),this.selectText=async(e,t,n)=>(await a(this,x)).selectTextById(e,t,n).then(c=>i(c)),this.addCustomUndoData=async(e,t,n)=>(await a(this,x)).setCustomUndoData(e,t,n??!1).then(c=>i(c)),y(this,x,o)}}x=new WeakMap;class Vs{constructor(o){g(this,dt);g(this,Rt);this.query=async(e,t,n={})=>(await a(this,dt)).fontConnectorQuery(e,JSON.stringify(t),JSON.stringify(n)).then(c=>i(c)),this.detail=async(e,t,n={})=>(await a(this,dt)).fontConnectorDetail(e,t,JSON.stringify(n)).then(c=>i(c)),this.download=async(e,t,n={})=>(await a(this,Rt)).fontConnectorDownload(e,t,JSON.stringify(n)).then(c=>c??c),this.preview=async(e,t,n,r={})=>(await a(this,Rt)).fontConnectorPreview(e,t,n,JSON.stringify(r)).then(d=>d??d),this.getConfigurationOptions=async e=>(await a(this,dt)).fontConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,dt)).fontConnectorGetCapabilities(e).then(n=>i(n)),this.parseDeprecatedFontType=e=>{if(e===Et.file)return Ot.file;if(e===Et.collection)return Ot.collection},y(this,dt,o),y(this,Rt,o)}}dt=new WeakMap,Rt=new WeakMap;class ks{constructor(o){g(this,D);this.addFontFamily=async(e,t)=>(await a(this,D)).addFontFamily(e,JSON.stringify(t)).then(r=>i(r)),this.removeFontFamily=async e=>(await a(this,D)).removeFontFamily(e).then(n=>i(n)),this.addFontStyle=async(e,t)=>(await a(this,D)).addFontStyle(e,JSON.stringify(t)).then(r=>i(r)),this.removeFontStyle=async e=>(await a(this,D)).removeFontStyle(e).then(n=>i(n)),this.getFontFamilies=async()=>(await a(this,D)).getFontFamilies().then(t=>i(t)),this.getFontStyles=async e=>(await a(this,D)).getFontStyles(e).then(n=>i(n)),this.getFontFamilyById=async e=>(await a(this,D)).getFontFamilyById(e).then(n=>i(n)),this.getFontStyleById=async e=>(await a(this,D)).getFontStyleById(e).then(n=>i(n)),this.getDefaultFontStyle=async()=>(await a(this,D)).getDefaultFontStyle().then(t=>i(t)),this.getDefaultFontFamily=async()=>(await a(this,D)).getDefaultFontFamily().then(t=>i(t)),this.isFontFamilyUsed=async e=>(await a(this,D)).isFontFamilyUsed(e).then(n=>i(n)),this.isFontStyleUsed=async e=>(await a(this,D)).isFontStyleUsed(e).then(n=>i(n)),this.moveFontFamilies=async(e,t)=>(await a(this,D)).moveFontFamilies(e,t).then(r=>i(r)),this.getPreviewsOfCharacterStrings=async(e,t)=>(await a(this,D)).getPreviewsOfCharacterStrings(e,JSON.stringify(t)).then(r=>i(r)),y(this,D,o)}}D=new WeakMap;class Se{constructor(o){g(this,Vt);this.setShapeProperties=async(e,t)=>(await a(this,Vt)).setShapeProperties(e,JSON.stringify(t)).then(r=>i(r)),this.setEnableFill=async(e,t)=>{const n={enableFill:t};return this.setShapeProperties(e,n)},this.setFillColor=async(e,t)=>{const n={fillColor:t};return this.setShapeProperties(e,n)},this.setEnableStroke=async(e,t)=>{const n={enableStroke:t};return this.setShapeProperties(e,n)},this.setStrokeColor=async(e,t)=>{const n={strokeColor:t};return this.setShapeProperties(e,n)},this.setStrokeWeight=async(e,t)=>{const n={strokeWeight:t};return this.setShapeProperties(e,n)},this.setFlagAllCornersSame=async(e,t)=>{const n={allCornersSame:t};return this.setShapeProperties(e,n)},this.setShapeCorners=async(e,t)=>(await a(this,Vt)).setShapeCorners(e,JSON.stringify(t)).then(r=>i(r)),this.setRadiusAll=async(e,t)=>{const n={radiusAll:t};return this.setShapeCorners(e,n)},this.setRadiusTopLeft=async(e,t)=>{const n={topLeft:t};return this.setShapeCorners(e,n)},this.setRadiusBottomLeft=async(e,t)=>{const n={bottomLeft:t};return this.setShapeCorners(e,n)},this.setRadiusTopRight=async(e,t)=>{const n={topRight:t};return this.setShapeCorners(e,n)},this.setRadiusBottomRight=async(e,t)=>{const n={bottomRight:t};return this.setShapeCorners(e,n)},y(this,Vt,o)}}Vt=new WeakMap;class Ts{constructor(o){g(this,u);this.getAll=async()=>(await a(this,u)).getFrames().then(t=>i(t)),this.getSelected=async()=>(await a(this,u)).getSelectedFrames().then(t=>i(t)),this.getAllByPageId=async e=>(await a(this,u)).getFramesByPageId(e).then(n=>i(n)),this.getByName=async e=>(await a(this,u)).getFrameByName(e).then(n=>i(n)),this.getById=async e=>(await a(this,u)).getFrameById(e).then(n=>i(n)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,u)).getFramePropertiesOnSelectedLayout().then(t=>i(t)),this.getLayoutProperties=async(e,t)=>(await a(this,u)).getFramePropertiesByFrameId(e,t).then(r=>i(r)),this.getAllLayoutProperties=async e=>(await a(this,u)).getFramesProperties(e).then(n=>i(n)),this.resetTransformation=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetSize=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.select=async e=>(await a(this,u)).selectFrames([e]).then(n=>i(n)),this.selectMultiple=async e=>(await a(this,u)).selectFrames(e).then(n=>i(n)),this.deselectAll=async()=>(await a(this,u)).deselectFrames().then(t=>i(t)),this.reorderFrames=async(e,t)=>(await a(this,u)).reorderFrames(e,t).then(r=>i(r)),this.setZIndex=async(e,t)=>(await a(this,u)).setFrameZIndex(e,t).then(r=>i(r)),this.setHeight=async(e,t)=>(await a(this,u)).setFrameHeight(e,t).then(r=>i(r)),this.setRotation=async(e,t)=>(await a(this,u)).setFrameRotation(e,t).then(r=>i(r)),this.setWidth=async(e,t)=>(await a(this,u)).setFrameWidth(e,t).then(r=>i(r)),this.setX=async(e,t)=>(await a(this,u)).setFrameX(e,t).then(r=>i(r)),this.setY=async(e,t)=>(await a(this,u)).setFrameY(e,t).then(r=>i(r)),this.setOpacity=async(e,t)=>(await a(this,u)).setFrameOpacity(e,t).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,u)).renameFrame(e,t).then(r=>i(r)),this.reset=async e=>(await a(this,u)).resetFrame(e).then(n=>i(n)),this.resetX=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetY=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetRotation=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetWidth=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetHeight=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetImageFrameFitMode=async e=>(await a(this,u)).resetImageFrameFitMode(e).then(n=>i(n)),this.setVisibility=async(e,t)=>(await a(this,u)).setFrameIsVisible(e,t).then(r=>i(r)),this.setIsVisible=async(e,t)=>(await a(this,u)).setFrameIsVisible(e,t).then(r=>i(r)),this.remove=async e=>(await a(this,u)).removeFrames([e]).then(n=>i(n)),this.removeFrames=async e=>(await a(this,u)).removeFrames(e).then(n=>i(n)),this.create=async(e,t,n,r,c)=>(await a(this,u)).addFrame(e,t,n,r,c).then(l=>i(l)),this.createShapeFrame=async(e,t,n,r,c)=>(await a(this,u)).addFrame(e,t,n,r,c).then(l=>i(l)),this.createBarcodeFrame=async(e,t)=>(await a(this,u)).addBarcodeFrame(e,t==null?void 0:t.x,t==null?void 0:t.y).then(r=>i(r)),this.createComponentFrame=async(e,t,n,r,c)=>(await a(this,u)).addComponentFrame(t,n,r,c,JSON.stringify(e)).then(l=>i(l)),this.duplicateFrames=async e=>(await a(this,u)).duplicateFrames(e).then(n=>i(n)),this.updateImageSource=async(e,t)=>{const n=await a(this,u),r=t!==null?JSON.stringify(t):null;return n.setImageSource(e,r).then(c=>i(c))},this.removeImageSource=async e=>this.updateImageSource(e,null),this.setImageFromConnector=async(e,t,n)=>{const r={id:t,assetId:n,type:jt.connector};return this.updateImageSource(e,r)},this.setImageFromUrl=async(e,t)=>{const n={url:t,type:jt.url};return this.updateImageSource(e,n)},this.setImageFrameFitMode=async(e,t)=>(await a(this,u)).setImageFrameFitMode(e,t).then(r=>i(r)),this.setImageFrameFitModePosition=async(e,t)=>(await a(this,u)).setImageFrameFitModePosition(e,t).then(r=>i(r)),this.setImageFrameSmartCropSettings=async(e,t)=>(await a(this,u)).setImageFrameSmartCropSettings(e,JSON.stringify(t)).then(r=>i(r)),this.setFrameConstrainProportions=async(e,t)=>(console.error("setFrameConstrainProportions is not supported anymore"),i({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(e,t)=>(await a(this,u)).setVerticalAlignment(e,t).then(r=>i(r)),this.setNumberOfColumns=async(e,t)=>(await a(this,u)).setNumberOfColumns(e,t).then(r=>i(r)),this.setColumnGap=async(e,t)=>(await a(this,u)).setColumnGap(e,t).then(r=>i(r)),this.setMinCopyfitting=async(e,t)=>(await a(this,u)).setMinCopyfitting(e,t).then(r=>i(r)),this.setMaxCopyfitting=async(e,t)=>(await a(this,u)).setMaxCopyfitting(e,t).then(r=>i(r)),this.setEnableCopyfitting=async(e,t)=>(await a(this,u)).setEnableCopyfitting(e,t).then(r=>i(r)),this.resetMinCopyfitting=async e=>(await a(this,u)).resetMinCopyfitting(e).then(n=>i(n)),this.resetMaxCopyfitting=async e=>(await a(this,u)).resetMaxCopyfitting(e).then(n=>i(n)),this.resetEnableCopyfitting=async e=>(await a(this,u)).resetEnableCopyfitting(e).then(n=>i(n)),this.setShapeFrameEnableFill=async(e,t)=>this.shapeController.setEnableFill(e,t),this.setShapeFrameFillColor=async(e,t)=>this.shapeController.setFillColor(e,t),this.setShapeFrameEnableStroke=async(e,t)=>this.shapeController.setEnableStroke(e,t),this.setShapeFrameStrokeColor=async(e,t)=>this.shapeController.setStrokeColor(e,t),this.setShapeFrameStrokeWeight=async(e,t)=>this.shapeController.setStrokeWeight(e,t),this.setFillOverprint=async(e,t)=>(await a(this,u)).setFrameFillOverprint(e,t).then(r=>i(r)),this.setStrokeOverprint=async(e,t)=>(await a(this,u)).setFrameStrokeOverprint(e,t).then(r=>i(r)),this.setBlendMode=async(e,t)=>(await a(this,u)).setFrameBlendMode(e,t).then(r=>i(r)),this.setFrameContainerShape=async(e,t)=>(await a(this,u)).setFrameContainerShape(e,JSON.stringify(t)).then(r=>i(r)),this.enterCropMode=async(e,t=fe.frameCrop)=>(await a(this,u)).enterCropMode(e,t).then(r=>i(r)),this.applyCropMode=async()=>(await a(this,u)).applyCropMode().then(t=>i(t)),this.exitCropMode=async()=>(await a(this,u)).cancelCropMode().then(t=>i(t)),this.enterSubjectMode=async e=>(await a(this,u)).enterSubjectMode(e).then(n=>i(n)),this.applySubjectMode=async()=>(await a(this,u)).applySubjectMode().then(t=>i(t)),this.exitSubjectMode=async()=>(await a(this,u)).cancelSubjectMode().then(t=>i(t)),this.enterGradientMode=async e=>(await a(this,u)).enterGradientMode(e).then(n=>i(n)),this.applyGradientMode=async()=>(await a(this,u)).applyGradientMode().then(t=>i(t)),this.cancelGradientMode=async()=>(await a(this,u)).cancelGradientMode().then(t=>i(t)),this.resetCropMode=async e=>(console.error("resetCropMode is not supported anymore"),i({success:!1,status:0,error:"resetCropMode is not supported anymore",parsedData:null})),this.setEnableAutoGrow=async(e,t)=>{const n={enabled:{value:t}};return(await a(this,u)).updateAutoGrowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setAutoGrowMinWidth=async(e,t)=>{const n={minWidth:{value:t}};return(await a(this,u)).updateAutoGrowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setAutoGrowMaxWidth=async(e,t)=>{const n={maxWidth:{value:t}};return(await a(this,u)).updateAutoGrowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setAutoGrowMinHeight=async(e,t)=>{const n={minHeight:{value:t}};return(await a(this,u)).updateAutoGrowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setAutoGrowMaxHeight=async(e,t)=>{const n={maxHeight:{value:t}};return(await a(this,u)).updateAutoGrowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setAutoGrowDirections=async(e,t)=>{const n={directions:{value:t}};return(await a(this,u)).updateAutoGrowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.resetAutoGrowSettingsEnabled=async e=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async e=>(console.error("resetAutoGrowMinWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async e=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async e=>(console.error("resetAutoGrowMinHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async e=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async e=>(console.error("resetAutoGrowDirections is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async e=>(console.error("resetAutoGrow is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setShadowEnabled=async(e,t)=>{const n={enabled:{value:t}};return(await a(this,u)).updateFrameShadowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setShadowDistance=async(e,t)=>{const n={distance:{value:t}};return(await a(this,u)).updateFrameShadowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setShadowAngleDegrees=async(e,t)=>{const n={angleDegrees:{value:t}};return(await a(this,u)).updateFrameShadowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setShadowBlurRadius=async(e,t)=>{const n={blurRadius:{value:t}};return(await a(this,u)).updateFrameShadowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setShadowColor=async(e,t)=>{const n={color:{value:t}};return(await a(this,u)).updateFrameShadowSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setAnchor=async(e,t,n,r,c)=>{const d={horizontal:t,type:n,target:r,endTarget:c};return(await a(this,u)).setAnchorProperties(e,JSON.stringify(d)).then(m=>i(m))},this.setVerticalAnchor=async(e,t,n,r)=>this.setAnchor(e,!1,t,n,r),this.setHorizontalAnchor=async(e,t,n,r)=>this.setAnchor(e,!0,t,n,r),this.resetAnchoring=async e=>(await a(this,u)).resetFrameTransformation(e).then(n=>i(n)),this.resetVisibility=async e=>(await a(this,u)).setFrameIsVisible(e,null).then(n=>i(n)),this.getConfiguration=async e=>(await a(this,u)).getFrameConfiguration(e).then(n=>i(n)),this.resetAssetCropOverride=async e=>(await a(this,u)).resetAssetCropOverride(e).then(n=>i(n)),this.resetAllAssetCropOverrides=async e=>(await a(this,u)).resetAllAssetCropOverrides(e).then(n=>i(n)),this.setGradientApplied=async(e,t)=>{const n={isApplied:t};return(await a(this,u)).updateFrameGradientSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setLocalGradient=async(e,t)=>{const n={gradient:t};return(await a(this,u)).updateFrameGradientSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setBrandKitGradient=async(e,t)=>{const n={id:t};return(await a(this,u)).updateFrameGradientSettings(e,JSON.stringify(n)).then(c=>i(c))},this.setSmartCropSubjectId=async(e,t)=>(await a(this,u)).setSmartCropSubjectId(e,t).then(r=>i(r)),y(this,u,o),this.shapeController=new Se(a(this,u)),this.constraints=new Wr(a(this,u))}}u=new WeakMap;class Wr{constructor(o){g(this,N);this.get=async e=>(await a(this,N)).getFrameConstraints(e).then(n=>i(n)),this.setSelectable=async(e,t)=>{const n={selectionAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setHorizontalMovement=async(e,t)=>{const n={horizontalMovementAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setVerticalMovement=async(e,t)=>{const n={verticalMovementAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setRotation=async(e,t)=>{const n={rotationAllowed:{value:t}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setResize=async(e,t,n)=>{const r={resizeAllowed:{value:t},...n!==void 0&&{proportionLocked:{value:n}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(r)).then(d=>i(d))},this.setCrop=async(e,t)=>{const n={image:{cropAllowed:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setTextEditingAllowed=async(e,t)=>{const n={text:{editingAllowed:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setAllowedParagraphStyles=async(e,t)=>{const n={text:{paragraphStyles:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setAllowedCharacterStyles=async(e,t)=>{const n={text:{characterStyles:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setAllowedColors=async(e,t)=>{const n={text:{colors:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},this.setAllowedFontSizes=async(e,t)=>{const n={text:{fontSizes:{value:t}}};return(await a(this,N)).updateFrameConstraints(e,JSON.stringify(n)).then(c=>i(c))},y(this,N,o)}}N=new WeakMap;class Bs{constructor(){this.currentEngineVersion=T.current,this.currentSDKVersion=Oe.version}}class Js{constructor(o){g(this,S);g(this,Yt);this.getAll=async()=>(await a(this,S)).getLayouts().then(t=>i(t)),this.getById=async e=>(await a(this,S)).getLayoutById(e).then(n=>i(n)),this.getByName=async e=>(await a(this,S)).getLayoutByName(e).then(n=>i(n)),this.getSelected=async()=>(await a(this,S)).getSelectedLayout().then(t=>i(t)),this.remove=async e=>(await a(this,S)).removeLayout(e).then(n=>i(n)),this.create=async(e,t)=>{const n=await a(this,S);return t!=null&&t.length?n.addLayouts(e,JSON.stringify(t)).then(r=>i(r)):n.addLayout(e).then(r=>i(r))},this.rename=async(e,t)=>(await a(this,S)).renameLayout(e,t).then(r=>i(r)),this.select=async e=>(await a(this,S)).selectLayoutWithOptions(e,null).then(n=>i(n)),this.selectWithPageSize=async(e,t)=>{const n=await a(this,S),r={pageSize:t};return n.selectLayoutWithOptions(e,JSON.stringify(r)).then(c=>i(c))},this.duplicate=async e=>(await a(this,S)).duplicateLayout(e).then(n=>i(n)),this.reset=async e=>(await a(this,S)).resetLayout(e).then(n=>i(n)),this.setHeight=async(e,t)=>(await a(this,S)).setLayoutHeight(e,t).then(r=>i(r)),this.setWidth=async(e,t)=>(await a(this,S)).setLayoutWidth(e,t).then(r=>i(r)),this.setUnit=async(e,t)=>(await a(this,S)).setLayoutUnit(e,t).then(r=>i(r)),this.resetHeight=async e=>(await a(this,S)).resetLayoutHeight(e).then(n=>i(n)),this.resetWidth=async e=>(await a(this,S)).resetLayoutWidth(e).then(n=>i(n)),this.resetUnit=async e=>(await a(this,S)).resetLayoutUnit(e).then(n=>i(n)),this.getSelectedSnapshot=async()=>(await a(this,Yt)).getPageSnapshot().then(t=>t??t),this.setIntent=async(e,t)=>(await a(this,S)).setLayoutIntent(e,t).then(r=>i(r)),this.resetIntent=async e=>(await a(this,S)).resetLayoutIntent(e).then(n=>i(n)),this.setFillColor=async(e,t)=>(await a(this,S)).setLayoutFillColor(e,JSON.stringify(t)).then(r=>i(r)),this.setFillColorEnabled=async(e,t)=>(await a(this,S)).setLayoutFillColorEnabled(e,t).then(r=>i(r)),this.resetFillColor=async e=>(await a(this,S)).resetLayoutFillColor(e).then(n=>i(n)),this.setBleedValue=async(e,t,n)=>{const r=n?{left:n===Q.left?t:void 0,top:n===Q.top?t:void 0,right:n===Q.right?t:void 0,bottom:n===Q.bottom?t:void 0}:{left:t,top:t,right:t,bottom:t};return(await a(this,S)).updateLayoutBleed(e,JSON.stringify(r)).then(d=>i(d))},this.setAreBleedValuesCombined=async(e,t)=>{const n={areBleedValuesCombined:t};return(await a(this,S)).updateLayoutBleed(e,JSON.stringify(n)).then(c=>i(c))},this.resetBleedValues=async e=>(await a(this,S)).updateLayoutBleed(e,null).then(n=>i(n)),this.setPrivateData=async(e,t)=>(await a(this,S)).setLayoutPrivateData(e,JSON.stringify(t)).then(r=>i(r)),this.getPrivateData=async e=>(await a(this,S)).getLayoutPrivateData(e).then(n=>i(n)),this.setDisplayName=async(e,t)=>(await a(this,S)).setLayoutDisplayName(e,t).then(r=>i(r)),this.getDisplayName=async e=>(await a(this,S)).getLayoutDisplayName(e).then(n=>i(n)),this.resetDisplayName=async e=>(await a(this,S)).setLayoutDisplayName(e,null).then(n=>i(n)),this.setAvailableForUser=async(e,t)=>(await a(this,S)).setLayoutAvailableForUser(e,t).then(r=>i(r)),this.setSelectedByUser=async(e,t)=>(await a(this,S)).setLayoutSelectedByUser(e,t).then(r=>i(r)),this.setResizableByUser=async(e,t)=>(await a(this,S)).setLayoutResizableByUser(e,JSON.stringify(t)).then(r=>i(r)),y(this,S,o),y(this,Yt,o)}}S=new WeakMap,Yt=new WeakMap;var de=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(de||{}),be=(s=>(s.web="web",s.print="print",s.animation="animation",s))(be||{});class Us{constructor(o){g(this,st);g(this,Zt);this.query=async(e,t,n={})=>(await a(this,st)).mediaConnectorQuery(e,JSON.stringify(t),JSON.stringify(n)).then(c=>i(c)),this.detail=async(e,t,n={})=>(await a(this,st)).mediaConnectorDetail(e,t,JSON.stringify(n)).then(c=>i(c)),this.download=async(e,t,n,r={})=>{const c=this.parseDeprecatedMediaDownloadType(n);return(await a(this,Zt)).mediaConnectorDownload(e,t,c,be.web,JSON.stringify(r)).then(l=>{if(l instanceof Uint8Array)return l;throw typeof l=="object"&&l!==null&&"success"in l&&!l.success&&mt(l),new Error(`Unexpected response type: ${typeof l}.`)})},this.getConfigurationOptions=async e=>(await a(this,st)).mediaConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,st)).mediaConnectorGetCapabilities(e).then(n=>i(n)),this.parseDeprecatedMediaType=e=>{if(e===Et.file)return Ot.file;if(e===Et.collection)return Ot.collection},this.upload=async(e,t,n={})=>(await a(this,st)).mediaConnectorUpload(e,JSON.stringify(t),JSON.stringify(n)).then(c=>i(c)),y(this,st,o),y(this,Zt,o)}parseDeprecatedMediaDownloadType(o){switch(o){case oe.HighResolutionWeb:return de.highres;case oe.LowResolutionWeb:return de.thumbnail;default:return o}}}st=new WeakMap,Zt=new WeakMap;let Gs=(xn=class{constructor(o){g(this,R);g(this,Qt);this.add=async()=>(await a(this,R)).addPage().then(t=>i(t)),this.remove=async e=>(await a(this,R)).removePage(e).then(n=>i(n)),this.select=async e=>(await a(this,R)).selectPage(e).then(n=>i(n)),this.setVisibility=async(e,t)=>(await a(this,R)).setPageIsVisible(e,t).then(r=>i(r)),this.duplicate=async e=>(await a(this,R)).duplicatePage(e).then(n=>i(n)),this.getAll=async()=>(await a(this,R)).getPages().then(t=>i(t)),this.getById=async e=>(await a(this,R)).getPageById(e).then(n=>i(n)),this.getSnapshot=async(e,t)=>(await a(this,Qt)).getPageSnapshotWithSettings(e,t==null?null:JSON.stringify(t)).then(r=>{if(r instanceof Uint8Array)return r;throw typeof r=="object"&&r!==null&&"success"in r&&!r.success&&mt(r),new Error(`Unexpected response type: ${typeof r}.`)}),this.setWidth=async(e,t)=>(e!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,R)).setPageWidth(t).then(r=>i(r))),this.setHeight=async(e,t)=>(e!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,R)).setPageHeight(t).then(r=>i(r))),this.setSize=async(e,t)=>(await a(this,R)).setPageSize(e,t).then(r=>i(r)),this.move=async(e,t)=>(await a(this,R)).reorderPages(e,t).then(r=>i(r)),y(this,R,o),y(this,Qt,o)}},R=new WeakMap,Qt=new WeakMap,xn);class _s{constructor(o){g(this,$);this.getAll=async()=>(await a(this,$)).getParagraphStyles().then(t=>i(t)),this.getById=async e=>(await a(this,$)).getParagraphStyleById(e).then(n=>i(n)),this.create=async()=>(await a(this,$)).createParagraphStyle().then(t=>i(t)),this.duplicate=async e=>(await a(this,$)).duplicateParagraphStyle(e).then(n=>i(n)),this.update=async(e,t)=>(await a(this,$)).updateParagraphStyle(e,JSON.stringify(t)).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,$)).renameParagraphStyle(e,t).then(r=>i(r)),this.remove=async e=>(await a(this,$)).removeParagraphStyle(e).then(n=>i(n)),this.move=async(e,t)=>(await a(this,$)).moveParagraphStyles(e,t).then(r=>i(r)),y(this,$,o)}}$=new WeakMap;var zt=(s=>(s.shortText="shortText",s.longText="longText",s.richText="richText",s.image="image",s.list="list",s.boolean="boolean",s.group="group",s.number="number",s.date="date",s.dataSource="dataSource",s))(zt||{}),Hs=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Hs||{}),xs=(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))(xs||{}),Dt=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Dt||{}),$s=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))($s||{}),js=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(js||{}),Ie=(s=>(s.injected="injected",s.connector="connector",s))(Ie||{}),zs=(s=>(s.table="table",s.list="list",s))(zs||{});let Kr=class{constructor(o,e){this.onActionsChanged=t=>{this.config.events.onActionsChanged.trigger(JSON.parse(t))},this.onAnimationChanged=t=>{this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(t))},this.onAnimationPlaybackChanged=t=>{this.config.events.onScrubberPositionChanged.trigger(JSON.parse(t))},this.onSelectedLayoutPropertiesChanged=t=>{this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(t))},this.onSelectedLayoutUnitChanged=t=>{this.config.events.onSelectedLayoutUnitChanged.trigger(t)},this.onFramesLayoutChanged=t=>{const n=JSON.parse(t);this.config.events.onFramesLayoutChanged.trigger(n)},this.onSelectedFramesLayoutChanged=t=>{const n=JSON.parse(t);this.config.events.onSelectedFramesLayoutChanged.trigger(n);const r=this.config.onSelectedFrameLayoutChanged;r&&r(n.length>1?void 0:n[0])},this.onSelectedFramesContentChanged=t=>{const n=JSON.parse(t);this.config.events.onSelectedFramesContentChanged.trigger(n);const r=this.config.onSelectedFrameContentChanged;r&&r(n.length>1?null:n[0])},this.onStateChanged=()=>{this.config.events.onStateChanged.trigger()},this.onAuthExpired=async t=>{const n=await this.config.handlers.onAuthExpired.trigger(JSON.parse(t));return n!=null?JSON.stringify(n):null},this.onViewportRequested=()=>{const t=this.config.handlers.onViewportRequested.trigger();return t!=null?JSON.stringify(t):null},this.onDocumentLoaded=()=>{this.config.events.onDocumentLoaded.trigger()},this.onPageSelectionChanged=t=>{this.config.events.onPageSelectionChanged.trigger(t)},this.onVariableListChanged=t=>{const r=JSON.parse(t).map(c=>{var d;return c.type===zt.list?{...c,items:c.items.map(l=>l.value),selected:(d=c.selected)==null?void 0:d.value}:c});this.config.events.onVariableListChanged.trigger(r)},this.onSelectedToolChanged=t=>{this.config.events.onSelectedToolChanged.trigger(t)},this.onUndoStateChanged=t=>{this.config.events.onUndoStackStateChanged.trigger(JSON.parse(t))},this.onCustomUndoDataChanged=t=>{this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(t))},this.onSelectedLayoutFramesChanged=t=>{this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(t))},this.onSelectedTextStyleChanged=t=>{this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(t))},this.onColorsChanged=t=>{this.config.events.onColorsChanged.trigger(JSON.parse(t))},this.onParagraphStylesChanged=t=>{this.config.events.onParagraphStylesChanged.trigger(JSON.parse(t))},this.onCharacterStylesChanged=t=>{this.config.events.onCharacterStylesChanged.trigger(JSON.parse(t))},this.onFontFamiliesChanged=t=>{this.config.events.onFontFamiliesChanged.trigger(JSON.parse(t))},this.onSelectedLayoutIdChanged=t=>{this.config.events.onSelectedLayoutIdChanged.trigger(t)},this.onLayoutsChanged=t=>{this.config.events.onLayoutsChanged.trigger(JSON.parse(t))},this.onZoomChanged=t=>{this.config.events.onZoomChanged.trigger(JSON.parse(t))},this.onConnectorEvent=t=>{this.config.events.onConnectorEvent.trigger(JSON.parse(t))},this.onConnectorsChanged=t=>{const r=new he().makeMultipleConnectorsBackwardsCompatible(JSON.parse(t),this.localConfig.get(Z.GraFxStudioEnvironmentApiUrl));this.config.events.onConnectorsChanged.trigger(r)},this.onSelectedPageIdChanged=t=>{this.config.events.onSelectedPageIdChanged.trigger(t)},this.onPagesChanged=t=>{this.config.events.onPagesChanged.trigger(JSON.parse(t))},this.onPageSnapshotInvalidated=t=>{this.config.events.onPageSnapshotInvalidated.trigger(t)},this.onPageSizeChanged=t=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(t))},this.onShapeCornerRadiusChanged=t=>{this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(t))},this.onCropActiveFrameIdChanged=t=>{this.config.events.onCropActiveFrameIdChanged.trigger(t)},this.onAsyncError=t=>{const n=JSON.parse(t);if((n==null?void 0:n.type)==="dataRow"){const r=new ke(n.count,n.message,n.exceptions);this.config.events.onAsyncError.trigger(r)}else if((n==null?void 0:n.type)==="action"){const r=new Ve(n.message,n.id,n.event,n.eventChain);this.config.events.onAsyncError.trigger(r)}else this.config.events.onAsyncError.trigger(n)},this.onViewModeChanged=t=>{this.config.events.onViewModeChanged.trigger(t)},this.onBarcodeValidationChanged=t=>{this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(t))},this.onDataSourceIdChanged=t=>{this.config.events.onDataSourceIdChanged.trigger(t)},this.onInjectedDataChanged=t=>{this.config.events.onInjectedDataChanged.trigger(t)},this.onDocumentIssueListChanged=t=>{this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(t))},this.onEngineEditModeChanged=t=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(t))},this.onBrandKitMediaChanged=t=>{this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(t))},this.onCanvasFramesManipulated=t=>{this.config.events.onCanvasFramesManipulated.trigger(JSON.parse(t))},this.config=o,this.localConfig=e}};class Ws{constructor(o){g(this,It);this.set=async e=>(await a(this,It)).selectedTextStyleDeltaUpdate(JSON.stringify(e)).then(n=>i(n)),this.removeSelected=async()=>(await a(this,It)).selectedTextStyleClean().then(t=>i(t)),this.getSelected=async()=>(await a(this,It)).getSelectedTextStyle().then(t=>i(t)),y(this,It,o)}}It=new WeakMap;var Ks=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Ks||{}),qs=(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))(qs||{}),G=(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.COMPONENT_GRID_FRAME="componentGridFrame",s))(G||{}),Ys=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s.HTML="html",s))(Ys||{}),le=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(le||{});class Zs{constructor(o){g(this,kt);this.setTool=async e=>(await a(this,kt)).setTool(e).then(n=>i(n)),this.getSelected=async()=>(await a(this,kt)).getSelectedTool().then(t=>i(t)),this.setPointer=async()=>this.setTool(G.SELECT),this.setSelect=async()=>this.setTool(G.SELECT),this.setHand=async()=>this.setTool(G.HAND),this.setZoom=async()=>this.setTool(G.ZOOM),this.setTextFrame=async()=>this.setTool(G.TEXT_FRAME),this.setImageFrame=async()=>this.setTool(G.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool(G.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool(G.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool(G.SHAPE_POLYGON),this.setComponentGrid=async()=>this.setTool(G.COMPONENT_GRID_FRAME),y(this,kt,o)}}kt=new WeakMap;class Qs{constructor(o,e){g(this,X);g(this,q);g(this,Xt);this.undo=async()=>(await a(this,X)).undo().then(n=>i(n)),this.redo=async()=>(await a(this,X)).redo().then(n=>i(n)),this.addCustomData=async(t,n)=>(await a(this,X)).setCustomUndoData(t,n,!1).then(c=>i(c)),this.record=async(t,n)=>{try{await a(this,q).beginIfNoneActive(t),await n(a(this,Xt)),await a(this,q).end()}catch(r){throw await a(this,q).abort(),r}},this.pause=async()=>(await a(this,X)).pause().then(n=>i(n)),this.resume=async()=>(await a(this,X)).resume().then(n=>i(n)),this.clear=async()=>(await a(this,X)).clear().then(n=>i(n)),this.advanced={begin:async t=>a(this,q).begin(t),beginIfNoneActive:async t=>a(this,q).beginIfNoneActive(t),end:async()=>a(this,q).end(),abort:async()=>a(this,q).abort()},y(this,X,o),y(this,Xt,e),y(this,q,new qr(o))}}X=new WeakMap,q=new WeakMap,Xt=new WeakMap;class qr{constructor(o){g(this,lt);this.begin=async e=>(await a(this,lt)).begin(e).then(n=>i(n)),this.beginIfNoneActive=async e=>(await a(this,lt)).beginIfNoneActive(e).then(n=>i(n)),this.end=async()=>(await a(this,lt)).end().then(t=>i(t)),this.abort=async()=>(await a(this,lt)).abort().then(t=>i(t)),y(this,lt,o)}}lt=new WeakMap;var B=(s=>(s.info="info",s.warn="warn",s.error="error",s))(B||{}),ue=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s.sdk="sdk",s))(ue||{}),Lt=(s=>(s.throw="throw",s.log="log",s))(Lt||{});class Xs extends Error{constructor(o){super(o)}}const Yr=(s,o=2)=>{const e=Math.pow(10,o);return Math.round(s*e)/e};class tn{constructor(o,e){g(this,Tt);g(this,te);this.round=(t,n)=>i({data:String(Yr(t,n)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=t=>{const{type:n=le.SANDBOX,environment:r="ft-nostress",version:c="1"}=t,d=n==le.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${r}.${d}.online/grafx/api/v${c}/environment/${r}`},this.stageFiles=async(t,n,r)=>{var A;const c=a(this,te).get(Z.GraFxStudioEnvironmentApiUrl);if(!c)throw new Error("GraFx Studio Environment API URL is not set");const d=`${c}connectors/${n}/stage`,m=await(await a(this,Tt)).getConfigValue(Z.GraFxStudioAuthToken),p=(A=i(m))==null?void 0:A.parsedData;if(!p)throw new Error("GraFx Studio Auth Token is not set");const f=new FormData;t.forEach((v,E)=>{const F=v instanceof File?v.name:`blob-${E}`;f.append("files",v,F)}),r&&f.append("validationJson",JSON.stringify({allowedMimeTypes:r.mimeTypes,minDimensions:{width:r.minWidthPixels,height:r.minHeightPixels}}));const b=await fetch(d,{method:"POST",body:f,headers:{Authorization:`Bearer ${p}`}});if(b.status===422){const v=await b.json();throw new hs(v.message,Ce.minDimension)}if(b.status===401){const v=await b.json();throw new Xs(v.message)}if(!b.ok)throw new Error("Failed to stage files");return await b.json()},this.unitEvaluate=async(t,n)=>(await a(this,Tt)).unitEvaluate(t,n).then(c=>i(c)),y(this,Tt,o),y(this,te,e)}}Tt=new WeakMap,te=new WeakMap;const Zr=s=>s.type===zt.dataSource,Qr=s=>{var o;return s?Zr(s)&&((o=s==null?void 0:s.value)==null?void 0:o.type)===Ie.injected:!1};class Xr{constructor(o){g(this,ee);this.setMinimum=async(e,t)=>{const n={minValue:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setMaximum=async(e,t)=>{const n={maxValue:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setShowStepper=async(e,t)=>{const n={showStepper:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setStepSize=async(e,t)=>{const n={stepSize:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setThousandsSeparator=async(e,t)=>{const n={thousandsSeparator:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setDecimalSeparator=async(e,t)=>{const n={decimalSeparator:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setDecimalCharacterStyle=async(e,t)=>{const n={decimalCharacterStyleId:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setNumberOfDecimals=async(e,t)=>{const n={numberOfDecimals:{value:t}};return this.applyPropertiesUpdate(e,n)},y(this,ee,o)}async applyPropertiesUpdate(o,e){const n=await(await a(this,ee)).updateNumberVariableProperties(o,JSON.stringify(e));return i(n)}}ee=new WeakMap;class ta{constructor(o){g(this,se);this.setDisplayFormat=async(e,t)=>{const n={displayFormat:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setLocale=async(e,t)=>{const n={locale:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setStartDate=async(e,t)=>{const n={startDate:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setEndDate=async(e,t)=>{const n={endDate:{value:t}};return this.applyPropertiesUpdate(e,n)},this.setExcludedDays=async(e,t)=>{const n={excludedDays:{value:t}};return this.applyPropertiesUpdate(e,n)},y(this,se,o)}async applyPropertiesUpdate(o,e){const n=await(await a(this,se)).updateDateVariableProperties(o,JSON.stringify(e));return i(n)}}se=new WeakMap;class ea{constructor(o,e){g(this,j);g(this,Bt);this.setValue=async(t,n)=>{const r=await a(this,j);let c;return Array.isArray(n)?c=n.map(d=>a(this,Bt).mapDataItemToEngine(d)):c=n,r.setVariableValue(t,c).then(d=>i(d))},this.getInjectedData=async t=>(await a(this,j)).getInjectedDataSourceVariableData(t).then(r=>i(r)).then(r=>{const c={...r,parsedData:null};return r.parsedData&&(c.parsedData={...r.parsedData,data:r.parsedData.data.map(d=>a(this,Bt).mapEngineToDataItem(d))}),c}),this.getInjectedItemById=async(t,n)=>{var p;const c=await(await a(this,j)).getVariableById(t).then(f=>i(f));Qr(c.parsedData)||mt({status:400,error:"Variable is not an injected data source variable"});const d=c.parsedData.value.itemIdPropertyName,m=(p=(await this.getInjectedData(t)).parsedData)==null?void 0:p.data.find(f=>{var b;return((b=f[d])==null?void 0:b.toString())===n.toString()});return m||mt({status:404,error:`Item not found in injected data for variable ${t}`}),{success:!0,status:200,parsedData:{data:m,continuationToken:null,previousPageToken:null}}},this.setInjectedModel=async(t,n)=>{const r=n.properties,c=n.itemIdPropertyName;return(await a(this,j)).setInjectedDataSourceVariableModel(t,JSON.stringify(r),c).then(l=>i(l))},this.setSourceType=async(t,n)=>(await a(this,j)).setDataSourceVariableSourceType(t,n).then(c=>i(c)),this.setConnector=async(t,n)=>{const r=await a(this,j),d=new he().makeConnectorSourceForwardsCompatible(n);return r.setDataSourceVariableConnector(t,JSON.stringify(d)).then(l=>i(l))},this.removeConnector=async t=>(await a(this,j)).setDataSourceVariableConnector(t,null).then(r=>i(r)),y(this,j,o),y(this,Bt,e)}async setDisplayOptions(o,e,t){return(await a(this,j)).setDataSourceVariableDisplayOptions(o,e,t??void 0).then(r=>i(r))}}j=new WeakMap,Bt=new WeakMap;let en=($n=class{constructor(o,e){g(this,w);g(this,Jt);g(this,Ut);this.getAll=async()=>(await a(this,w)).getVariables().then(n=>i(n)).then(n=>{const r=n;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 c=r;return c.parsedData&&(c.parsedData=this.makeVariableBackwardsCompatible(c.parsedData)),c}),this.getByName=async t=>(await a(this,w)).getVariableByName(t).then(r=>i(r)).then(r=>{const c=r;return c.parsedData&&(c.parsedData=this.makeVariableBackwardsCompatible(c.parsedData)),c}),this.create=async(t,n)=>(await a(this,w)).addVariable(t,n).then(c=>i(c)),this.remove=async t=>(await a(this,w)).removeVariables(t).then(r=>i(r)),this.rename=async(t,n)=>(await a(this,w)).setVariableName(t,n).then(c=>i(c)),this.setLabel=async(t,n)=>(await a(this,w)).setVariableLabel(t,n).then(c=>i(c)),y(this,Jt,async(t,n)=>(await a(this,w)).setVariablePlaceholder(t,n).then(c=>i(c))),this.setPlaceholder=async(t,n)=>a(this,Jt).call(this,t,n),this.resetPlaceholder=async t=>a(this,Jt).call(this,t,null),y(this,Ut,async(t,n)=>(await a(this,w)).setVariableHelpText(t,n).then(c=>i(c))),this.setHelpText=async(t,n)=>a(this,Ut).call(this,t,n),this.resetHelpText=async t=>a(this,Ut).call(this,t,null),this.setType=async(t,n)=>(await a(this,w)).setVariableType(t,n).then(c=>i(c)),this.setRuleSetId=async(t,n)=>(await a(this,w)).setVariableRuleSetId(t,n).then(c=>i(c)),this.setListVariable=async(t,n)=>(await a(this,w)).setListVariableItems(t,n.map(c=>JSON.stringify({value:c}))).then(c=>i(c)),this.setValue=async(t,n)=>(await a(this,w)).setVariableValue(t,n).then(c=>i(c,d=>Br(d,{id:t}))),this.duplicate=async t=>(await a(this,w)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,n)=>(await a(this,w)).groupVariables(t,n).then(c=>i(c)),this.ungroupVariables=async t=>(await a(this,w)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,n,r)=>(await a(this,w)).moveVariable(n,r,t).then(d=>i(d)),this.moveVariables=async(t,n,r)=>(await a(this,w)).moveVariables(n,r,t).then(d=>i(d)),this.setIsVisible=async(t,n)=>{const r=n?{type:Dt.visible}:{type:Dt.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,n)=>{const r=n?{type:Dt.invisible}:{type:Dt.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,n)=>(await a(this,w)).setVariableVisibility(t,JSON.stringify(n)).then(c=>i(c)),this.setLayoutsForVariableVisibility=async t=>(await a(this,w)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,n)=>(await a(this,w)).setVariableIsRequired(t,n).then(c=>i(c)),this.setRemoveParagraphIfEmpty=async(t,n)=>(await a(this,w)).setVariableRemoveParagraphIfEmpty(t,n).then(c=>i(c)),this.setVariableCharacterLimit=async(t,n)=>(await a(this,w)).setVariableCharacterLimit(t,n).then(c=>i(c)),this.setIsReadonly=async(t,n)=>(await a(this,w)).setVariableIsReadonly(t,n).then(c=>i(c)),this.getImageVariableConnectorId=async t=>(await a(this,w)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,n)=>{const r=await a(this,w),d=new he().makeConnectorSourceForwardsCompatible(n);return r.setImageVariableConnector(t,JSON.stringify(d)).then(l=>i(l))},this.setImageVariableValueWithContext=async(t,n,r)=>(await a(this,w)).setImageVariableValueWithContext(t,n,JSON.stringify(r)).then(d=>i(d)),this.removeSource=async t=>this.setValue(t,null),this.setPrefix=async(t,n)=>{const r={prefix:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffix=async(t,n)=>{const r={suffix:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrefixCharacterStyle=async(t,n)=>{const r={prefixCharacterStyleId:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffixCharacterStyle=async(t,n)=>{const r={suffixCharacterStyleId:{value:n}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrivateData=async(t,n)=>(await a(this,w)).setVariablePrivateData(t,JSON.stringify(n)).then(c=>i(c)),this.getPrivateData=async t=>(await a(this,w)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,n)=>(await a(this,w)).setImageVariableAllowQuery(t,n).then(c=>i(c)),this.setAllowImageUpload=async(t,n)=>(await a(this,w)).setImageVariableAllowUpload(t,n).then(c=>i(c)),this.setMinImageUploadSize=async(t,n,r)=>(await a(this,w)).setImageVariableUploadMinSize(t,n,r).then(d=>i(d)),this.setIsDontBreak=async(t,n)=>(await a(this,w)).setVariableIsDontBreak(t,n).then(c=>i(c)),this.highlightUsages=async t=>(await a(this,w)).highlightVariableUsages(t).then(r=>i(r)),this.setRichTextRules=async t=>(await a(this,w)).setRichTextRulesets(JSON.stringify(t)).then(r=>i(r)),y(this,w,o),this.number=new Xr(a(this,w)),this.date=new ta(a(this,w)),this.dataSource=new ea(a(this,w),e)}makeVariablesBackwardsCompatible(o){return o.map(e=>this.makeVariableBackwardsCompatible(e))}makeVariableBackwardsCompatible(o){return o.type!==zt.list?o:this.makeListVariableBackwardsCompatible(o)}makeListVariableBackwardsCompatible(o){const e=o,t=o.items,n=o.selected,r=t.map(c=>c.value);return e.items=r,e.selected=n==null?void 0:n.value,e}async applyPrefixSuffixDeltaUpdate(o,e){const n=await(await a(this,w)).updateVariablePrefixSuffixProperties(o,JSON.stringify(e));return i(n)}},w=new WeakMap,Jt=new WeakMap,Ut=new WeakMap,$n);class sa{constructor(o){this.onVariableListChanged=e=>{this.config.events.onVariableListChanged.trigger(JSON.parse(e))},this.onConnectorsChanged=e=>{this.config.events.onConnectorsChanged.trigger(JSON.parse(e))},this.onPageSizeChanged=e=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(e))},this.onEngineEditModeChanged=e=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(e))},this.config=o}}class na{constructor(o){g(this,ut);this.getAll=async()=>(await a(this,ut)).getVariables().then(t=>i(t)),this.getById=async e=>(await a(this,ut)).getVariableById(e).then(n=>i(n)),this.getByName=async e=>(await a(this,ut)).getVariableByName(e).then(n=>i(n)),this.setListVariable=async(e,t)=>(await a(this,ut)).setListVariableItems(e,t.map(r=>JSON.stringify(r))).then(r=>i(r)),y(this,ut,o),this.image=new ra(o),this.dataSource=new aa(o)}}ut=new WeakMap;class ra{constructor(o){g(this,nt);this.setAllowQuery=async(e,t)=>(await a(this,nt)).setImageVariableAllowQuery(e,t).then(r=>i(r)),this.setAllowUpload=async(e,t)=>(await a(this,nt)).setImageVariableAllowUpload(e,t).then(r=>i(r)),this.setMinUploadSize=async(e,t,n)=>(await a(this,nt)).setImageVariableUploadMinSize(e,t,n).then(c=>i(c)),this.setConnector=async(e,t)=>(await a(this,nt)).setImageVariableConnector(e,JSON.stringify(t)).then(r=>i(r)),this.setConnectorContext=async(e,t)=>(await a(this,nt)).setImageVariableConnectorContext(e,JSON.stringify(t)).then(r=>i(r)),y(this,nt,o)}}nt=new WeakMap;class aa{constructor(o){g(this,ne);this.setConnector=async(e,t)=>(await a(this,ne)).setDataSourceVariableConnector(e,JSON.stringify(t)).then(r=>i(r)),y(this,ne,o)}}ne=new WeakMap;class ia{constructor(o){g(this,vt);this.register=async e=>(await a(this,vt)).registerConnector(JSON.stringify(e)).then(n=>i(n)),this.getById=async e=>(await a(this,vt)).getConnectorById(e).then(n=>i(n)),this.getAllByType=async e=>(await a(this,vt)).getConnectors(e).then(n=>i(n)),y(this,vt,o)}}vt=new WeakMap;class oa{constructor(o){g(this,Gt);g(this,ge);this.setWidth=async e=>(await a(this,Gt)).setPageWidth(e).then(n=>i(n)),this.setHeight=async e=>(await a(this,Gt)).setPageHeight(e).then(n=>i(n)),y(this,Gt,o),y(this,ge,o)}}Gt=new WeakMap,ge=new WeakMap;class sn{constructor(o,e,t){this.config=o,this.connection=e,this.editorAPI=t,this.subscriber=new sa(o),this.variable=new na(this.editorAPI),this.connector=new ia(this.editorAPI),this.page=new oa(this.editorAPI),this.canvas=new we(this.editorAPI)}}class ve{constructor(o){this.logger=o}getLogCategory(){return ue.event}createEventHandlerFn(o,e){return(...n)=>{try{const r=o(...n);return r instanceof Promise?r.catch(c=>this.handleError(c,e,o.name)):r}catch(r){this.handleError(r,e,o.name)}}}handleError(o,e,t){var n;if(e===Lt.log)(n=this.logger)==null||n.call(this,B.error,this.getLogCategory(),`Error in callback ${t}: ${o}`);else throw o}}class nn extends ve{constructor(o,e){super(e),this.handler=o}trigger(...o){const e=this.handler();if(e)return this.createEventHandlerFn(e,Lt.throw)(...o)}}class C extends ve{constructor(o,e){super(e),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const e=this.legacyHandler();e&&this.createEventHandlerFn(e,Lt.log)(...o);for(const t of this.subscriptions)t(...o)}registerCallback(o,e=Lt.log){const t=this.createEventHandlerFn(o,e);return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}}class Ae{static createRuntimeConfig(o){var t,n,r,c,d,l,m,p,f,b,I,A,v,E,F,M,P,U,rt,Ht,xt,jn,zn,Wn,Kn,qn,Yn,Zn,Qn,Xn,tr,er,sr,nr,rr;const e={...o};return e.logging={logLevel:((t=o.logging)==null?void 0:t.logLevel)||B.error,logger:((n=o.logging)==null?void 0:n.logger)||((ae,Pe,Ee)=>{var ar;if(Ae.isLoggingEnabled(ae,((ar=e.logging)==null?void 0:ar.logLevel)??B.error))switch(ae){case B.error:console.error(`[${Pe}] [${ae}] ${Ee}`);break;case B.warn:console.warn(`[${Pe}] [${ae}] ${Ee}`);break;default:console.log(`[${Pe}] [${ae}] ${Ee}`)}})},e.handlers={onAuthExpired:new nn(()=>e.onAuthExpired,(r=e.logging)==null?void 0:r.logger),onViewportRequested:new nn(()=>e.onViewportRequested,(c=e.logging)==null?void 0:c.logger)},e.events={onActionsChanged:new C(()=>e.onActionsChanged,(d=e.logging)==null?void 0:d.logger),onStateChanged:new C(()=>e.onStateChanged,(l=e.logging)==null?void 0:l.logger),onDocumentLoaded:new C(()=>e.onDocumentLoaded,(m=e.logging)==null?void 0:m.logger),onSelectedFramesLayoutChanged:new C(()=>e.onSelectedFramesLayoutChanged,(p=e.logging)==null?void 0:p.logger),onFramesLayoutChanged:new C(()=>e.onFramesLayoutChanged,(f=e.logging)==null?void 0:f.logger),onSelectedFramesContentChanged:new C(()=>e.onSelectedFramesContentChanged,(b=e.logging)==null?void 0:b.logger),onPageSelectionChanged:new C(()=>e.onPageSelectionChanged,(I=e.logging)==null?void 0:I.logger),onSelectedLayoutPropertiesChanged:new C(()=>e.onSelectedLayoutPropertiesChanged,(A=e.logging)==null?void 0:A.logger),onSelectedLayoutUnitChanged:new C(()=>e.onSelectedLayoutUnitChanged,(v=e.logging)==null?void 0:v.logger),onScrubberPositionChanged:new C(()=>e.onScrubberPositionChanged,(E=e.logging)==null?void 0:E.logger),onFrameAnimationsChanged:new C(()=>e.onFrameAnimationsChanged,(F=e.logging)==null?void 0:F.logger),onVariableListChanged:new C(()=>e.onVariableListChanged,(M=e.logging)==null?void 0:M.logger),onSelectedToolChanged:new C(()=>e.onSelectedToolChanged,(P=e.logging)==null?void 0:P.logger),onUndoStackStateChanged:new C(()=>e.onUndoStackStateChanged,(U=e.logging)==null?void 0:U.logger),onSelectedLayoutFramesChanged:new C(()=>e.onSelectedLayoutFramesChanged,(rt=e.logging)==null?void 0:rt.logger),onSelectedTextStyleChanged:new C(()=>e.onSelectedTextStyleChanged,(Ht=e.logging)==null?void 0:Ht.logger),onColorsChanged:new C(()=>e.onColorsChanged,(xt=e.logging)==null?void 0:xt.logger),onParagraphStylesChanged:new C(()=>e.onParagraphStylesChanged,(jn=e.logging)==null?void 0:jn.logger),onCharacterStylesChanged:new C(()=>e.onCharacterStylesChanged,(zn=e.logging)==null?void 0:zn.logger),onFontFamiliesChanged:new C(()=>e.onFontFamiliesChanged,(Wn=e.logging)==null?void 0:Wn.logger),onSelectedLayoutIdChanged:new C(()=>e.onSelectedLayoutIdChanged,(Kn=e.logging)==null?void 0:Kn.logger),onLayoutsChanged:new C(()=>e.onLayoutsChanged,(qn=e.logging)==null?void 0:qn.logger),onConnectorEvent:new C(()=>e.onConnectorEvent,(Yn=e.logging)==null?void 0:Yn.logger),onConnectorsChanged:new C(()=>e.onConnectorsChanged,(Zn=e.logging)==null?void 0:Zn.logger),onZoomChanged:new C(()=>e.onZoomChanged,(Qn=e.logging)==null?void 0:Qn.logger),onSelectedPageIdChanged:new C(()=>e.onSelectedPageIdChanged,e.logging.logger),onPagesChanged:new C(()=>e.onPagesChanged,e.logging.logger),onPageSnapshotInvalidated:new C(()=>e.onPageSnapshotInvalidated,e.logging.logger),onPageSizeChanged:new C(()=>e.onPageSizeChanged,(Xn=e.logging)==null?void 0:Xn.logger),onShapeCornerRadiusChanged:new C(()=>e.onShapeCornerRadiusChanged,(tr=e.logging)==null?void 0:tr.logger),onCropActiveFrameIdChanged:new C(()=>e.onCropActiveFrameIdChanged,(er=e.logging)==null?void 0:er.logger),onAsyncError:new C(()=>e.onAsyncError,(sr=e.logging)==null?void 0:sr.logger),onViewModeChanged:new C(()=>e.onViewModeChanged,(nr=e.logging)==null?void 0:nr.logger),onBarcodeValidationChanged:new C(()=>e.onBarcodeValidationChanged,(rr=e.logging)==null?void 0:rr.logger),onDataSourceIdChanged:new C(()=>e.onDataSourceIdChanged,e.logging.logger),onInjectedDataChanged:new C(()=>e.onInjectedDataChanged,e.logging.logger),onDocumentIssueListChanged:new C(()=>e.onDocumentIssueListChanged,e.logging.logger),onCustomUndoDataChanged:new C(()=>e.onCustomUndoDataChanged,e.logging.logger),onEngineEditModeChanged:new C(()=>e.onEngineEditModeChanged,e.logging.logger),onBrandKitMediaChanged:new C(()=>e.onBrandKitMediaChanged,e.logging.logger),onCanvasFramesManipulated:new C(()=>e.onCanvasFramesManipulated,e.logging.logger)},e}static isLoggingEnabled(o,e){return e==B.info||e==B.warn&&(o==B.warn||o==B.error)?!0:e==B.error&&o==B.error}}class ca{isDatePropertyWrapper(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)&&"type"in o&&o.type==="date"&&"chiliReservedTag"in o&&o.chiliReservedTag==="date"}isDateObject(o){return o instanceof Date}mapEngineToDataItem(o){const e={};return Object.entries(o).forEach(([t,n])=>{e[t]=this.isDatePropertyWrapper(n)?new Date(n.value):n}),e}mapDataItemToEngine(o){const e={};return Object.entries(o).forEach(([t,n])=>{e[t]=this.isDateObject(n)?{value:n.getTime(),type:"date",chiliReservedTag:"date"}:n}),e}}class ha{constructor(o){g(this,gt);y(this,gt,o)}async getValue(o){return(await a(this,gt)).getConfigValue(o).then(t=>i(t))}async setValue(o,e){return(await a(this,gt)).setConfigValue(o,e).then(n=>i(n))}async updateStudioOptions(o){return(await a(this,gt)).updateStudioOptions(JSON.stringify(o)).then(t=>i(t))}async getEngineSessionId(){return(await a(this,gt)).getEngineSessionId().then(e=>i(e))}getLatestSmartCropVersion(){return zr}}gt=new WeakMap;class rn extends ha{constructor(e,t){super(e);g(this,_t);y(this,_t,t)}async getValue(e){const t=a(this,_t).get(e);return t!=null?i({status:200,success:!0,parsedData:t,data:t},!1):super.getValue(e)}async setValue(e,t){const n=super.setValue(e,t);return a(this,_t).set(e,t),n}}_t=new WeakMap;class an{constructor(o){g(this,z);this.getAll=async()=>(await a(this,z)).getGradients().then(t=>i(t)),this.getById=async e=>(await a(this,z)).getGradientById(e).then(n=>i(n)),this.create=async()=>(await a(this,z)).createGradient().then(t=>i(t)),this.duplicate=async e=>(await a(this,z)).duplicateGradient(e).then(n=>i(n)),this.move=async(e,t)=>(await a(this,z)).moveGradients(e,t).then(r=>i(r)),this.rename=async(e,t)=>(await a(this,z)).renameGradient(e,t).then(r=>i(r)),this.update=async(e,t)=>{const n=await a(this,z),r=t;return n.updateGradient(e,JSON.stringify(r)).then(c=>i(c))},this.remove=async e=>(await a(this,z)).removeGradient(e).then(n=>i(n)),y(this,z,o)}}z=new WeakMap;class on{constructor(o){g(this,At);g(this,re);this.query=async(e,t,n={})=>(await a(this,At)).componentConnectorQuery(e,JSON.stringify(t),JSON.stringify(n)).then(c=>i(c)),this.preview=async(e,t,n,r={})=>(await a(this,re)).componentConnectorPreview(e,t,n,JSON.stringify(r)).then(d=>{if(d instanceof Uint8Array)return d;throw typeof d=="object"&&d!==null&&"success"in d&&!d.success&&mt(d),new Error(`Unexpected response type: ${typeof d}.`)}),this.getConfigurationOptions=async e=>(await a(this,At)).componentConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,At)).componentConnectorGetCapabilities(e).then(n=>i(n)),y(this,At,o),y(this,re,o)}}At=new WeakMap,re=new WeakMap;class cn{constructor(o){g(this,yt);this.linkVariable=async(e,t,n,r)=>(await a(this,yt)).linkComponentVariable(e,t,n,r??null).then(d=>i(d)),this.getComponentVariables=async e=>(await a(this,yt)).getComponentVariables(e).then(n=>i(n)),this.setFitMode=async(e,t)=>(await a(this,yt)).setComponentLayoutFit(e,t).then(r=>i(r)),this.resetFitMode=async e=>(await a(this,yt)).resetComponentLayoutFit(e).then(n=>i(n)),y(this,yt,o)}}yt=new WeakMap;class hn{constructor(o){g(this,tt);this.updateSettings=async(e,t)=>(await a(this,tt)).updateComponentGridSettings(e,JSON.stringify(t)).then(r=>i(r)),this.setMapping=async(e,t,n,r,c)=>(await a(this,tt)).setComponentGridMapping(e,t,n,r,c).then(l=>i(l)),this.resetSettings=async e=>(await a(this,tt)).resetComponentGridSettings(e).then(n=>i(n)),this.setComponentSource=async(e,t)=>(await a(this,tt)).setComponentGridComponentSource(e,t?JSON.stringify(t):null).then(r=>i(r)),this.setDataSourceVariable=async(e,t)=>(await a(this,tt)).setComponentGridDataSourceVariable(e,t).then(r=>i(r)),this.setResizeMode=async(e,t)=>(await a(this,tt)).setComponentGridResizeMode(e,t).then(r=>i(r)),y(this,tt,o)}}tt=new WeakMap;const da=()=>{};class la{constructor(){this.listeners=new Map}add(o,e){if(typeof e!="function")return da;const t=this.listeners.get(o)??new Set;return t.add(e),this.listeners.set(o,t),()=>{this.remove(o,e)}}remove(o,e){const t=this.listeners.get(o);t&&(t.delete(e),t.size===0&&this.listeners.delete(o))}getListeners(o){return[...this.listeners.get(o)??[]]}}const ua=s=>!s||typeof s!="object"?!1:typeof s.then=="function",ga=s=>!(!s||typeof s!="object"||Array.isArray(s)),dn=(s,o,e)=>{e==null||e(B.error,ue.sdk,`Error in method listener for ${s}: ${String(o)}`)},Wt=(s,o,e,t,n)=>{for(const r of e.getListeners(s))try{r(o)}catch(c){dn(s,c,n)}try{o.phase==="invoke"?t.onMethodInvoked.trigger(o):t.onMethodCompleted.trigger(o)}catch(r){dn(s,r,n)}};function ln(s,o,e,t,n){const r=new Map,c=new Map;return new Proxy(s,{get(d,l,m){const p=Reflect.get(d,l,m);if(typeof l=="symbol")return p;if(typeof p=="function"){if(r.has(l))return r.get(l);const f=`${o}.${String(l)}`,b=o.split(".")[0]||o,I=String(l),A=((...v)=>{const E={phase:"invoke",path:f,controller:b,method:I,args:[...v]};Wt(f,E,e,t,n);try{const F=p.apply(d,v);if(ua(F))return F.then(P=>{const U={phase:"complete",path:f,controller:b,method:I,args:[...v],success:!0,result:P};return Wt(f,U,e,t,n),P}).catch(P=>{const U={phase:"complete",path:f,controller:b,method:I,args:[...v],success:!1,error:P};throw Wt(f,U,e,t,n),P});const M={phase:"complete",path:f,controller:b,method:I,args:[...v],success:!0,result:F};return Wt(f,M,e,t,n),F}catch(F){const M={phase:"complete",path:f,controller:b,method:I,args:[...v],success:!1,error:F};throw Wt(f,M,e,t,n),F}});return A.addEventListener=v=>e.add(f,v),A.removeEventListener=v=>{e.remove(f,v)},r.set(l,A),A}if(ga(p)){if(c.has(l))return c.get(l);const f=`${o}.${String(l)}`,b=ln(p,f,e,t,n);return c.set(l,b),b}return p}})}class un extends ve{constructor(o){super(o),this.subscriptions=new Set}getLogCategory(){return ue.sdk}trigger(...o){const e=Array.from(this.subscriptions);for(const t of e)t(...o)}registerCallback(o,e=Lt.log){const t=this.createEventHandlerFn(o,e);return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}}class ya{constructor(o){this.onMethodInvoked=new un(o),this.onMethodCompleted=new un(o)}}const pa=`https://studio-cdn.chiligrafx.com/editor/${T.current}/web`,gn=Symbol("pendingInstrumentation"),ma=s=>{Object.defineProperty(s,gn,{value:!0,enumerable:!1,configurable:!0})},wa=s=>typeof s=="object"&&s!==null&&s[gn]===!0;class Ca{constructor(o){var e,t;this.localConfig=new Map,this.dataItemMappingTools=new ca,this.methodListeners=new la,this.teardownFrame=null,this.loadEditor=()=>{var n,r,c;(n=this.teardownFrame)==null||n.call(this),this.teardownFrame=Mr(this.config.editorLink||pa,{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:d=>{var l;(l=this.enabledNextSubscribers)!=null&&l.onVariableListChanged?this.next.subscriber.onVariableListChanged(d):this.subscriber.onVariableListChanged(d)},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:d=>{var l;(l=this.enabledNextSubscribers)!=null&&l.onConnectorsChanged?this.next.subscriber.onConnectorsChanged(d):this.subscriber.onConnectorsChanged(d)},onZoomChanged:this.subscriber.onZoomChanged,onSelectedPageIdChanged:this.subscriber.onSelectedPageIdChanged,onPagesChanged:this.subscriber.onPagesChanged,onPageSnapshotInvalidated:this.subscriber.onPageSnapshotInvalidated,onPageSizeChanged:d=>{var l;(l=this.enabledNextSubscribers)!=null&&l.onPageSizeChanged?this.next.subscriber.onPageSizeChanged(d):this.subscriber.onPageSizeChanged(d)},onShapeCornerRadiusChanged:this.subscriber.onShapeCornerRadiusChanged,onCropActiveFrameIdChanged:this.subscriber.onCropActiveFrameIdChanged,onAsyncError:this.subscriber.onAsyncError,onViewModeChanged:this.subscriber.onViewModeChanged,onBarcodeValidationChanged:this.subscriber.onBarcodeValidationChanged,onDataSourceIdChanged:this.subscriber.onDataSourceIdChanged,onInjectedDataChanged:this.subscriber.onInjectedDataChanged,onDocumentIssueListChanged:this.subscriber.onDocumentIssueListChanged,onCustomUndoDataChanged:this.subscriber.onCustomUndoDataChanged,onEngineEditModeChanged:this.subscriber.onEngineEditModeChanged,onBrandKitMediaChanged:this.subscriber.onBrandKitMediaChanged,onCanvasFramesManipulated:this.subscriber.onCanvasFramesManipulated},this.setConnection,this.config.editorId,this.config.studioStyling,d=>{var l,m;(m=(l=this.config).onConnectionError)==null||m.call(l,d)}),this.editorAPI=(r=this.connection)==null?void 0:r.promise.then(d=>d),this.action=this.toInstrumented(new Je(this.editorAPI)),this.layout=this.toInstrumented(new Js(this.editorAPI)),this.frame=this.toInstrumented(new Ts(this.editorAPI)),this.barcode=this.toInstrumented(new je(this.editorAPI)),this.component=this.toInstrumented(new cn(this.editorAPI)),this.animation=this.toInstrumented(new Ue(this.editorAPI)),this.document=this.toInstrumented(new ps(this.editorAPI)),this.configuration=this.toInstrumented(new rn(this.editorAPI,this.localConfig)),this.utils=this.toInstrumented(new tn(this.editorAPI,this.localConfig)),this.tool=this.toInstrumented(new Zs(this.editorAPI)),this.page=this.toInstrumented(new Gs(this.editorAPI)),this.debug=this.toInstrumented(new ys(this.editorAPI)),this.undoManager=this.toInstrumented(new Qs(this.editorAPI,this)),this.textSelection=this.toInstrumented(new Ws(this.editorAPI)),this.colorStyle=this.toInstrumented(new Qe(this.editorAPI)),this.gradientStyle=this.toInstrumented(new an(this.editorAPI)),this.paragraphStyle=this.toInstrumented(new _s(this.editorAPI)),this.characterStyle=this.toInstrumented(new We(this.editorAPI)),this.mediaConnector=this.toInstrumented(new Us(this.editorAPI)),this.fontConnector=this.toInstrumented(new Vs(this.editorAPI)),this.componentConnector=this.toInstrumented(new on(this.editorAPI)),this.dataConnector=this.toInstrumented(new us(this.editorAPI,this.dataItemMappingTools)),this.dataSource=this.toInstrumented(new gs(this.editorAPI,this.dataItemMappingTools)),this.connector=this.toInstrumented(new ls(this.editorAPI,this.localConfig)),this.variable=this.toInstrumented(new en(this.editorAPI,this.dataItemMappingTools)),this.font=this.toInstrumented(new ks(this.editorAPI)),this.experiment=this.toInstrumented(new Rs(this.editorAPI)),this.canvas=this.toInstrumented(new we(this.editorAPI)),this.shape=this.toInstrumented(new Se(this.editorAPI)),this.colorConversion=this.toInstrumented(new qe(this.editorAPI)),this.info=this.toInstrumented(new Bs),this.clipboard=this.toInstrumented(new Ke(this.editorAPI)),this.brandKit=this.toInstrumented(new ze(this.editorAPI,this)),this.componentGrid=this.toInstrumented(new hn(this.editorAPI)),this.next=new sn(this.config,this.connection,this.editorAPI),this.applyMethodInstrumentation(),this.configuration.setValue(Z.GraFxStudioSdkVersion,Oe.version),this.configuration.setValue(Z.GraFxStudioDocumentType,this.config.documentType||me.template),this.configuration.updateStudioOptions(this.config.studioOptions||Rr),this.configuration.setValue(Z.QueryCallCacheEnabled,((c=this.config.enableQueryCallCache)==null?void 0:c.toString())||"false")},this.setConnection=n=>{this.connection=n},this.destroy=()=>{var n,r;try{(n=this.connection)==null||n.destroy()}catch{}(r=this.teardownFrame)==null||r.call(this),this.teardownFrame=null},this.toInstrumented=n=>(ma(n),n),this.applyMethodInstrumentation=()=>{var r;const n=this;for(const c of Object.keys(n)){const d=n[c];wa(d)&&(n[c]=ln(d,c,this.methodListeners,this.sdkEvents,(r=this.config.logging)==null?void 0:r.logger))}},this.config=Ae.createRuntimeConfig(o),this.sdkEvents=new ya((e=this.config.logging)==null?void 0:e.logger),this.editorAPI=(t=this.connection)==null?void 0:t.promise.then(n=>n),this.action=this.toInstrumented(new Je(this.editorAPI)),this.layout=this.toInstrumented(new Js(this.editorAPI)),this.frame=this.toInstrumented(new Ts(this.editorAPI)),this.shape=this.toInstrumented(new Se(this.editorAPI)),this.barcode=this.toInstrumented(new je(this.editorAPI)),this.component=this.toInstrumented(new cn(this.editorAPI)),this.undoManager=this.toInstrumented(new Qs(this.editorAPI,this)),this.connector=this.toInstrumented(new ls(this.editorAPI,this.localConfig)),this.mediaConnector=this.toInstrumented(new Us(this.editorAPI)),this.fontConnector=this.toInstrumented(new Vs(this.editorAPI)),this.componentConnector=this.toInstrumented(new on(this.editorAPI)),this.dataConnector=this.toInstrumented(new us(this.editorAPI,this.dataItemMappingTools)),this.dataSource=this.toInstrumented(new gs(this.editorAPI,this.dataItemMappingTools)),this.animation=this.toInstrumented(new Ue(this.editorAPI)),this.document=this.toInstrumented(new ps(this.editorAPI)),this.configuration=this.toInstrumented(new rn(this.editorAPI,this.localConfig)),this.variable=this.toInstrumented(new en(this.editorAPI,this.dataItemMappingTools)),this.utils=this.toInstrumented(new tn(this.editorAPI,this.localConfig)),this.subscriber=new Kr(this.config,this.localConfig),this.tool=this.toInstrumented(new Zs(this.editorAPI)),this.page=this.toInstrumented(new Gs(this.editorAPI)),this.debug=this.toInstrumented(new ys(this.editorAPI)),this.textSelection=this.toInstrumented(new Ws(this.editorAPI)),this.colorStyle=this.toInstrumented(new Qe(this.editorAPI)),this.gradientStyle=this.toInstrumented(new an(this.editorAPI)),this.paragraphStyle=this.toInstrumented(new _s(this.editorAPI)),this.characterStyle=this.toInstrumented(new We(this.editorAPI)),this.font=this.toInstrumented(new ks(this.editorAPI)),this.experiment=this.toInstrumented(new Rs(this.editorAPI)),this.canvas=this.toInstrumented(new we(this.editorAPI)),this.colorConversion=this.toInstrumented(new qe(this.editorAPI)),this.info=this.toInstrumented(new Bs),this.clipboard=this.toInstrumented(new Ke(this.editorAPI)),this.next=new sn(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=this.toInstrumented(new ze(this.editorAPI,this)),this.componentGrid=this.toInstrumented(new hn(this.editorAPI)),this.applyMethodInstrumentation()}}var yn=(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))(yn||{}),pn=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(pn||{}),mn=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))(mn||{}),wn=(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))(wn||{}),Cn=(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))(Cn||{}),fn=(s=>(s.preview="preview",s.normal="normal",s))(fn||{}),Sn=(s=>(s.linear="linear",s))(Sn||{}),bn=(s=>(s.local="linearLocal",s.linearBrandKit="linearBrandKit",s))(bn||{}),In=(s=>(s.Square="square",s.Line="line",s))(In||{}),vn=(s=>(s.thumbnail="thumbnail",s.highest="highest",s.medium="medium",s))(vn||{}),An=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(An||{}),Pn=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(Pn||{}),En=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(En||{}),On=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(On||{}),Fn=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Fn||{}),Dn=(s=>(s.none="none",s.bullet="bullet",s.number="number",s))(Dn||{}),Ln=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(Ln||{}),Nn=(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.BACKGROUND_COLOR="backgroundColor",s.BACKGROUND_COLOR_APPLIED="backgroundColorApplied",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))(Nn||{}),Mn=(s=>(s.arabic="arabic",s.romanUpperCase="romanUpperCase",s.romanLowerCase="romanLowerCase",s.latinUpperCase="latinUpperCase",s.latinLowerCase="latinLowerCase",s))(Mn||{}),Rn=(s=>(s.none="none",s.dash="dash",s.dot="dot",s.colon="colon",s.roundBracket="roundBracket",s))(Rn||{}),Vn=(s=>(s.fixed="fixed",s))(Vn||{}),kn=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(kn||{}),Tn=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s.custom="custom",s))(Tn||{}),Bn=(s=>(s.all="all",s.only="only",s.none="none",s))(Bn||{}),Jn=(s=>(s.paragraph="paragraph",s.character="character",s.lineBreak="lineBreak",s.inlineStyle="inlineStyle",s))(Jn||{}),Un=(s=>(s.exists="exists",s.missing="missing",s.equals="equals",s.notEquals="notEquals",s.contains="contains",s.startsWith="startsWith",s.endsWith="endsWith",s))(Un||{}),Gn=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s.gradient="gradient",s))(Gn||{}),_n=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(_n||{});const fa=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:_n},Symbol.toStringTag,{value:"Module"}));h.APIColorType=Ye,h.ActionAsyncError=Ve,h.ActionEditorEvent=kn,h.Alignment=Pn,h.AnchorTargetEdgeType=Ls,h.AnchorTargetType=Ds,h.AuthCredentialsTypeEnum=os,h.AuthRefreshTypeEnum=cs,h.AutoGrowDirection=ws,h.BarcodeCharacterSet=wt,h.BarcodeErrorCorrectionLevel=Pt,h.BarcodeSourceTypeEnum=Ss,h.BarcodeType=W,h.BarcodeValidationResult=Ge,h.BasicAnimationsEmphasisStyles=Cn,h.BlendMode=As,h.Case=On,h.ColorType=ie,h.ColorUsageType=Ze,h.ComponentFitEnum=ms,h.ComponentGridLayoutAlgorithm=Vn,h.ComponentPreviewType=vn,h.ComponentSourceTypeEnum=Cs,h.ConnectorConfigContextType=ns,h.ConnectorConfigValueType=ss,h.ConnectorEventType=is,h.ConnectorHttpError=Te,h.ConnectorMapping=Ur,h.ConnectorMappingDirection=as,h.ConnectorMappingSource=rs,h.ConnectorRegistrationSource=Ft,h.ConnectorStateType=ce,h.ConnectorSupportedAuth=ds,h.ConnectorType=Xe,h.ConstraintMode=$e,h.CornerRadiusType=Bn,h.CropType=fe,h.DataRowAsyncError=ke,h.DataSourceVariableDisplayOptionsType=zs,h.DataSourceVariableSourceType=Ie,h.Day=Hs,h.DeprecatedMediaConnectorDownloadType=oe,h.DeprecatedMediaType=Et,h.DocumentIssueTypeEnum=Re,h.DocumentType=me,h.DownloadFormats=Ys,h.EaseTypes=mn,h.EngineEditModeType=Gn,h.EnvironmentType=le,h.FitMode=Ps,h.FitModePosition=Es,h.FlowDirection=Is,h.FontPreviewFormat=In,h.FontWeights=An,h.FrameAnchorTarget=jr,h.FrameAnchorType=Fs,h.FrameEditingMode=Me,h.FramePropertyNames=Ks,h.FrameTypeEnum=fs,h.GradientType=Sn,h.GradientUsageType=bn,h.GrafxTokenAuthCredentials=_r,h.ImageSourceTypeEnum=jt,h.LayoutIntent=xe,h.LayoutPropertyNames=qs,h.LayoutType=He,h.Locale=xs,h.MarkedListType=Dn,h.MeasurementUnit=_e,h.MediaDownloadIntent=be,h.MediaDownloadType=de,h.MediaType=Ot,h.Next=fa,h.NumberListFormat=Mn,h.NumberListSeparatorSymbol=Rn,h.PageAnchorTarget=$r,h.PositionEnum=Q,h.RefreshedAuthCredendentials=Hr,h.SDKUnauthorizedError=Xs,h.Scripting=Fn,h.SelectedTextStyleSections=Ln,h.SelectedTextStyles=Nn,h.ShakeDirections=pn,h.ShapeType=Tn,h.SlideDirections=yn,h.SmartCropAxisBias=Ms,h.SmartCropVersion=Ns,h.SortBy=ts,h.SortOrder=es,h.StructuredTextAttributeMatchOperator=Un,h.StructuredTextStyleKind=Jn,h.TextDirection=bs,h.TextPosition=En,h.ToolType=G,h.TweenTypes=wn,h.UpdateZIndexMethod=Os,h.UploadAssetValidationError=hs,h.UploadAssetValidationErrorType=Ce,h.VariableType=zt,h.VariableValueConstrainsViolationError=Be,h.VariableVisibilityOperator=js,h.VariableVisibilityTargetType=$s,h.VariableVisibilityType=Dt,h.VerticalAlign=vs,h.ViewMode=fn,h.WellKnownConfigurationKeys=Z,h.default=Ca,h.grafxMediaConnectorRegistration=Gr,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
69
69
  //# sourceMappingURL=main.js.map