Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gaoding/editor-sdk

Package Overview
Dependencies
Maintainers
22
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gaoding/editor-sdk - npm Package Compare versions

Comparing version 2.2.0-alpha.0 to 2.2.0

6

dist/editor-sdk.umd.js

@@ -1,2 +0,2 @@

(function(T,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(T=typeof globalThis!="undefined"?globalThis:T||self,b(T.gaoding={}))})(this,function(T){"use strict";var b;(function(t){t.Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack"})(b||(b={}));var N;(function(t){t.Fulfilled="fulfilled",t.Rejected="rejected"})(N||(N={}));var L;(function(t){t.ConnectionDestroyed="ConnectionDestroyed",t.ConnectionTimeout="ConnectionTimeout",t.NotInIframe="NotInIframe",t.NoIframeSrc="NoIframeSrc"})(L||(L={}));var X;(function(t){t.DataCloneError="DataCloneError"})(X||(X={}));var A;(function(t){t.Message="message"})(A||(A={}));var je=()=>{const t=[];let e=!1;return{destroy(r){e=!0,t.forEach(n=>{n(r)})},onDestroy(r){e?r():t.push(r)}}},ze=t=>(...e)=>{t&&console.log("[Penpal]",...e)};const qe={"http:":"80","https:":"443"},Ke=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,He=["file:","data:"];var Ve=t=>{if(t&&He.find(u=>t.startsWith(u)))return"null";const e=document.location,r=Ke.exec(t);let n,a,s;r?(n=r[1]?r[1]:e.protocol,a=r[2],s=r[4]):(n=e.protocol,a=e.hostname,s=e.port);const o=s&&s!==qe[n]?`:${s}`:"";return`${n}//${a}${o}`};const he=({name:t,message:e,stack:r})=>({name:t,message:e,stack:r}),Je=t=>{const e=new Error;return Object.keys(t).forEach(r=>e[r]=t[r]),e};var Ge=(t,e,r)=>{const{localName:n,local:a,remote:s,originForSending:o,originForReceiving:u}=t;let i=!1;const d=y=>{if(y.source!==s||y.data.penpal!==b.Call)return;if(y.origin!==u){r(`${n} received message from origin ${y.origin} which did not match expected origin ${u}`);return}const h=y.data,{methodName:l,args:f,id:p}=h;r(`${n}: Received ${l}() call`);const m=c=>v=>{if(r(`${n}: Sending ${l}() reply`),i){r(`${n}: Unable to send ${l}() reply due to destroyed connection`);return}const g={penpal:b.Reply,id:p,resolution:c,returnValue:v};c===N.Rejected&&v instanceof Error&&(g.returnValue=he(v),g.returnValueIsError=!0);try{s.postMessage(g,o)}catch(P){if(P.name===X.DataCloneError){const $={penpal:b.Reply,id:p,resolution:N.Rejected,returnValue:he(P),returnValueIsError:!0};s.postMessage($,o)}throw P}};new Promise(c=>c(e[l].apply(e,f))).then(m(N.Fulfilled),m(N.Rejected))};return a.addEventListener(A.Message,d),()=>{i=!0,a.removeEventListener(A.Message,d)}};let We=0;var Xe=()=>++We,Ye=(t,e,r,n,a)=>{const{localName:s,local:o,remote:u,originForSending:i,originForReceiving:d}=e;let y=!1;a(`${s}: Connecting call sender`);const h=l=>(...f)=>{a(`${s}: Sending ${l}() call`);let p;try{u.closed&&(p=!0)}catch{p=!0}if(p&&n(),y){const m=new Error(`Unable to send ${l}() call due to destroyed connection`);throw m.code=L.ConnectionDestroyed,m}return new Promise((m,c)=>{const v=Xe(),g=$=>{if($.source!==u||$.data.penpal!==b.Reply||$.data.id!==v)return;if($.origin!==d){a(`${s} received message from origin ${$.origin} which did not match expected origin ${d}`);return}const de=$.data;a(`${s}: Received ${l}() reply`),o.removeEventListener(A.Message,g);let fe=de.returnValue;de.returnValueIsError&&(fe=Je(fe)),(de.resolution===N.Fulfilled?m:c)(fe)};o.addEventListener(A.Message,g);const P={penpal:b.Call,id:v,methodName:l,args:f};u.postMessage(P,i)})};return r.reduce((l,f)=>(l[f]=h(f),l),t),()=>{y=!0}},Ze=(t,e,r,n,a)=>{const{destroy:s,onDestroy:o}=n;let u,i;const d={};return y=>{if(y.origin!==e){a(`Parent: Handshake - Received ACK message from origin ${y.origin} which did not match expected origin ${e}`);return}a("Parent: Handshake - Received ACK");const h={localName:"Parent",local:window,remote:y.source,originForSending:r,originForReceiving:e};u&&u(),u=Ge(h,t,a),o(u),i&&i.forEach(f=>{delete d[f]}),i=y.data.methodNames;const l=Ye(d,h,i,s,a);return o(l),d}},Qe=(t,e,r,n)=>a=>{if(a.origin!==r){t(`Parent: Handshake - Received SYN message from origin ${a.origin} which did not match expected origin ${r}`);return}t("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:b.SynAck,methodNames:Object.keys(e)};a.source.postMessage(s,n)};const et=6e4;var tt=(t,e)=>{const{destroy:r,onDestroy:n}=e,a=setInterval(()=>{t.isConnected||(clearInterval(a),r())},et);n(()=>{clearInterval(a)})},rt=(t,e)=>{let r;return t!==void 0&&(r=window.setTimeout(()=>{const n=new Error(`Connection timed out after ${t}ms`);n.code=L.ConnectionTimeout,e(n)},t)),()=>{clearTimeout(r)}},nt=t=>{if(!t.src&&!t.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=L.NoIframeSrc,e}},at=t=>{let{iframe:e,methods:r={},childOrigin:n,timeout:a,debug:s=!1}=t;const o=ze(s),u=je(),{onDestroy:i,destroy:d}=u;n||(nt(e),n=Ve(e.src));const y=n==="null"?"*":n,h=Qe(o,r,n,y),l=Ze(r,n,y,u,o);return{promise:new Promise((p,m)=>{const c=rt(a,d),v=g=>{if(!(g.source!==e.contentWindow||!g.data)){if(g.data.penpal===b.Syn){h(g);return}if(g.data.penpal===b.Ack){const P=l(g);P&&(c(),p(P));return}}};window.addEventListener(A.Message,v),o("Parent: Awaiting handshake"),tt(e,u),i(g=>{window.removeEventListener(A.Message,v),g||(g=new Error("Connection destroyed"),g.code=L.ConnectionDestroyed),m(g)})}),destroy(){d()}}};const it="2.2.0-alpha.0",E={TEMPLATE_EDITOR_URL:"https://open.gaoding.com/design",MOBILE_TEMPLATE_EDITOR_URL:"https://open.gaoding.com/h5/design",KOUTU_EDITOR_URL:"https://open.gaoding.com/clip",IMAGE_EDITOR_URL:"https://open.gaoding.com/design/image",OPEN_PLATFORM_ORIGIN:"https://open.gaoding.com",get VERSION(){return it}};var Y=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function pe(t,e){const r=document.createElement("div");r.style.cssText=`
(function(T,b){typeof exports=="object"&&typeof module!="undefined"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(T=typeof globalThis!="undefined"?globalThis:T||self,b(T.gaoding={}))})(this,function(T){"use strict";var b;(function(t){t.Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack"})(b||(b={}));var N;(function(t){t.Fulfilled="fulfilled",t.Rejected="rejected"})(N||(N={}));var L;(function(t){t.ConnectionDestroyed="ConnectionDestroyed",t.ConnectionTimeout="ConnectionTimeout",t.NotInIframe="NotInIframe",t.NoIframeSrc="NoIframeSrc"})(L||(L={}));var X;(function(t){t.DataCloneError="DataCloneError"})(X||(X={}));var A;(function(t){t.Message="message"})(A||(A={}));var je=()=>{const t=[];let e=!1;return{destroy(r){e=!0,t.forEach(n=>{n(r)})},onDestroy(r){e?r():t.push(r)}}},ze=t=>(...e)=>{t&&console.log("[Penpal]",...e)};const qe={"http:":"80","https:":"443"},Ke=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,He=["file:","data:"];var Ve=t=>{if(t&&He.find(u=>t.startsWith(u)))return"null";const e=document.location,r=Ke.exec(t);let n,a,s;r?(n=r[1]?r[1]:e.protocol,a=r[2],s=r[4]):(n=e.protocol,a=e.hostname,s=e.port);const o=s&&s!==qe[n]?`:${s}`:"";return`${n}//${a}${o}`};const he=({name:t,message:e,stack:r})=>({name:t,message:e,stack:r}),Je=t=>{const e=new Error;return Object.keys(t).forEach(r=>e[r]=t[r]),e};var Ge=(t,e,r)=>{const{localName:n,local:a,remote:s,originForSending:o,originForReceiving:u}=t;let i=!1;const d=y=>{if(y.source!==s||y.data.penpal!==b.Call)return;if(y.origin!==u){r(`${n} received message from origin ${y.origin} which did not match expected origin ${u}`);return}const h=y.data,{methodName:l,args:f,id:p}=h;r(`${n}: Received ${l}() call`);const m=c=>v=>{if(r(`${n}: Sending ${l}() reply`),i){r(`${n}: Unable to send ${l}() reply due to destroyed connection`);return}const g={penpal:b.Reply,id:p,resolution:c,returnValue:v};c===N.Rejected&&v instanceof Error&&(g.returnValue=he(v),g.returnValueIsError=!0);try{s.postMessage(g,o)}catch(P){if(P.name===X.DataCloneError){const $={penpal:b.Reply,id:p,resolution:N.Rejected,returnValue:he(P),returnValueIsError:!0};s.postMessage($,o)}throw P}};new Promise(c=>c(e[l].apply(e,f))).then(m(N.Fulfilled),m(N.Rejected))};return a.addEventListener(A.Message,d),()=>{i=!0,a.removeEventListener(A.Message,d)}};let We=0;var Xe=()=>++We,Ye=(t,e,r,n,a)=>{const{localName:s,local:o,remote:u,originForSending:i,originForReceiving:d}=e;let y=!1;a(`${s}: Connecting call sender`);const h=l=>(...f)=>{a(`${s}: Sending ${l}() call`);let p;try{u.closed&&(p=!0)}catch{p=!0}if(p&&n(),y){const m=new Error(`Unable to send ${l}() call due to destroyed connection`);throw m.code=L.ConnectionDestroyed,m}return new Promise((m,c)=>{const v=Xe(),g=$=>{if($.source!==u||$.data.penpal!==b.Reply||$.data.id!==v)return;if($.origin!==d){a(`${s} received message from origin ${$.origin} which did not match expected origin ${d}`);return}const de=$.data;a(`${s}: Received ${l}() reply`),o.removeEventListener(A.Message,g);let fe=de.returnValue;de.returnValueIsError&&(fe=Je(fe)),(de.resolution===N.Fulfilled?m:c)(fe)};o.addEventListener(A.Message,g);const P={penpal:b.Call,id:v,methodName:l,args:f};u.postMessage(P,i)})};return r.reduce((l,f)=>(l[f]=h(f),l),t),()=>{y=!0}},Ze=(t,e,r,n,a)=>{const{destroy:s,onDestroy:o}=n;let u,i;const d={};return y=>{if(y.origin!==e){a(`Parent: Handshake - Received ACK message from origin ${y.origin} which did not match expected origin ${e}`);return}a("Parent: Handshake - Received ACK");const h={localName:"Parent",local:window,remote:y.source,originForSending:r,originForReceiving:e};u&&u(),u=Ge(h,t,a),o(u),i&&i.forEach(f=>{delete d[f]}),i=y.data.methodNames;const l=Ye(d,h,i,s,a);return o(l),d}},Qe=(t,e,r,n)=>a=>{if(a.origin!==r){t(`Parent: Handshake - Received SYN message from origin ${a.origin} which did not match expected origin ${r}`);return}t("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:b.SynAck,methodNames:Object.keys(e)};a.source.postMessage(s,n)};const et=6e4;var tt=(t,e)=>{const{destroy:r,onDestroy:n}=e,a=setInterval(()=>{t.isConnected||(clearInterval(a),r())},et);n(()=>{clearInterval(a)})},rt=(t,e)=>{let r;return t!==void 0&&(r=window.setTimeout(()=>{const n=new Error(`Connection timed out after ${t}ms`);n.code=L.ConnectionTimeout,e(n)},t)),()=>{clearTimeout(r)}},nt=t=>{if(!t.src&&!t.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=L.NoIframeSrc,e}},at=t=>{let{iframe:e,methods:r={},childOrigin:n,timeout:a,debug:s=!1}=t;const o=ze(s),u=je(),{onDestroy:i,destroy:d}=u;n||(nt(e),n=Ve(e.src));const y=n==="null"?"*":n,h=Qe(o,r,n,y),l=Ze(r,n,y,u,o);return{promise:new Promise((p,m)=>{const c=rt(a,d),v=g=>{if(!(g.source!==e.contentWindow||!g.data)){if(g.data.penpal===b.Syn){h(g);return}if(g.data.penpal===b.Ack){const P=l(g);P&&(c(),p(P));return}}};window.addEventListener(A.Message,v),o("Parent: Awaiting handshake"),tt(e,u),i(g=>{window.removeEventListener(A.Message,v),g||(g=new Error("Connection destroyed"),g.code=L.ConnectionDestroyed),m(g)})}),destroy(){d()}}};const it="2.2.0",E={TEMPLATE_EDITOR_URL:"https://open.gaoding.com/design",MOBILE_TEMPLATE_EDITOR_URL:"https://open.gaoding.com/h5/design",KOUTU_EDITOR_URL:"https://open.gaoding.com/clip",IMAGE_EDITOR_URL:"https://open.gaoding.com/design/image",OPEN_PLATFORM_ORIGIN:"https://open.gaoding.com",get VERSION(){return it}};var Y=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function pe(t,e){const r=document.createElement("div");r.style.cssText=`
position: relative;

@@ -41,4 +41,4 @@ width: calc(100vw - 100px);

${t.css}
`,e.referrerPolicy="strict-origin-when-cross-origin",e.className="gaoding-iframe",e.setAttribute("frameborder","0");let r=null,n="";function a(d,y){return Y(this,null,function*(){const h=Object.assign({},y,{app_id:t.appId,v:E.VERSION}),l=`${d}?${Object.entries(h).filter(([f,p])=>p!==void 0).map(([f,p])=>`${f}=${p}`).join("&")}`;if(n!==l){if(n=l,!y){e.src=d;return}e.src=l,r&&r.destroy(),r=at({iframe:e,methods:t.methods})}})}let s=null;t.container||(s=pe(e,t.onClose));function o(){if(s)return s.open();const d=typeof t.container=="string"?document.body.querySelector(t.container):t.container;if(!d)throw new Error(`\u65E0\u6548\u7684 container ${t.container}`);d.appendChild(e)}function u(){if(s==null?void 0:s.close)return s.close();e.parentElement&&e.parentElement.removeChild(e)}function i(d){s=pe(e,t.onClose),t.container=d}return{remove:u,insert:o,update:a,iframe:e,restetContainer:i,getService(){return Y(this,null,function*(){return r.promise})}}}var st=Object.defineProperty,ot=(t,e,r)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ut=(t,e,r)=>(ot(t,typeof e!="symbol"?e+"":e,r),r),me=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});class j{constructor(){ut(this,"events"),this.events={}}add(e,r){if(!r)return()=>{};const n=this.get(e);return n.push(r),this.events[e]=n,()=>this.off(e,r)}on(e,r){return this.add(e,r)}once(e,r){const n=this.add(e,(...a)=>{n(),r(...a)});return n}off(e,r){const n=this.get(e);if(n){const a=n.findIndex(s=>s===r);n.splice(a,1)}}get(e){return this.events[e]||[]}invoke(e,...r){const n=[...this.get(e)];for(const a of n)a(...r)}emit(e,...r){this.invoke(e,...r)}asyncInvoke(e,...r){return me(this,null,function*(){const n=[...this.get(e)];for(const a of n)yield a(...r)})}asyncInvokeAll(e,...r){return me(this,null,function*(){yield Promise.all(this.get(e).map(n=>n(...r)))})}}var lt=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function ve(t){return lt(this,null,function*(){const e=t instanceof File?t.name:`${t.type}`;return new File([yield t.arrayBuffer()],e,{type:t.type})})}function S(t,e){if(!t)throw new Error(e)}var I=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function ct(t){const e=new j;let r=null,n=!1;const a=[];function s(){a.forEach(c=>c()),a.length=0}const o=B({appId:t.appId,container:t.container,onClose(){return I(this,null,function*(){if(t.onCloseModal&&(yield t.onCloseModal())===!1)return!1;e.emit("close")})},methods:{emit(c,...v){return I(this,null,function*(){e.emit(c,...v)})},onload(){return I(this,null,function*(){e.emit("load")})},onSelectTemplate(c){return I(this,null,function*(){return e.emit("select.template",c),!1})},onTemplateLoad(){return I(this,null,function*(){r=yield u(),e.emit("template.load")})},getUseRightToken(c){return I(this,null,function*(){if(!t.getUseRightCert)return!1;const v=yield t.getUseRightCert(c);return v instanceof Error?{message:v.message}:v})},getUserCode(){return I(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{h()}})}}});function u(){return I(this,null,function*(){const c=yield o.getService();return{addImage(v,g){return I(this,null,function*(){c.addImage(v,g)})}}})}function i(c={}){c.categoryId&&S(["number","string"].includes(typeof c.categoryId)&&!Number.isNaN(+c.categoryId),"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B"),s(),n=!1;const v={version:t.authorize?"TE002":"TE001",buttonText:c.okText||"\u4FDD\u5B58"};return c.templateId?v.id=c.templateId:(v.mode="create",c.size&&(v.width=c.size.width,v.height=c.size.height)),o.update(E.TEMPLATE_EDITOR_URL,v),e.once("load",()=>I(this,null,function*(){n=!0,yield(yield o.getService()).init({appId:t.appId,version:t.authorize?"TE002":"TE001",fileTypes:c.fileTypes,disableModules:c.disableModules,v:E.VERSION,filterPaidMaterial:c.filterPaidMaterial,categoryId:c.categoryId}),e.emit("editor.load")})),o.insert(),new Promise(g=>{a.push(e.once("save",P=>g(P))),a.push(e.once("close",()=>g(!1)))})}function d(c){return c.categories&&(S(Array.isArray(c.categories),"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B"),S(c.categories.map(v=>+v).filter(Boolean).length===c.categories.length,"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B")),s(),n=!1,o.update(E.TEMPLATE_EDITOR_URL,{id:c.id,buttonText:c.okText||"\u4FDD\u5B58",mode:"user",version:t.authorize?"TE002":"TE001"}),e.once("load",()=>I(this,null,function*(){var v;n=!0,yield(yield o.getService()).init({appId:t.appId,version:t.authorize?"TE002":"TE001",disableModules:c.disableModules,categoryId:(v=c.categories)==null?void 0:v.join(","),v:E.VERSION,filterPaidMaterial:c.filterPaidMaterial,fileTypes:c.fileTypes}),e.emit("editor.load")})),o.insert(),new Promise(v=>{a.push(e.once("save",g=>v(g))),a.push(e.once("close",()=>v(!1)))})}function y(c){return c.categories&&(S(Array.isArray(c.categories),"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B"),S(c.categories.map(v=>+v).filter(Boolean).length===c.categories.length,"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B")),n=!1,s(),o.update(E.OPEN_PLATFORM_ORIGIN+"/template/search",{app_id:t.appId,version:t.authorize?"TE002":"TE001"}),e.once("load",()=>I(this,null,function*(){n=!0,(yield o.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"TE002":"TE001",categories:c.categories})})),c.onSelectTemplate&&a.push(e.add("select.template",c.onSelectTemplate)),o.insert(),new Promise(v=>{a.push(e.once("select.template",g=>v(g))),a.push(e.once("close",()=>v(!1)))})}function h(){e.emit("close"),o.remove()}function l(c){e.add("save",c)}function f(c){e.add("close",c)}function p(c){e.add("editor.load",c)}function m(c){e.add("template.load",c)}return{get canva(){return r},get isLoad(){return n},openTemplateList:y,close:h,onSave:l,onTemplateLoad:m,onClose:f,onLoad:p,editDesign:d,createDesign:i}}var O=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function dt(t){S(!!t,"createTemplateEditor \u9700\u8981\u4F20\u5165\u53C2\u6570\u624D\u80FD\u4F7F\u7528"),S(typeof t.authorize=="function","authorize \u5FC5\u73B0\u662F\u4E2A function"),S(typeof t.container=="string","\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570 container"),S(typeof t.getUseRightCert=="function","\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570 getUseRightCert");const e=new j;let r=!1;const n=[];function a(){n.forEach(p=>p()),n.length=0}const s=B({appId:t.appId,container:t.container,css:"min-height: 100vh;",methods:{emit(p,...m){return O(this,null,function*(){e.emit(p,...m)})},onload(){return O(this,null,function*(){e.emit("load")})},onSelectTemplate(p){return O(this,null,function*(){return e.emit("select.template",p),!1})},onTemplateLoad(){return O(this,null,function*(){e.emit("template.load")})},getUseRightCert(p){return O(this,null,function*(){if(!t.getUseRightCert)return!1;const m=yield t.getUseRightCert(p);return m instanceof Error?{message:m.message}:m})},getUserCode(){return O(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{d()}})}}});function o(p){return O(this,null,function*(){a(),r=!1;const m=yield t.authorize(),c={version:"TE002",user_code:m};return p.templateId&&(c.id=p.templateId),s.update(E.MOBILE_TEMPLATE_EDITOR_URL,c),e.once("load",()=>O(this,null,function*(){r=!0,yield(yield s.getService()).init({appId:t.appId,version:"TE002"}),e.emit("editor.load")})),s.insert(),new Promise(v=>{n.push(e.once("save",g=>v(g))),n.push(e.once("close",()=>v(!1)))})})}function u(p){return a(),r=!1,s.update(E.MOBILE_TEMPLATE_EDITOR_URL,{id:p.id,mode:"user",version:"TE002"}),e.once("load",()=>O(this,null,function*(){r=!0,yield(yield s.getService()).init({appId:t.appId,version:"TE002",v:E.VERSION}),e.emit("editor.load")})),s.insert(),new Promise(m=>{n.push(e.once("save",c=>m(c))),n.push(e.once("close",()=>m(!1)))})}function i(p){return r=!1,a(),s.update(E.OPEN_PLATFORM_ORIGIN+"/mt/templates",{app_id:t.appId,version:"TE002"}),e.once("load",()=>O(this,null,function*(){r=!0,(yield s.getService()).init({appId:t.appId,v:E.VERSION,version:"TE002"})})),p.onSelectTemplate&&n.push(e.add("select.template",p.onSelectTemplate)),s.insert(),new Promise(m=>{n.push(e.once("select.template",c=>m(c))),n.push(e.once("close",()=>m(!1)))})}function d(){e.emit("close"),s.remove()}function y(p){e.add("save",p)}function h(p){e.add("close",p)}function l(p){e.add("editor.load",p)}function f(p){e.add("template.load",p)}return{get isLoad(){return r},openTemplateList:i,close:d,onSave:y,onTemplateLoad:f,onClose:h,onLoad:l,editDesign:u,createDesign:o}}var Z={exports:{}},ye=function(e,r){return function(){for(var a=new Array(arguments.length),s=0;s<a.length;s++)a[s]=arguments[s];return e.apply(r,a)}},ft=ye,U=Object.prototype.toString;function Q(t){return U.call(t)==="[object Array]"}function ee(t){return typeof t=="undefined"}function ht(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function pt(t){return U.call(t)==="[object ArrayBuffer]"}function mt(t){return typeof FormData!="undefined"&&t instanceof FormData}function vt(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function yt(t){return typeof t=="string"}function gt(t){return typeof t=="number"}function ge(t){return t!==null&&typeof t=="object"}function z(t){if(U.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Et(t){return U.call(t)==="[object Date]"}function wt(t){return U.call(t)==="[object File]"}function Ct(t){return U.call(t)==="[object Blob]"}function Ee(t){return U.call(t)==="[object Function]"}function bt(t){return ge(t)&&Ee(t.pipe)}function Rt(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function It(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Tt(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function te(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Q(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.call(null,t[a],a,t)}function re(){var t={};function e(a,s){z(t[s])&&z(a)?t[s]=re(t[s],a):z(a)?t[s]=re({},a):Q(a)?t[s]=a.slice():t[s]=a}for(var r=0,n=arguments.length;r<n;r++)te(arguments[r],e);return t}function St(t,e,r){return te(e,function(a,s){r&&typeof a=="function"?t[s]=ft(a,r):t[s]=a}),t}function xt(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var R={isArray:Q,isArrayBuffer:pt,isBuffer:ht,isFormData:mt,isArrayBufferView:vt,isString:yt,isNumber:gt,isObject:ge,isPlainObject:z,isUndefined:ee,isDate:Et,isFile:wt,isBlob:Ct,isFunction:Ee,isStream:bt,isURLSearchParams:Rt,isStandardBrowserEnv:Tt,forEach:te,merge:re,extend:St,trim:It,stripBOM:xt},M=R;function we(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Ce=function(e,r,n){if(!r)return e;var a;if(n)a=n(r);else if(M.isURLSearchParams(r))a=r.toString();else{var s=[];M.forEach(r,function(i,d){i===null||typeof i=="undefined"||(M.isArray(i)?d=d+"[]":i=[i],M.forEach(i,function(h){M.isDate(h)?h=h.toISOString():M.isObject(h)&&(h=JSON.stringify(h)),s.push(we(d)+"="+we(h))}))}),a=s.join("&")}if(a){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e},Ot=R;function q(){this.handlers=[]}q.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},q.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},q.prototype.forEach=function(e){Ot.forEach(this.handlers,function(n){n!==null&&e(n)})};var Pt=q,kt=R,_t=function(e,r){kt.forEach(e,function(a,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=a,delete e[s])})},be=function(e,r,n,a,s){return e.config=r,n&&(e.code=n),e.request=a,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},At=be,Re=function(e,r,n,a,s){var o=new Error(e);return At(o,r,n,a,s)},$t=Re,Nt=function(e,r,n){var a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):r($t("Request failed with status code "+n.status,n.config,null,n.request,n))},K=R,Ut=K.isStandardBrowserEnv()?function(){return{write:function(r,n,a,s,o,u){var i=[];i.push(r+"="+encodeURIComponent(n)),K.isNumber(a)&&i.push("expires="+new Date(a).toGMTString()),K.isString(s)&&i.push("path="+s),K.isString(o)&&i.push("domain="+o),u===!0&&i.push("secure"),document.cookie=i.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Lt=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Mt=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e},Dt=Lt,Ft=Mt,Bt=function(e,r){return e&&!Dt(r)?Ft(e,r):r},ne=R,jt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],zt=function(e){var r={},n,a,s;return e&&ne.forEach(e.split(`
`),function(u){if(s=u.indexOf(":"),n=ne.trim(u.substr(0,s)).toLowerCase(),a=ne.trim(u.substr(s+1)),n){if(r[n]&&jt.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([a]):r[n]=r[n]?r[n]+", "+a:a}}),r},Ie=R,qt=Ie.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function a(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=a(window.location.href),function(o){var u=Ie.isString(o)?a(o):o;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}(),H=R,Kt=Nt,Ht=Ut,Vt=Ce,Jt=Bt,Gt=zt,Wt=qt,ae=Re,Te=function(e){return new Promise(function(n,a){var s=e.data,o=e.headers,u=e.responseType;H.isFormData(s)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+y)}var h=Jt(e.baseURL,e.url);i.open(e.method.toUpperCase(),Vt(h,e.params,e.paramsSerializer),!0),i.timeout=e.timeout;function l(){if(!!i){var p="getAllResponseHeaders"in i?Gt(i.getAllResponseHeaders()):null,m=!u||u==="text"||u==="json"?i.responseText:i.response,c={data:m,status:i.status,statusText:i.statusText,headers:p,config:e,request:i};Kt(n,a,c),i=null}}if("onloadend"in i?i.onloadend=l:i.onreadystatechange=function(){!i||i.readyState!==4||i.status===0&&!(i.responseURL&&i.responseURL.indexOf("file:")===0)||setTimeout(l)},i.onabort=function(){!i||(a(ae("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){a(ae("Network Error",e,null,i)),i=null},i.ontimeout=function(){var m="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(m=e.timeoutErrorMessage),a(ae(m,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",i)),i=null},H.isStandardBrowserEnv()){var f=(e.withCredentials||Wt(h))&&e.xsrfCookieName?Ht.read(e.xsrfCookieName):void 0;f&&(o[e.xsrfHeaderName]=f)}"setRequestHeader"in i&&H.forEach(o,function(m,c){typeof s=="undefined"&&c.toLowerCase()==="content-type"?delete o[c]:i.setRequestHeader(c,m)}),H.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),u&&u!=="json"&&(i.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&i.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(m){!i||(i.abort(),a(m),i=null)}),s||(s=null),i.send(s)})},w=R,Se=_t,Xt=be,Yt={"Content-Type":"application/x-www-form-urlencoded"};function xe(t,e){!w.isUndefined(t)&&w.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Zt(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=Te),t}function Qt(t,e,r){if(w.isString(t))try{return(e||JSON.parse)(t),w.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var V={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Zt(),transformRequest:[function(e,r){return Se(r,"Accept"),Se(r,"Content-Type"),w.isFormData(e)||w.isArrayBuffer(e)||w.isBuffer(e)||w.isStream(e)||w.isFile(e)||w.isBlob(e)?e:w.isArrayBufferView(e)?e.buffer:w.isURLSearchParams(e)?(xe(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):w.isObject(e)||r&&r["Content-Type"]==="application/json"?(xe(r,"application/json"),Qt(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,a=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||a&&w.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Xt(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};V.headers={common:{Accept:"application/json, text/plain, */*"}},w.forEach(["delete","get","head"],function(e){V.headers[e]={}}),w.forEach(["post","put","patch"],function(e){V.headers[e]=w.merge(Yt)});var ie=V,er=R,tr=ie,rr=function(e,r,n){var a=this||tr;return er.forEach(n,function(o){e=o.call(a,e,r)}),e},Oe=function(e){return!!(e&&e.__CANCEL__)},Pe=R,se=rr,nr=Oe,ar=ie;function oe(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var ir=function(e){oe(e),e.headers=e.headers||{},e.data=se.call(e,e.data,e.headers,e.transformRequest),e.headers=Pe.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Pe.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]});var r=e.adapter||ar.adapter;return r(e).then(function(a){return oe(e),a.data=se.call(e,a.data,a.headers,e.transformResponse),a},function(a){return nr(a)||(oe(e),a&&a.response&&(a.response.data=se.call(e,a.response.data,a.response.headers,e.transformResponse))),Promise.reject(a)})},C=R,ke=function(e,r){r=r||{};var n={},a=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function i(l,f){return C.isPlainObject(l)&&C.isPlainObject(f)?C.merge(l,f):C.isPlainObject(f)?C.merge({},f):C.isArray(f)?f.slice():f}function d(l){C.isUndefined(r[l])?C.isUndefined(e[l])||(n[l]=i(void 0,e[l])):n[l]=i(e[l],r[l])}C.forEach(a,function(f){C.isUndefined(r[f])||(n[f]=i(void 0,r[f]))}),C.forEach(s,d),C.forEach(o,function(f){C.isUndefined(r[f])?C.isUndefined(e[f])||(n[f]=i(void 0,e[f])):n[f]=i(void 0,r[f])}),C.forEach(u,function(f){f in r?n[f]=i(e[f],r[f]):f in e&&(n[f]=i(void 0,e[f]))});var y=a.concat(s).concat(o).concat(u),h=Object.keys(e).concat(Object.keys(r)).filter(function(f){return y.indexOf(f)===-1});return C.forEach(h,d),n},sr={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},_e=sr,ue={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ue[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Ae={},or=_e.version.split(".");function $e(t,e){for(var r=e?e.split("."):or,n=t.split("."),a=0;a<3;a++){if(r[a]>n[a])return!0;if(r[a]<n[a])return!1}return!1}ue.transitional=function(e,r,n){var a=r&&$e(r);function s(o,u){return"[Axios v"+_e.version+"] Transitional option '"+o+"'"+u+(n?". "+n:"")}return function(o,u,i){if(e===!1)throw new Error(s(u," has been removed in "+r));return a&&!Ae[u]&&(Ae[u]=!0,console.warn(s(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,u,i):!0}};function ur(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),a=n.length;a-- >0;){var s=n[a],o=e[s];if(o){var u=t[s],i=u===void 0||o(u,s,t);if(i!==!0)throw new TypeError("option "+s+" must be "+i);continue}if(r!==!0)throw Error("Unknown option "+s)}}var lr={isOlderVersion:$e,assertOptions:ur,validators:ue},Ne=R,cr=Ce,Ue=Pt,Le=ir,J=ke,Me=lr,D=Me.validators;function F(t){this.defaults=t,this.interceptors={request:new Ue,response:new Ue}}F.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=J(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&Me.assertOptions(r,{silentJSONParsing:D.transitional(D.boolean,"1.0.0"),forcedJSONParsing:D.transitional(D.boolean,"1.0.0"),clarifyTimeoutError:D.transitional(D.boolean,"1.0.0")},!1);var n=[],a=!0;this.interceptors.request.forEach(function(l){typeof l.runWhen=="function"&&l.runWhen(e)===!1||(a=a&&l.synchronous,n.unshift(l.fulfilled,l.rejected))});var s=[];this.interceptors.response.forEach(function(l){s.push(l.fulfilled,l.rejected)});var o;if(!a){var u=[Le,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),o=Promise.resolve(e);u.length;)o=o.then(u.shift(),u.shift());return o}for(var i=e;n.length;){var d=n.shift(),y=n.shift();try{i=d(i)}catch(h){y(h);break}}try{o=Le(i)}catch(h){return Promise.reject(h)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},F.prototype.getUri=function(e){return e=J(this.defaults,e),cr(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Ne.forEach(["delete","get","head","options"],function(e){F.prototype[e]=function(r,n){return this.request(J(n||{},{method:e,url:r,data:(n||{}).data}))}}),Ne.forEach(["post","put","patch"],function(e){F.prototype[e]=function(r,n,a){return this.request(J(a||{},{method:e,url:r,data:n}))}});var dr=F;function le(t){this.message=t}le.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},le.prototype.__CANCEL__=!0;var De=le,fr=De;function G(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(a){e=a});var r=this;t(function(a){r.reason||(r.reason=new fr(a),e(r.reason))})}G.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},G.source=function(){var e,r=new G(function(a){e=a});return{token:r,cancel:e}};var hr=G,pr=function(e){return function(n){return e.apply(null,n)}},mr=function(e){return typeof e=="object"&&e.isAxiosError===!0},Fe=R,vr=ye,W=dr,yr=ke,gr=ie;function Be(t){var e=new W(t),r=vr(W.prototype.request,e);return Fe.extend(r,W.prototype,e),Fe.extend(r,e),r}var x=Be(gr);x.Axios=W,x.create=function(e){return Be(yr(x.defaults,e))},x.Cancel=De,x.CancelToken=hr,x.isCancel=Oe,x.all=function(e){return Promise.all(e)},x.spread=pr,x.isAxiosError=mr,Z.exports=x,Z.exports.default=x;var Er=Z.exports,wr=Object.defineProperty,Cr=(t,e,r)=>e in t?wr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,br=(t,e,r)=>(Cr(t,typeof e!="symbol"?e+"":e,r),r),ce=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});class Rr{constructor(){br(this,"axios"),this.axios=Er.create({baseURL:E.OPEN_PLATFORM_ORIGIN})}createKoutuRecord(e){return ce(this,null,function*(){const r=e.url,n=yield this.axios.get(r,{responseType:"arraybuffer"}).then(u=>u.data),{width:a,height:s}=yield new Promise(u=>{const i=document.createElement("img");i.src=r,i.onload=()=>{u({width:i.width,height:i.height})}});return(yield this.axios.post("/sdk/api/koutu-records",{url:r,size:n.byteLength,width:a,height:s},{headers:{authorization:`Bearer ${e.token}`}})).data.work_id})}koutu(e){return ce(this,null,function*(){return(yield this.axios.post("/sdk/api/koutus",{app_id:e.appId,url:e.url,ability_code:e.abilityCode,work_id:e.workId,use_cert:e.useCert},{headers:{authorization:`Bearer ${e.token}`}})).data.result})}createAuth(e){return ce(this,null,function*(){return(yield this.axios.post("/sdk/api/auths",{code:e})).data.access_token})}}var k=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function Ir(t){const e=new j,r=B({appId:t.appId,container:t.container,methods:{emit(h,...l){return k(this,null,function*(){e.emit(h,...l)})},onload(){e.emit("load")},getUseRightToken(h){return k(this,null,function*(){if(!t.getUseRightCert)return!1;const l=yield t.getUseRightCert(h);return l instanceof Error?{message:l.message}:l})},getUserCode(){return k(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{y()}})},download(h){return k(this,null,function*(){e.emit("save",h)})}}}),n=[];function a(){n.forEach(h=>h()),n.length=0}function s(h){return k(this,null,function*(){return a(),r.update(E.KOUTU_EDITOR_URL,{version:t.authorize?"KE002":"KE001"}),r.insert(),e.once("load",()=>k(this,null,function*(){(yield r.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"KE002":"KE001"});const f=typeof h=="string"?h:yield ve(h);(yield r.getService()).importFile(f)})),new Promise(l=>{n.push(e.once("save",f=>l(f))),n.push(e.once("close",()=>l(!1)))})})}function o(h){return k(this,null,function*(){return S(Number.isInteger(+h),`\u65E0\u6548\u7684ID ${h}`),a(),r.update(E.KOUTU_EDITOR_URL,{id:h,mode:"user",version:t.authorize?"KE002":"KE001"}),r.insert(),e.once("load",()=>k(this,null,function*(){const l=yield r.getService();l.init({appId:t.appId,v:E.VERSION,version:t.authorize?"KE002":"KE001"}),l.openWork(h)})),new Promise(l=>{n.push(e.once("save",f=>l(f))),n.push(e.once("close",()=>l(!1)))})})}function u(h){return k(this,null,function*(){if(S(typeof h=="string","url \u5FC5\u987B\u662F url \u683C\u5F0F"),!t.authorize||!t.getUseRightCert)throw new Error("\u7F3A\u5C11 authorize \u6216\u8005 getUseRightCert \u53C2\u6570");const l=new Rr,f=yield t.authorize(),p=yield l.createAuth(f),m=yield l.createKoutuRecord({token:p,url:h}),c=yield t.getUseRightCert({abilityCode:"KE002",appId:t.appId,workId:m});if(c){if(c instanceof Error)throw c}else throw new Error("\u6CA1\u6709\u6743\u9650");return{result:yield l.koutu({url:h,appId:t.appId,workId:m,abilityCode:"KE002",useCert:c,token:p}),workId:m}})}function i(h){e.add("save",h)}function d(h){e.add("close",h)}function y(){e.emit("close"),r.remove()}return{onSave:i,onClose:d,close:y,koutu:u,editKoutu:o,importImage:s}}var _=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function Tr(t){const e=new j,r=[];function n(){r.forEach(l=>l()),r.length=0}const a=B({container:t.container,appId:t.appId,methods:{emit(l,...f){return _(this,null,function*(){e.emit(l,...f)})},onload(){e.emit("load")},getUseRightToken(l){return _(this,null,function*(){if(!t.getUseRightCert)return!1;const f=yield t.getUseRightCert(l);return f instanceof Error?{message:f.message}:f})},getUserCode(){return _(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{d()}})},download(l){return _(this,null,function*(){e.emit("save",l)})}}});function s(l,f){e.on(l,f)}function o(l,f){e.off(l,f)}function u(l){return _(this,arguments,function*(f,p={}){return n(),a.update(E.IMAGE_EDITOR_URL,{version:t.authorize?"IE002":"IE001"}),a.insert(),e.once("load",()=>_(this,null,function*(){(yield a.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"IE002":"IE001",fileTypes:p.fileTypes,disableModules:p.disableModules});const c=yield a.getService(),v=yield Promise.all((Array.isArray(f)?f:[f]).map(g=>_(this,null,function*(){return typeof g=="string"?g:yield ve(g)})));c.importFile(v)})),new Promise(m=>{r.push(e.once("save",c=>m(c))),r.push(e.once("close",()=>m(!1)))})})}function i(l){return _(this,arguments,function*(f,p={}){return n(),a.update(E.IMAGE_EDITOR_URL,{id:f,mode:"user",version:t.authorize?"IE002":"IE001"}),a.insert(),e.once("load",()=>_(this,null,function*(){(yield a.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"IE002":"IE001",fileTypes:p.fileTypes,disableModules:p.disableModules})})),new Promise(m=>{r.push(e.once("save",c=>m(c))),r.push(e.once("close",()=>m(!1)))})})}function d(){e.emit("close"),a.remove()}function y(l){e.add("save",l)}function h(l){e.add("close",l)}return{editImage:i,close:d,onSave:y,onClose:h,importImage:u,on:s,off:o}}T.createImageEditor=Tr,T.createKoutuEditor=Ir,T.createMobileTemplateEditor=dt,T.createTemplateEditor=ct,T.env=E,Object.defineProperty(T,"__esModule",{value:!0}),T[Symbol.toStringTag]="Module"});
`,e.referrerPolicy="strict-origin-when-cross-origin",e.className="gaoding-iframe",e.setAttribute("frameborder","0");let r=null,n="";function a(d,y){return Y(this,null,function*(){const h=Object.assign({},y,{app_id:t.appId,v:E.VERSION}),l=`${d}?${Object.entries(h).filter(([f,p])=>p!==void 0).map(([f,p])=>`${f}=${p}`).join("&")}`;if(n!==l){if(n=l,!y){e.src=d;return}e.src=l,r&&r.destroy(),r=at({iframe:e,methods:t.methods})}})}let s=null;t.container||(s=pe(e,t.onClose));function o(){if(s)return s.open();const d=typeof t.container=="string"?document.body.querySelector(t.container):t.container;if(!d)throw new Error(`\u65E0\u6548\u7684 container ${t.container}`);d.appendChild(e)}function u(){if(s==null?void 0:s.close)return s.close();e.parentElement&&e.parentElement.removeChild(e)}function i(d){s=pe(e,t.onClose),t.container=d}return{remove:u,insert:o,update:a,iframe:e,restetContainer:i,getService(){return Y(this,null,function*(){return r.promise})}}}var st=Object.defineProperty,ot=(t,e,r)=>e in t?st(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,ut=(t,e,r)=>(ot(t,typeof e!="symbol"?e+"":e,r),r),me=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});class j{constructor(){ut(this,"events"),this.events={}}add(e,r){if(!r)return()=>{};const n=this.get(e);return n.push(r),this.events[e]=n,()=>this.off(e,r)}on(e,r){return this.add(e,r)}once(e,r){const n=this.add(e,(...a)=>{n(),r(...a)});return n}off(e,r){const n=this.get(e);if(n){const a=n.findIndex(s=>s===r);n.splice(a,1)}}get(e){return this.events[e]||[]}invoke(e,...r){const n=[...this.get(e)];for(const a of n)a(...r)}emit(e,...r){this.invoke(e,...r)}asyncInvoke(e,...r){return me(this,null,function*(){const n=[...this.get(e)];for(const a of n)yield a(...r)})}asyncInvokeAll(e,...r){return me(this,null,function*(){yield Promise.all(this.get(e).map(n=>n(...r)))})}}var lt=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function ve(t){return lt(this,null,function*(){const e=t instanceof File?t.name:`${t.type}`;return new File([yield t.arrayBuffer()],e,{type:t.type})})}function S(t,e){if(!t)throw new Error(e)}var I=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function ct(t){const e=new j;let r=null,n=!1;const a=[];function s(){a.forEach(c=>c()),a.length=0}const o=B({appId:t.appId,container:t.container,onClose(){return I(this,null,function*(){if(t.onCloseModal&&(yield t.onCloseModal())===!1)return!1;e.emit("close")})},methods:{emit(c,...v){return I(this,null,function*(){e.emit(c,...v)})},onload(){return I(this,null,function*(){e.emit("load")})},onSelectTemplate(c){return I(this,null,function*(){return e.emit("select.template",c),!1})},onTemplateLoad(){return I(this,null,function*(){r=yield u(),e.emit("template.load")})},getUseRightToken(c){return I(this,null,function*(){if(!t.getUseRightCert)return!1;const v=yield t.getUseRightCert(c);return v instanceof Error?{message:v.message}:v})},getUserCode(){return I(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{h()}})}}});function u(){return I(this,null,function*(){const c=yield o.getService();return{addImage(v,g){return I(this,null,function*(){c.addImage(v,g)})}}})}function i(c={}){c.categoryId&&S(["number","string"].includes(typeof c.categoryId)&&!Number.isNaN(+c.categoryId),"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B"),s(),n=!1;const v={version:t.authorize?"TE002":"TE001",buttonText:c.okText||"\u4FDD\u5B58"};return c.templateId?v.id=c.templateId:(v.mode="create",c.size&&(v.width=c.size.width,v.height=c.size.height)),o.update(E.TEMPLATE_EDITOR_URL,v),e.once("load",()=>I(this,null,function*(){n=!0,yield(yield o.getService()).init({appId:t.appId,version:t.authorize?"TE002":"TE001",fileTypes:c.fileTypes,disableModules:c.disableModules,v:E.VERSION,filterPaidMaterial:c.filterPaidMaterial,categoryId:c.categoryId}),e.emit("editor.load")})),o.insert(),new Promise(g=>{a.push(e.once("save",P=>g(P))),a.push(e.once("close",()=>g(!1)))})}function d(c){return c.categories&&(S(Array.isArray(c.categories),"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B"),S(c.categories.map(v=>+v).filter(Boolean).length===c.categories.length,"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B")),s(),n=!1,o.update(E.TEMPLATE_EDITOR_URL,{id:c.id,buttonText:c.okText||"\u4FDD\u5B58",mode:"user",version:t.authorize?"TE002":"TE001"}),e.once("load",()=>I(this,null,function*(){var v;n=!0,yield(yield o.getService()).init({appId:t.appId,version:t.authorize?"TE002":"TE001",disableModules:c.disableModules,categoryId:(v=c.categories)==null?void 0:v.join(","),v:E.VERSION,filterPaidMaterial:c.filterPaidMaterial,fileTypes:c.fileTypes}),e.emit("editor.load")})),o.insert(),new Promise(v=>{a.push(e.once("save",g=>v(g))),a.push(e.once("close",()=>v(!1)))})}function y(c){return c.categories&&(S(Array.isArray(c.categories),"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B"),S(c.categories.map(v=>+v).filter(Boolean).length===c.categories.length,"categories \u53C2\u6570\u5FC5\u987B\u662F number \u6570\u7EC4\u7C7B\u578B")),n=!1,s(),o.update(E.OPEN_PLATFORM_ORIGIN+"/template/search",{app_id:t.appId,version:t.authorize?"TE002":"TE001"}),e.once("load",()=>I(this,null,function*(){n=!0,(yield o.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"TE002":"TE001",categories:c.categories})})),c.onSelectTemplate&&a.push(e.add("select.template",c.onSelectTemplate)),o.insert(),new Promise(v=>{a.push(e.once("select.template",g=>v(g))),a.push(e.once("close",()=>v(!1)))})}function h(){e.emit("close"),o.remove()}function l(c){e.add("save",c)}function f(c){e.add("close",c)}function p(c){e.add("editor.load",c)}function m(c){e.add("template.load",c)}return{get canva(){return r},get isLoad(){return n},openTemplateList:y,close:h,onSave:l,onTemplateLoad:m,onClose:f,onLoad:p,editDesign:d,createDesign:i}}var x=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function dt(t){S(!!t,"createTemplateEditor \u9700\u8981\u4F20\u5165\u53C2\u6570\u624D\u80FD\u4F7F\u7528"),S(typeof t.authorize=="function","authorize \u5FC5\u73B0\u662F\u4E2A function"),S(typeof t.container=="string","\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570 container"),S(typeof t.getUseRightCert=="function","\u7F3A\u5C11\u5FC5\u586B\u53C2\u6570 getUseRightCert");const e=new j;let r=!1;const n=[];function a(){n.forEach(p=>p()),n.length=0}const s=B({appId:t.appId,container:t.container,css:"min-height: 100vh;",methods:{emit(p,...m){return x(this,null,function*(){e.emit(p,...m)})},onload(){return x(this,null,function*(){e.emit("load")})},onSelectTemplate(p){return x(this,null,function*(){return e.emit("select.template",p),!1})},onTemplateLoad(){return x(this,null,function*(){e.emit("template.load")})},getUseRightCert(p){return x(this,null,function*(){if(!t.getUseRightCert)return!1;const m=yield t.getUseRightCert(p);return m instanceof Error?{message:m.message}:m})},getUserCode(){return x(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{d()}})}}});function o(p){return x(this,null,function*(){a(),r=!1;const m=yield t.authorize(),c={version:"TE002",user_code:m};return p.templateId&&(c.id=p.templateId),s.update(E.MOBILE_TEMPLATE_EDITOR_URL,c),e.once("load",()=>x(this,null,function*(){r=!0,yield(yield s.getService()).init({appId:t.appId,version:"TE002"}),e.emit("editor.load")})),s.insert(),new Promise(v=>{n.push(e.once("save",g=>v(g))),n.push(e.once("close",()=>v(!1)))})})}function u(p){return x(this,null,function*(){a(),r=!1;const m=yield t.authorize();return s.update(E.MOBILE_TEMPLATE_EDITOR_URL,{id:p.id,mode:"user",user_code:m,version:"TE002"}),e.once("load",()=>x(this,null,function*(){r=!0,yield(yield s.getService()).init({appId:t.appId,version:"TE002",v:E.VERSION}),e.emit("editor.load")})),s.insert(),new Promise(c=>{n.push(e.once("save",v=>c(v))),n.push(e.once("close",()=>c(!1)))})})}function i(p){return r=!1,a(),s.update(E.OPEN_PLATFORM_ORIGIN+"/mt/templates",{app_id:t.appId,version:"TE002"}),e.once("load",()=>x(this,null,function*(){r=!0,(yield s.getService()).init({appId:t.appId,v:E.VERSION,version:"TE002"})})),p.onSelectTemplate&&n.push(e.add("select.template",p.onSelectTemplate)),s.insert(),new Promise(m=>{n.push(e.once("select.template",c=>m(c))),n.push(e.once("close",()=>m(!1)))})}function d(){e.emit("close"),s.remove()}function y(p){e.add("save",p)}function h(p){e.add("close",p)}function l(p){e.add("editor.load",p)}function f(p){e.add("template.load",p)}return{get isLoad(){return r},openTemplateList:i,close:d,onSave:y,onTemplateLoad:f,onClose:h,onLoad:l,editDesign:u,createDesign:o}}var Z={exports:{}},ye=function(e,r){return function(){for(var a=new Array(arguments.length),s=0;s<a.length;s++)a[s]=arguments[s];return e.apply(r,a)}},ft=ye,U=Object.prototype.toString;function Q(t){return U.call(t)==="[object Array]"}function ee(t){return typeof t=="undefined"}function ht(t){return t!==null&&!ee(t)&&t.constructor!==null&&!ee(t.constructor)&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function pt(t){return U.call(t)==="[object ArrayBuffer]"}function mt(t){return typeof FormData!="undefined"&&t instanceof FormData}function vt(t){var e;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&t.buffer instanceof ArrayBuffer,e}function yt(t){return typeof t=="string"}function gt(t){return typeof t=="number"}function ge(t){return t!==null&&typeof t=="object"}function z(t){if(U.call(t)!=="[object Object]")return!1;var e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function Et(t){return U.call(t)==="[object Date]"}function wt(t){return U.call(t)==="[object File]"}function Ct(t){return U.call(t)==="[object Blob]"}function Ee(t){return U.call(t)==="[object Function]"}function bt(t){return ge(t)&&Ee(t.pipe)}function Rt(t){return typeof URLSearchParams!="undefined"&&t instanceof URLSearchParams}function It(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Tt(){return typeof navigator!="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window!="undefined"&&typeof document!="undefined"}function te(t,e){if(!(t===null||typeof t=="undefined"))if(typeof t!="object"&&(t=[t]),Q(t))for(var r=0,n=t.length;r<n;r++)e.call(null,t[r],r,t);else for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&e.call(null,t[a],a,t)}function re(){var t={};function e(a,s){z(t[s])&&z(a)?t[s]=re(t[s],a):z(a)?t[s]=re({},a):Q(a)?t[s]=a.slice():t[s]=a}for(var r=0,n=arguments.length;r<n;r++)te(arguments[r],e);return t}function St(t,e,r){return te(e,function(a,s){r&&typeof a=="function"?t[s]=ft(a,r):t[s]=a}),t}function xt(t){return t.charCodeAt(0)===65279&&(t=t.slice(1)),t}var R={isArray:Q,isArrayBuffer:pt,isBuffer:ht,isFormData:mt,isArrayBufferView:vt,isString:yt,isNumber:gt,isObject:ge,isPlainObject:z,isUndefined:ee,isDate:Et,isFile:wt,isBlob:Ct,isFunction:Ee,isStream:bt,isURLSearchParams:Rt,isStandardBrowserEnv:Tt,forEach:te,merge:re,extend:St,trim:It,stripBOM:xt},M=R;function we(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Ce=function(e,r,n){if(!r)return e;var a;if(n)a=n(r);else if(M.isURLSearchParams(r))a=r.toString();else{var s=[];M.forEach(r,function(i,d){i===null||typeof i=="undefined"||(M.isArray(i)?d=d+"[]":i=[i],M.forEach(i,function(h){M.isDate(h)?h=h.toISOString():M.isObject(h)&&(h=JSON.stringify(h)),s.push(we(d)+"="+we(h))}))}),a=s.join("&")}if(a){var o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e},Ot=R;function q(){this.handlers=[]}q.prototype.use=function(e,r,n){return this.handlers.push({fulfilled:e,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1},q.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},q.prototype.forEach=function(e){Ot.forEach(this.handlers,function(n){n!==null&&e(n)})};var Pt=q,_t=R,kt=function(e,r){_t.forEach(e,function(a,s){s!==r&&s.toUpperCase()===r.toUpperCase()&&(e[r]=a,delete e[s])})},be=function(e,r,n,a,s){return e.config=r,n&&(e.code=n),e.request=a,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},At=be,Re=function(e,r,n,a,s){var o=new Error(e);return At(o,r,n,a,s)},$t=Re,Nt=function(e,r,n){var a=n.config.validateStatus;!n.status||!a||a(n.status)?e(n):r($t("Request failed with status code "+n.status,n.config,null,n.request,n))},K=R,Ut=K.isStandardBrowserEnv()?function(){return{write:function(r,n,a,s,o,u){var i=[];i.push(r+"="+encodeURIComponent(n)),K.isNumber(a)&&i.push("expires="+new Date(a).toGMTString()),K.isString(s)&&i.push("path="+s),K.isString(o)&&i.push("domain="+o),u===!0&&i.push("secure"),document.cookie=i.join("; ")},read:function(r){var n=document.cookie.match(new RegExp("(^|;\\s*)("+r+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(r){this.write(r,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),Lt=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},Mt=function(e,r){return r?e.replace(/\/+$/,"")+"/"+r.replace(/^\/+/,""):e},Dt=Lt,Ft=Mt,Bt=function(e,r){return e&&!Dt(r)?Ft(e,r):r},ne=R,jt=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],zt=function(e){var r={},n,a,s;return e&&ne.forEach(e.split(`
`),function(u){if(s=u.indexOf(":"),n=ne.trim(u.substr(0,s)).toLowerCase(),a=ne.trim(u.substr(s+1)),n){if(r[n]&&jt.indexOf(n)>=0)return;n==="set-cookie"?r[n]=(r[n]?r[n]:[]).concat([a]):r[n]=r[n]?r[n]+", "+a:a}}),r},Ie=R,qt=Ie.isStandardBrowserEnv()?function(){var e=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a"),n;function a(s){var o=s;return e&&(r.setAttribute("href",o),o=r.href),r.setAttribute("href",o),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return n=a(window.location.href),function(o){var u=Ie.isString(o)?a(o):o;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}(),H=R,Kt=Nt,Ht=Ut,Vt=Ce,Jt=Bt,Gt=zt,Wt=qt,ae=Re,Te=function(e){return new Promise(function(n,a){var s=e.data,o=e.headers,u=e.responseType;H.isFormData(s)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",y=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(d+":"+y)}var h=Jt(e.baseURL,e.url);i.open(e.method.toUpperCase(),Vt(h,e.params,e.paramsSerializer),!0),i.timeout=e.timeout;function l(){if(!!i){var p="getAllResponseHeaders"in i?Gt(i.getAllResponseHeaders()):null,m=!u||u==="text"||u==="json"?i.responseText:i.response,c={data:m,status:i.status,statusText:i.statusText,headers:p,config:e,request:i};Kt(n,a,c),i=null}}if("onloadend"in i?i.onloadend=l:i.onreadystatechange=function(){!i||i.readyState!==4||i.status===0&&!(i.responseURL&&i.responseURL.indexOf("file:")===0)||setTimeout(l)},i.onabort=function(){!i||(a(ae("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){a(ae("Network Error",e,null,i)),i=null},i.ontimeout=function(){var m="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(m=e.timeoutErrorMessage),a(ae(m,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",i)),i=null},H.isStandardBrowserEnv()){var f=(e.withCredentials||Wt(h))&&e.xsrfCookieName?Ht.read(e.xsrfCookieName):void 0;f&&(o[e.xsrfHeaderName]=f)}"setRequestHeader"in i&&H.forEach(o,function(m,c){typeof s=="undefined"&&c.toLowerCase()==="content-type"?delete o[c]:i.setRequestHeader(c,m)}),H.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),u&&u!=="json"&&(i.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&i.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(m){!i||(i.abort(),a(m),i=null)}),s||(s=null),i.send(s)})},w=R,Se=kt,Xt=be,Yt={"Content-Type":"application/x-www-form-urlencoded"};function xe(t,e){!w.isUndefined(t)&&w.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}function Zt(){var t;return(typeof XMLHttpRequest!="undefined"||typeof process!="undefined"&&Object.prototype.toString.call(process)==="[object process]")&&(t=Te),t}function Qt(t,e,r){if(w.isString(t))try{return(e||JSON.parse)(t),w.trim(t)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(t)}var V={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:Zt(),transformRequest:[function(e,r){return Se(r,"Accept"),Se(r,"Content-Type"),w.isFormData(e)||w.isArrayBuffer(e)||w.isBuffer(e)||w.isStream(e)||w.isFile(e)||w.isBlob(e)?e:w.isArrayBufferView(e)?e.buffer:w.isURLSearchParams(e)?(xe(r,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):w.isObject(e)||r&&r["Content-Type"]==="application/json"?(xe(r,"application/json"),Qt(e)):e}],transformResponse:[function(e){var r=this.transitional,n=r&&r.silentJSONParsing,a=r&&r.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||a&&w.isString(e)&&e.length)try{return JSON.parse(e)}catch(o){if(s)throw o.name==="SyntaxError"?Xt(o,this,"E_JSON_PARSE"):o}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};V.headers={common:{Accept:"application/json, text/plain, */*"}},w.forEach(["delete","get","head"],function(e){V.headers[e]={}}),w.forEach(["post","put","patch"],function(e){V.headers[e]=w.merge(Yt)});var ie=V,er=R,tr=ie,rr=function(e,r,n){var a=this||tr;return er.forEach(n,function(o){e=o.call(a,e,r)}),e},Oe=function(e){return!!(e&&e.__CANCEL__)},Pe=R,se=rr,nr=Oe,ar=ie;function oe(t){t.cancelToken&&t.cancelToken.throwIfRequested()}var ir=function(e){oe(e),e.headers=e.headers||{},e.data=se.call(e,e.data,e.headers,e.transformRequest),e.headers=Pe.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Pe.forEach(["delete","get","head","post","put","patch","common"],function(a){delete e.headers[a]});var r=e.adapter||ar.adapter;return r(e).then(function(a){return oe(e),a.data=se.call(e,a.data,a.headers,e.transformResponse),a},function(a){return nr(a)||(oe(e),a&&a.response&&(a.response.data=se.call(e,a.response.data,a.response.headers,e.transformResponse))),Promise.reject(a)})},C=R,_e=function(e,r){r=r||{};var n={},a=["url","method","data"],s=["headers","auth","proxy","params"],o=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],u=["validateStatus"];function i(l,f){return C.isPlainObject(l)&&C.isPlainObject(f)?C.merge(l,f):C.isPlainObject(f)?C.merge({},f):C.isArray(f)?f.slice():f}function d(l){C.isUndefined(r[l])?C.isUndefined(e[l])||(n[l]=i(void 0,e[l])):n[l]=i(e[l],r[l])}C.forEach(a,function(f){C.isUndefined(r[f])||(n[f]=i(void 0,r[f]))}),C.forEach(s,d),C.forEach(o,function(f){C.isUndefined(r[f])?C.isUndefined(e[f])||(n[f]=i(void 0,e[f])):n[f]=i(void 0,r[f])}),C.forEach(u,function(f){f in r?n[f]=i(e[f],r[f]):f in e&&(n[f]=i(void 0,e[f]))});var y=a.concat(s).concat(o).concat(u),h=Object.keys(e).concat(Object.keys(r)).filter(function(f){return y.indexOf(f)===-1});return C.forEach(h,d),n},sr={name:"axios",version:"0.21.4",description:"Promise based HTTP client for the browser and node.js",main:"index.js",scripts:{test:"grunt test",start:"node ./sandbox/server.js",build:"NODE_ENV=production grunt build",preversion:"npm test",version:"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json",postversion:"git push && git push --tags",examples:"node ./examples/server.js",coveralls:"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",fix:"eslint --fix lib/**/*.js"},repository:{type:"git",url:"https://github.com/axios/axios.git"},keywords:["xhr","http","ajax","promise","node"],author:"Matt Zabriskie",license:"MIT",bugs:{url:"https://github.com/axios/axios/issues"},homepage:"https://axios-http.com",devDependencies:{coveralls:"^3.0.0","es6-promise":"^4.2.4",grunt:"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1",karma:"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2",minimist:"^1.2.0",mocha:"^8.2.1",sinon:"^4.5.0","terser-webpack-plugin":"^4.2.3",typescript:"^4.0.5","url-search-params":"^0.10.0",webpack:"^4.44.2","webpack-dev-server":"^3.11.0"},browser:{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},jsdelivr:"dist/axios.min.js",unpkg:"dist/axios.min.js",typings:"./index.d.ts",dependencies:{"follow-redirects":"^1.14.0"},bundlesize:[{path:"./dist/axios.min.js",threshold:"5kB"}]},ke=sr,ue={};["object","boolean","number","function","string","symbol"].forEach(function(t,e){ue[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}});var Ae={},or=ke.version.split(".");function $e(t,e){for(var r=e?e.split("."):or,n=t.split("."),a=0;a<3;a++){if(r[a]>n[a])return!0;if(r[a]<n[a])return!1}return!1}ue.transitional=function(e,r,n){var a=r&&$e(r);function s(o,u){return"[Axios v"+ke.version+"] Transitional option '"+o+"'"+u+(n?". "+n:"")}return function(o,u,i){if(e===!1)throw new Error(s(u," has been removed in "+r));return a&&!Ae[u]&&(Ae[u]=!0,console.warn(s(u," has been deprecated since v"+r+" and will be removed in the near future"))),e?e(o,u,i):!0}};function ur(t,e,r){if(typeof t!="object")throw new TypeError("options must be an object");for(var n=Object.keys(t),a=n.length;a-- >0;){var s=n[a],o=e[s];if(o){var u=t[s],i=u===void 0||o(u,s,t);if(i!==!0)throw new TypeError("option "+s+" must be "+i);continue}if(r!==!0)throw Error("Unknown option "+s)}}var lr={isOlderVersion:$e,assertOptions:ur,validators:ue},Ne=R,cr=Ce,Ue=Pt,Le=ir,J=_e,Me=lr,D=Me.validators;function F(t){this.defaults=t,this.interceptors={request:new Ue,response:new Ue}}F.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{},e.url=arguments[0]):e=e||{},e=J(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&Me.assertOptions(r,{silentJSONParsing:D.transitional(D.boolean,"1.0.0"),forcedJSONParsing:D.transitional(D.boolean,"1.0.0"),clarifyTimeoutError:D.transitional(D.boolean,"1.0.0")},!1);var n=[],a=!0;this.interceptors.request.forEach(function(l){typeof l.runWhen=="function"&&l.runWhen(e)===!1||(a=a&&l.synchronous,n.unshift(l.fulfilled,l.rejected))});var s=[];this.interceptors.response.forEach(function(l){s.push(l.fulfilled,l.rejected)});var o;if(!a){var u=[Le,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(s),o=Promise.resolve(e);u.length;)o=o.then(u.shift(),u.shift());return o}for(var i=e;n.length;){var d=n.shift(),y=n.shift();try{i=d(i)}catch(h){y(h);break}}try{o=Le(i)}catch(h){return Promise.reject(h)}for(;s.length;)o=o.then(s.shift(),s.shift());return o},F.prototype.getUri=function(e){return e=J(this.defaults,e),cr(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Ne.forEach(["delete","get","head","options"],function(e){F.prototype[e]=function(r,n){return this.request(J(n||{},{method:e,url:r,data:(n||{}).data}))}}),Ne.forEach(["post","put","patch"],function(e){F.prototype[e]=function(r,n,a){return this.request(J(a||{},{method:e,url:r,data:n}))}});var dr=F;function le(t){this.message=t}le.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},le.prototype.__CANCEL__=!0;var De=le,fr=De;function G(t){if(typeof t!="function")throw new TypeError("executor must be a function.");var e;this.promise=new Promise(function(a){e=a});var r=this;t(function(a){r.reason||(r.reason=new fr(a),e(r.reason))})}G.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},G.source=function(){var e,r=new G(function(a){e=a});return{token:r,cancel:e}};var hr=G,pr=function(e){return function(n){return e.apply(null,n)}},mr=function(e){return typeof e=="object"&&e.isAxiosError===!0},Fe=R,vr=ye,W=dr,yr=_e,gr=ie;function Be(t){var e=new W(t),r=vr(W.prototype.request,e);return Fe.extend(r,W.prototype,e),Fe.extend(r,e),r}var O=Be(gr);O.Axios=W,O.create=function(e){return Be(yr(O.defaults,e))},O.Cancel=De,O.CancelToken=hr,O.isCancel=Oe,O.all=function(e){return Promise.all(e)},O.spread=pr,O.isAxiosError=mr,Z.exports=O,Z.exports.default=O;var Er=Z.exports,wr=Object.defineProperty,Cr=(t,e,r)=>e in t?wr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,br=(t,e,r)=>(Cr(t,typeof e!="symbol"?e+"":e,r),r),ce=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});class Rr{constructor(){br(this,"axios"),this.axios=Er.create({baseURL:E.OPEN_PLATFORM_ORIGIN})}createKoutuRecord(e){return ce(this,null,function*(){const r=e.url,n=yield this.axios.get(r,{responseType:"arraybuffer"}).then(u=>u.data),{width:a,height:s}=yield new Promise(u=>{const i=document.createElement("img");i.src=r,i.onload=()=>{u({width:i.width,height:i.height})}});return(yield this.axios.post("/sdk/api/koutu-records",{url:r,size:n.byteLength,width:a,height:s},{headers:{authorization:`Bearer ${e.token}`}})).data.work_id})}koutu(e){return ce(this,null,function*(){return(yield this.axios.post("/sdk/api/koutus",{app_id:e.appId,url:e.url,ability_code:e.abilityCode,work_id:e.workId,use_cert:e.useCert},{headers:{authorization:`Bearer ${e.token}`}})).data.result})}createAuth(e){return ce(this,null,function*(){return(yield this.axios.post("/sdk/api/auths",{code:e})).data.access_token})}}var _=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function Ir(t){const e=new j,r=B({appId:t.appId,container:t.container,methods:{emit(h,...l){return _(this,null,function*(){e.emit(h,...l)})},onload(){e.emit("load")},getUseRightToken(h){return _(this,null,function*(){if(!t.getUseRightCert)return!1;const l=yield t.getUseRightCert(h);return l instanceof Error?{message:l.message}:l})},getUserCode(){return _(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{y()}})},download(h){return _(this,null,function*(){e.emit("save",h)})}}}),n=[];function a(){n.forEach(h=>h()),n.length=0}function s(h){return _(this,null,function*(){return a(),r.update(E.KOUTU_EDITOR_URL,{version:t.authorize?"KE002":"KE001"}),r.insert(),e.once("load",()=>_(this,null,function*(){(yield r.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"KE002":"KE001"});const f=typeof h=="string"?h:yield ve(h);(yield r.getService()).importFile(f)})),new Promise(l=>{n.push(e.once("save",f=>l(f))),n.push(e.once("close",()=>l(!1)))})})}function o(h){return _(this,null,function*(){return S(Number.isInteger(+h),`\u65E0\u6548\u7684ID ${h}`),a(),r.update(E.KOUTU_EDITOR_URL,{id:h,mode:"user",version:t.authorize?"KE002":"KE001"}),r.insert(),e.once("load",()=>_(this,null,function*(){const l=yield r.getService();l.init({appId:t.appId,v:E.VERSION,version:t.authorize?"KE002":"KE001"}),l.openWork(h)})),new Promise(l=>{n.push(e.once("save",f=>l(f))),n.push(e.once("close",()=>l(!1)))})})}function u(h){return _(this,null,function*(){if(S(typeof h=="string","url \u5FC5\u987B\u662F url \u683C\u5F0F"),!t.authorize||!t.getUseRightCert)throw new Error("\u7F3A\u5C11 authorize \u6216\u8005 getUseRightCert \u53C2\u6570");const l=new Rr,f=yield t.authorize(),p=yield l.createAuth(f),m=yield l.createKoutuRecord({token:p,url:h}),c=yield t.getUseRightCert({abilityCode:"KE002",appId:t.appId,workId:m});if(c){if(c instanceof Error)throw c}else throw new Error("\u6CA1\u6709\u6743\u9650");return{result:yield l.koutu({url:h,appId:t.appId,workId:m,abilityCode:"KE002",useCert:c,token:p}),workId:m}})}function i(h){e.add("save",h)}function d(h){e.add("close",h)}function y(){e.emit("close"),r.remove()}return{onSave:i,onClose:d,close:y,koutu:u,editKoutu:o,importImage:s}}var k=(t,e,r)=>new Promise((n,a)=>{var s=i=>{try{u(r.next(i))}catch(d){a(d)}},o=i=>{try{u(r.throw(i))}catch(d){a(d)}},u=i=>i.done?n(i.value):Promise.resolve(i.value).then(s,o);u((r=r.apply(t,e)).next())});function Tr(t){const e=new j,r=[];function n(){r.forEach(l=>l()),r.length=0}const a=B({container:t.container,appId:t.appId,methods:{emit(l,...f){return k(this,null,function*(){e.emit(l,...f)})},onload(){e.emit("load")},getUseRightToken(l){return k(this,null,function*(){if(!t.getUseRightCert)return!1;const f=yield t.getUseRightCert(l);return f instanceof Error?{message:f.message}:f})},getUserCode(){return k(this,null,function*(){if(!t.authorize)return!1;try{return yield t.authorize()}catch{d()}})},download(l){return k(this,null,function*(){e.emit("save",l)})}}});function s(l,f){e.on(l,f)}function o(l,f){e.off(l,f)}function u(l){return k(this,arguments,function*(f,p={}){return n(),a.update(E.IMAGE_EDITOR_URL,{version:t.authorize?"IE002":"IE001"}),a.insert(),e.once("load",()=>k(this,null,function*(){(yield a.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"IE002":"IE001",fileTypes:p.fileTypes,disableModules:p.disableModules});const c=yield a.getService(),v=yield Promise.all((Array.isArray(f)?f:[f]).map(g=>k(this,null,function*(){return typeof g=="string"?g:yield ve(g)})));c.importFile(v)})),new Promise(m=>{r.push(e.once("save",c=>m(c))),r.push(e.once("close",()=>m(!1)))})})}function i(l){return k(this,arguments,function*(f,p={}){return n(),a.update(E.IMAGE_EDITOR_URL,{id:f,mode:"user",version:t.authorize?"IE002":"IE001"}),a.insert(),e.once("load",()=>k(this,null,function*(){(yield a.getService()).init({appId:t.appId,v:E.VERSION,version:t.authorize?"IE002":"IE001",fileTypes:p.fileTypes,disableModules:p.disableModules})})),new Promise(m=>{r.push(e.once("save",c=>m(c))),r.push(e.once("close",()=>m(!1)))})})}function d(){e.emit("close"),a.remove()}function y(l){e.add("save",l)}function h(l){e.add("close",l)}return{editImage:i,close:d,onSave:y,onClose:h,importImage:u,on:s,off:o}}T.createImageEditor=Tr,T.createKoutuEditor=Ir,T.createMobileTemplateEditor=dt,T.createTemplateEditor=ct,T.env=E,Object.defineProperty(T,"__esModule",{value:!0}),T[Symbol.toStringTag]="Module"});
//# sourceMappingURL=editor-sdk.umd.js.map
{
"name": "@gaoding/editor-sdk",
"version": "2.2.0-alpha.0",
"version": "2.2.0",
"description": "稿定编辑器对外 SDK",

@@ -29,3 +29,3 @@ "main": "dist/editor-sdk.umd.js",

},
"gitHead": "fe6db3252749fdf9979d8aa6e9fd492fe90d37c5"
"gitHead": "0c8b95fbf562c7c8ab8033b802d1e90eb0b6cffe"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc