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