@chuangkit/chuangkit-design
Version:
创客贴开放 API,让你的网站快速具备设计能力
1 lines • 96.9 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.CktDesign=t():e.CktDesign=t()}(this,(function(){return t=[function(e,t,n){function i(e,t){var n=this;if(this.EVENT_MAP=new Map,this.handlePostMessage=function(e){var t=(e=e.data||{}).mark,i=e.name;e=e.result;["CKT_MESSAGE_IFRAME","DESIGN_SDK","CKT_TEMPLAGE_CENTER","MATTING_DESIGN","CKT_TOPIC_PAGE","CKT_BATCH_MATTING","CKT_AI_PAINTER","CKT_AI_DESIGN","CKT_CALENDARCENTER_PAGE","CKT_MYSPACE"].includes(t)&&n.runEvent(i,e)},!e)throw new Error("no such target");this.target=e,this.mark=t,this.initMessage()}n.r(t),i.prototype.destoryMessageService=function(){window.removeEventListener("message",this.handlePostMessage)},i.prototype.mountEvent=function(e,t){this.EVENT_MAP.set(e,t)},i.prototype.runEvent=function(e,t){this.EVENT_MAP.has(e)&&this.EVENT_MAP.get(e)(t)},i.prototype.initMessage=function(){window.addEventListener("message",this.handlePostMessage,!1)},i.prototype.postMessage=function(e,t,n){n&&this.mountEvent(e,n),this.target.postMessage({mark:this.mark,name:e,result:t||{}},"*")};var o=i,s=!1,r=null,a=function(e,t,n){return void 0===n&&(n=!0),new Promise((function(i,s){e.onload=function(){var n=new o(e.contentWindow,"CKT_TEMPLATE");n.postMessage("initData",t,(function(){return i(n)}))},e.onerror=function(e){return s("\u521d\u59cb\u5316\u901a\u8baf\u6a21\u5757\u5931\u8d25\uff01"+e.toString())},n||document.body.appendChild(e)}))};function c(e,t){for(var n in t)null!==t[n]&&void 0!==t[n]&&(0<e.indexOf("?")?e+="&":e+="?",e+=n+"="+t[n]);return t.auth_url||e}function l(e,t,n,i,o){var s,r=document.getElementById(n)||((s=document.createElement("iframe")).id=n,s.style.width="100%",s.style.height="100%",s.style.zIndex=t.toString(),s.style.position="absolute",s.style.left="0",s.style.top="0",s.setAttribute("frameborder","0"),s),a=document.getElementById(n+"-mask")||((s=document.createElement("div")).id=n+"-mask",s.style.width="100vw",s.style.height="100vh",s.style.position="fixed",s.style.top="0px",s.style.left="0px",s.style.zIndex=""+(t-1),s.style.backgroundColor="rgb(0,0,0)",s.style.opacity="0.7",s);return{open:function(){var t;r&&(t="https://www.chuangkit.com","dev"===e?t="http://local.chuangkit.com":"local"===e?t="https://local-www.chuangkit.com":"moni"===e&&(t="https://moniwww.chuangkit.com"),r.src=t+"/api/designer.html?"+(t="",t=0<Object.keys(i).length?Object.entries(i).map((function(e){var t=e[0],n=e=e[1];return t+"="+(["thumbnail_url"].includes(t)?encodeURIComponent(e):n)})).join("&"):t),o&&document.body.appendChild(a),document.body.appendChild(r))},close:function(){r&&(o&&document.body.removeChild(a),document.body.removeChild(r))}}}n="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDRweCIgaGVpZ2h0PSIyOXB4IiB2aWV3Qm94PSIwIDAgNDQgMjkiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8dGl0bGU+6Zuq56Kn5Zu+5aSH5Lu9PC90aXRsZT4KICAgIDxnIGlkPSLpm6rnoqflm77lpIfku70iIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSLnvJbnu4QiIGZpbGw9IiMxQjIzMzciIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgIDxnIGlkPSLlhajlsY/ljJblpIfku70tNSI+CiAgICAgICAgICAgICAgICA8cGF0aCBkPSJNMCw1IEwwLDMuNiBM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IgMS40IDEyLjggNy4yIDEyLjggNy4yIDEwLjMyMzA3NjkgOC41MDUyMDMzNSAxMC4zMjMwNzY5IDguNTA1MjAzMzUgMTQgMCAxNCAwIDAiPjwvcG9seWdvbj4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==";var g={image:function(e){return!0},template:function(){return!0},template_center:function(){return!0},topic_page:function(){return!0},ai_painter:function(){return!0},ai_design:function(){return!0},batch_matting:function(){return!0},matting:function(){return!0},calendar_center:function(){return!0},quark_m_design:function(){return!0},my_space:function(){return!0}};function d(e){this.screenNormalPostion="-15px 0",this.screenHoverPostion="-15px -15px",this.fullScreenNormalPostion="0 0",this.fullScreenHoverPostion="0 -15px",this.exitNormalPostion="-30px 0",this.exitHoverPostion="-30px -15px",this.exitBtn="\u9000\u51fa",this.fullScreenBtn="\u5168\u5c4f\u5316",this.screenBtn="\u7a97\u53e3\u5316",this.instanceConfig={userFlag:"normal",env:"prod"},this.loading=!0,this.designSdkUrl="https://local-www.chuangkit.com",this.initStyleSheet(),(this.instanceConfig=e).designSdkUrl&&(this.designSdkUrl=e.designSdkUrl)}d.prototype.editContainerConfig=function(e){this.instanceConfig=e,this.renderDOM=e.container},d.prototype.createContainer=function(){var e,t=document.getElementById("chuangkit-design-container");if(!t)if((t=document.createElement("div")).id="chuangkit-design-container",this.renderDOM){if("string"==typeof this.renderDOM){var n=document.querySelector(this.renderDOM);if(!n)return void alert("\u672a\u627e\u5230\u6307\u5b9a\u6e32\u67d3\u5bb9\u5668\u3002");this.renderDOM=n}this.renderDOM.appendChild(t)}else this.createPopBlack(),t.className="pop",document.body.appendChild(t),this.createContainerHeader(t);return(n=document.getElementById("chuangkit-design-iframe-loading"))&&null!=(e=n.parentElement)&&e.removeChild(n),t.appendChild(this.loadingElement()),this.containerDOM=t,this.containerDOM},d.prototype.destoryContainer=function(){var e=document.getElementById("chuangkit-design-container");e&&(e.innerHTML="",this.renderDOM||document.body.removeChild(e),e=document.getElementById("chuangkit-design-pop-black"))&&document.body.removeChild(e)},d.prototype.setExitHandle=function(e){this.exitDOM&&(this.exitDOM.onclick=e)},d.prototype.createPopBlack=function(){var e=document.getElementById("chuangkit-design-pop-black");e||((e=document.createElement("div")).id="chuangkit-design-pop-black",e.style.width="100vw",e.style.height="100vh",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.zIndex="9999",e.style.backgroundColor="#000",e.style.opacity=".7",document.body.appendChild(e))},d.prototype.createContainerHeader=function(e){var t=document.getElementById("chuangkit-design-container-header");t||((t=document.createElement("div")).id="chuangkit-design-header-box",t.style.height="32px",t.style.padding="0 16px",t.style.background="#EBEEF5",t.style.display="flex",t.style.justifyContent="space-between",t.style.alignItems="center",t.style.boxSizing="content-box",e.appendChild(t),this.createContainerHeaderContent(t))},d.prototype.createContainerHeaderContent=function(e){var t=document.createElement("div"),n=(t.style.cssText="font-size: 12px; color: rgb(80, 90, 113);",document.createElement("div"));n.style.cssText="display: flex; align-items: center; flex-shrink: 0;",this.createContainerHeaderContentRight(n),e.appendChild(t),e.appendChild(n)},d.prototype.createContainerHeaderContentRight=function(e){function t(t){var o=document.createElement("div"),s=(o.id="ckt-design-header-"+t,o.style.cssText="height: 32px; display: inline-flex; align-items: center; cursor: pointer;","exitDOM"!==t&&(o.style.cssText+=" margin-right: 20px;"),document.createElement("i")),r=(s.style.cssText="display: inline-block; width: 14px; height: 14px; margin-right: 6px","");"exitDOM"===t?r=n.exitNormalPostion:"screenDOM"===t&&(r=n.screenNormalPostion),s.style.backgroundImage="url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDRweCIgaGVpZ2h0PSIyOXB4IiB2aWV3Qm94PSIwIDAgNDQgMjkiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGlu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NSBMMTEuMDYyMDI2NSw3LjQ5OSBMMy43MjEwMjY0Nyw3LjUgTDMuNzIxMDI2NDcsNi4yIEwxMS4xODYwMjY1LDYuMTk5IEw5LjQwNTc2MTE4LDQuNDE5MjM4ODIgTDEwLjMyNSwzLjUgWiIgaWQ9IuW9oueKtue7k+WQiCI+PC9wYXRoPgogICAgICAgICAgICA8cG9seWdvbiBpZD0i6Lev5b6EIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHBvaW50cz0iOC41MDUyMDMzNSAwIDguNTA1MjAzMzUgMy42NzY5MjMwOCA3LjIgMy42NzY5MjMwOCA3LjIgMS4yIDEuNCAxLjIgMS40IDEyLjggNy4yIDEyLjggNy4yIDEwLjMyMzA3NjkgOC41MDUyMDMzNSAxMC4zMjMwNzY5IDguNTA1MjAzMzUgMTQgMCAxNCAwIDAiPjwvcG9seWdvbj4KICAgICAgICA8L2c+CiAgICA8L2c+Cjwvc3ZnPg==)",s.style.backgroundPosition=r,s.style.backgroundRepeat="no-repeat",(r=document.createElement("span")).style.cssText="font-size: 12px; color: rgb(27, 35, 55);","exitDOM"===t&&(r.innerHTML=n.exitBtn),"screenDOM"===t&&(r.innerHTML=n.fullScreenBtn),o.appendChild(s),o.appendChild(r),e.appendChild(o),n[t]=o,i&&n.fullScreenHandle()}var n=this,i=(localStorage.getItem("ckt-full-screen-user_flag")||"").includes(this.instanceConfig.userFlag);t("screenDOM"),t("exitDOM"),this.screenDOM.onclick=function(){return n.fullScreenHandle()}},d.prototype.fullScreenHandle=function(){var e,t=localStorage.getItem("ckt-full-screen-user_flag")||"",n=t.includes(this.instanceConfig.userFlag),i=t.includes(","),o=null==(o=this.screenDOM)?void 0:o.querySelector("span"),s=document.getElementById("chuangkit-design-container"),r=document.getElementById("chuangkit-design-header-box");n?(this.screenDOM.className="",r.style.borderRadius="8px 8px 0 0",o.innerHTML=this.fullScreenBtn,e=t.replace((i?",":"")+this.instanceConfig.userFlag,""),localStorage.setItem("ckt-full-screen-user_flag",e),s.style.width="calc(100vw - 100px)",s.style.height="calc(100vh - 132px)"):(this.screenDOM.className="full",r.style.borderRadius="0",o.innerHTML=this.screenBtn,e=t+this.instanceConfig.userFlag+",",localStorage.setItem("ckt-full-screen-user_flag",e.substring(0,e.length-1)),s.style.width="100vw",s.style.height="100vh")},d.prototype.initStyleSheet=function(){var e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode("* { margin: 0; padding 0; }")),e.appendChild(document.createTextNode("#chuangkit-design-container { width: 100%; height: 100%; }")),e.appendChild(document.createTextNode("#chuangkit-design-container.pop { width: calc(100vw - 100px);height: calc(100vh - 132px);position: fixed;left: 50%;top: 50%;transform: translate(-50%, -50%);z-index: 10000;border-radius: 8px 8px 0px 0px; }")),e.appendChild(document.createTextNode("#chuangkit-design-container.pop > #chuangkit-design-header-box { border-radius: 8px 8px 0 0 }")),e.appendChild(document.createTextNode("#ckt-design-header-exitDOM:hover> i { background-position: "+this.exitHoverPostion+" !important; }")),e.appendChild(document.createTextNode("#ckt-design-header-exitDOM:hover> span { color: rgb(7, 115, 252) !important; }")),e.appendChild(document.createTextNode("#ckt-design-header-screenDOM:hover> i{ background-position: "+this.screenHoverPostion+" !important; }")),e.appendChild(document.createTextNode("#ckt-design-header-screenDOM.full> i { background-position: "+this.fullScreenNormalPostion+" !important; }")),e.appendChild(document.createTextNode("#ckt-design-header-screenDOM.full:hover> i { background-position: "+this.fullScreenHoverPostion+" !important; }")),e.appendChild(document.createTextNode("#ckt-design-header-screenDOM:hover> span { color: rgb(7, 115, 252) !important; }")),document.head.appendChild(e)},d.prototype.loadingElement=function(){var e=document.createElement("div");return e.id="chuangkit-design-iframe-loading",e.style.position="relative",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="#fff",e.style.display="block",e.appendChild(this.createProgressBarElement()),e},d.prototype.createProgressBarElement=function(){var e=document.createElement("div"),t=(e.style.width="420px",e.style.height="10px",e.style.background="#E7F1FF",e.style.borderRadius="4px",e.style.overflow="hidden",e.style.position="absolute",e.style.top="50%",e.style.left="50%",e.style.transform="translate(-50%, -50%)",document.createElement("div"));return t.id="chuangkit-loading-progress-bar",t.style.width="100%",t.style.height="100%",t.style.background="#0773FC",t.style.position="absolute",t.style.top="0",t.style.left="-100%",t.style.transition="all 5000ms",e.appendChild(t),setTimeout((function(){t.style.left="-2%"}),0),e},d.prototype.loadingEnd=function(){this.loading=!1;var e,t=document.getElementById("chuangkit-loading-progress-bar");t&&(t.style.left="0",e=document.getElementById("chuangkit-design-iframe-loading"),setTimeout((function(){e&&(e.style.display="none")}),200))},d.prototype.initDesignSDK=function(e,t,n){var i,o,s,r=this;"dev"===this.instanceConfig.env?this.designSdkUrl="https://local.chuangkit.com":"local"===this.instanceConfig.env?this.designSdkUrl="https://local-www.chuangkit.com/pic/designdist/image/designSDK.js":"moni"===this.instanceConfig.env?this.designSdkUrl="https://moniwww.chuangkit.com/pic/designdist/image/designSDK.js":this.designSdkUrl="https://www.chuangkit.com/pic/designdist/image/designSDK.js",i=this.designSdkUrl+"?v="+Date.now(),o=function(){window.DesignSDK.create(Object.assign(e,{render:"#chuangkit-design-container",success:function(e){t&&t(e),r.loadingEnd()},failed:function(){n&&n(),alert("\u8bbe\u8ba1\u9875SDK\u521b\u5efa\u5931\u8d25\u3002 \u8bf7\u8054\u7cfb\u7ba1\u7406\u5458\u3002DOM\u521b\u5efa\u5931\u8d25")}}))},(s=document.createElement("script")).onload=function(e){o&&o()},s.onerror=function(e){},s.type="text/javascript",s.src=i,document.head.appendChild(s)};var u,p=function(){return(p=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},m="/sdkauthorize.html";function f(e){var t=u.call(this,e)||this;return t.designMessageMap=new Map,t.stageData=new Map,t.messageWaitMap=new Map,t.closeHandle=function(e){void 0===e&&(e=!1),t.config&&1===t.config.closeType&&!e||(t.destoryContainer(),e&&t.designMessageMap.get("onClose")({message:"container_close"}))},t.config=e,t.createMessageComponent(),t}var h=f,w=u=Ge=d;function y(){this.constructor=h}(function(e,t){(Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}))(e,t)})(h,w),h.prototype=null===w?Object.create(w):(y.prototype=w.prototype,new y),f.prototype.editConfig=function(e){var t=this;return new Promise((function(n,i){""===(""+e.env).trim()&&(e.env="prod");var o=e.env===(null==(o=t.config)?void 0:o.env);t.config=p(p({},t.config),e),t.editContainerConfig(t.config),!o&&t.message_iframe&&t.message_iframe.src&&(t.message_iframe.src="https://"+(null!=(o=t.config)&&o.env&&"prod"!==t.config.env?"moni"===t.config.env?"moni":t.config.env+"-":"")+"www.chuangkit.com/api"+m,t.message_iframe.onload=function(){n({})})}))},f.prototype.setSign=function(e,t){this.config.timestamp=e,this.config.sign=t},f.prototype.openDesign=function(){var e,t,n,i,o,s,r=this;(e=this.config)&&(t=e.appId,n=e.unionId,e.timestamp,e.sign,t)&&n&&g[e.flag](e)&&(i=function(){null!=(t=r.message_service)&&t.postMessage("initData",r.config);var e,t=r.createContainer();r.setExitHandle((function(){return r.closeHandle(!0)})),t&&null!=(e=r.design_sdk_service)&&e.setContainer(t)},o=0,s=function(){if(19<o&&!r.message_service)throw new Error("\u521d\u59cb\u5316 message_service \u5931\u8d25");r.message_service?(o=0,i()):(o+=1,setTimeout(s,500))},this.message_service?i():setTimeout(s,800))},f.prototype.setUserCb=function(e,t){this.designMessageMap.set(e,t)},f.prototype.runUserCb=function(e,t){this.designMessageMap.has(e)&&this.designMessageMap.get(e)(t)},f.prototype.mountMessage=function(e,t,n){function i(){var i;return null==(i=o.message_service)?void 0:i.postMessage(e,t,n)}var o=this;this.message_service?(0<this.messageWaitMap.size&&(this.messageWaitMap.forEach((function(e){return e()})),this.messageWaitMap.clear()),i()):this.messageWaitMap.set(e,i)},f.prototype.createMessageComponent=function(){var e,t=this;this.message_iframe||(this.message_iframe=document.createElement("iframe"),this.message_iframe.id="chuangkit-message-iframe",this.message_iframe.style.position="fixed",this.message_iframe.style.width="0px",this.message_iframe.style.height="0px",this.message_iframe.style.zIndex="-1",this.message_iframe.src="https://"+(null!=(e=this.config)&&e.env&&"prod"!==this.config.env?"moni"===this.config.env?"moni":this.config.env+"-":"")+"www.chuangkit.com/api"+m,this.message_iframe.style.display="none",document.body.appendChild(this.message_iframe),this.message_iframe.onload=function(){var e=new o(t.message_iframe.contentWindow,"CKT_SDK");t.message_service=e,t.initDesignSdkMessage(e),0<t.messageWaitMap.size&&(t.messageWaitMap.forEach((function(e){return e()})),t.messageWaitMap.clear())},this.message_iframe.onerror=function(e){return alert("\u521d\u59cb\u5316\u901a\u8baf\u6a21\u5757\u5931\u8d25\uff01"+e.toString())})},f.prototype.initDesignSdkMessage=function(e){var t=this,n={env:(null==(n=this.config)?void 0:n.env)||"prod",flag:this.config.flag,hideLogo:null==(n=this.config)?void 0:n.hideLogo,finishBtn:null==(n=this.config)?void 0:n.finishBtn,designId:"",functions:null==(n=this.config)?void 0:n.functions,defaultFunction:null==(n=this.config)?void 0:n.defaultFunction};this.initDesignSDK(n,(function(e){e.setCallBack("getData",(function(n,i){var o;t.stageData.has(n)?e.noticeFn(n,t.stageData.get(n)):null!=(o=t.message_service)&&o.postMessage(n,i,(function(t){return e.noticeFn(n,t)}))})),e.setCallBack("download",(function(e){t.closeHandle(),t.runUserCb("onSave",e)})),t.design_sdk_service=e}))};var I,v=function(){return(v=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},M=A;w=I=f;function C(){this.constructor=M}function A(e){var t,n,i=I.call(this,e)||this;return i.importImage=(t=function(e){if(!e)return Promise.reject(new Error("\u8bf7\u4e0a\u4f20\u6587\u4ef6"));i.openDesign(),i.mountMessage("getDesignIdByFile",e,(function(e){var t;e&&"string"==typeof e&&"\u4e0a\u4f20\u56fe\u7247\u5931\u8d25"!==e&&(i.config.designId=e,null!=(t=i.design_sdk_service)&&t.setDesignId(e,!1),null!=(t=i.design_sdk_service))&&t.createImageDesign()}))},300,function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];n||(t.apply(this,e),n=!0,setTimeout((function(){n=!1}),300))}),i}(function(e,t){(Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}))(e,t)})(M,w),M.prototype=null===w?Object.create(w):(C.prototype=w.prototype,new C),A.prototype.closeImage=function(){this.destoryContainer()},A.prototype.editImage=function(e){var t=this;if(!e)return Promise.reject(new Error("\u8bf7\u586b\u5199\u8bbe\u8ba1ID"));this.config.designId=e,this.openDesign(),this.mountMessage("authorization",{},(function(n){n&&200===n.code&&(null!=(n=t.design_sdk_service)&&n.setDesignId(e,!1),null!=(n=t.design_sdk_service))&&n.createImageDesign()}))},A.prototype.replaceImage=function(e){},A.prototype.onClose=function(e){this.setUserCb("onClose",(function(){e&&e()}))},A.prototype.onSave=function(e){this.setUserCb("onSave",e)},A.getInstance=function(e){return A.instance=A.instance?A.instance:new A(v(v({env:"prod"},e),{request_url:window.location.origin}))};var D=A,x=function(){return(x=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},b="chuangkit_template_center_iframe";function E(e){this.config=e}E.prototype.updateConfig=function(e){this.config=e},E.getInstance=function(e){return E.instance?E.instance.updateConfig(e):E.instance=new E(e),E.instance},E.prototype.onChooseTemplate=function(e){if(!this.messageService)throw new Error("\u8bf7\u5148\u6253\u5f00\u6a21\u677f\u4e2d\u5fc3\u540e\u64cd\u4f5c...");this.messageService.mountEvent("chooseTemplate",(function(t){return e(t)}))},E.prototype.onParamsChange=function(e){if(!this.messageService)throw new Error("\u8bf7\u5148\u6253\u5f00\u6a21\u677f\u4e2d\u5fc3\u540e\u64cd\u4f5c...");this.messageService.mountEvent("paramsChange",(function(t){return e(t)}))},E.prototype.setParams=function(e){if(!this.messageService)throw new Error("\u8bf7\u5148\u6253\u5f00\u6a21\u677f\u4e2d\u5fc3\u540e\u64cd\u4f5c...");this.messageService.postMessage("setParams",e)},E.prototype.open=function(){var e=this;return this.config.appId&&this.config.settingCode&&this.config.container&&this.config.sign&&this.config.timestamp?this.initMessage().then((function(t){return(e.messageService=t).postMessage("initData",x(x({},e.config),{device_type:1})),!0}),(function(e){throw new Error("error opening message service --- "+e)})):Promise.reject("\u8bf7\u68c0\u67e5\u53c2\u6570\u662f\u5426\u586b\u5199\u5b8c\u6574 (appId, sign, timestamp, container, settingCode)")},E.prototype.close=function(){this.messageService&&this.messageService.destoryMessageService(),this.messageService=void 0;var e,t=document.getElementById(b);t&&null!=(e=t.parentNode)&&e.removeChild(t)},E.prototype.initMessage=function(){var e=this;return new Promise((function(t,n){var i=e.config.container instanceof HTMLElement?e.config.container:document.querySelector(e.config.container),s=(i||n("DOM\u8282\u70b9\u672a\u627e\u5230\uff01"+e.config.container),"https://www");switch(e.config.env){case"local":s="https://local-www";break;case"moni":s="https://moniwww";break;case"dev":s="http://local"}var r=document.createElement("iframe");r.id=b,r.style.width="100%",r.style.height="100%",r.setAttribute("frameborder","0"),r.src=s+".chuangkit.com/api/templatecenter.html",r.onload=function(){var e=new o(r.contentWindow,"CKT_TEMPLATE_CENTER");t(e)},r.onerror=function(e){return n("\u6e32\u67d3DOM\u51fa\u9519"+e)},i.appendChild(r)}))};var S=E,k=function(){return(k=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},_="chuangkit_topic_page_iframe";function T(e){this.config=e}T.prototype.updateConfig=function(e){this.config=e},T.getInstance=function(e){return T.instance?T.instance.updateConfig(e):T.instance=new T(e),T.instance},T.prototype.onChooseTemplate=function(e){if(!this.messageService)throw new Error("\u8bf7\u5148\u6253\u5f00\u4e13\u9898\u9875\u540e\u64cd\u4f5c...");this.messageService.mountEvent("chooseTemplate",(function(t){return e(t)}))},T.prototype.open=function(){var e=this;return this.config.appId&&this.config.settingCode&&this.config.container&&this.config.sign&&this.config.timestamp?this.initMessage().then((function(t){return(e.messageService=t).postMessage("initData",k(k({},e.config),{device_type:1})),!0}),(function(e){throw new Error("error opening message service --- "+e)})):Promise.reject("\u8bf7\u68c0\u67e5\u53c2\u6570\u662f\u5426\u586b\u5199\u5b8c\u6574 (appId, sign, timestamp, container, settingCode)")},T.prototype.close=function(){this.messageService&&this.messageService.destoryMessageService(),this.messageService=void 0;var e,t=document.getElementById(_);t&&null!=(e=t.parentNode)&&e.removeChild(t)},T.prototype.initMessage=function(){var e=this;return new Promise((function(t,n){var i=e.config.container instanceof HTMLElement?e.config.container:document.querySelector(e.config.container),s=(i||n("DOM\u8282\u70b9\u672a\u627e\u5230\uff01"+e.config.container),"https://www");switch(e.config.env){case"local":s="https://local-www";break;case"moni":s="https://moniwww";break;case"dev":s="http://local"}var r=document.createElement("iframe");r.id=_,r.style.width="100%",r.style.height="100%",r.setAttribute("frameborder","0"),r.src=s+".chuangkit.com/api/topicpage.html",r.onload=function(){var e=new o(r.contentWindow,"CKT_TOPIC_PAGE");t(e)},r.onerror=function(e){return n("\u6e32\u67d3DOM\u51fa\u9519"+e)},i.appendChild(r)}))};var N,L=T,j=function(){return(j=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},P=O;w=N=Ge;function B(){this.constructor=P}function O(e){var t=N.call(this,e)||this;return t.checkParams=function(){var e,n,i,o;return t.config&&(e=(o=t.config).appId,n=o.unionId,i=o.sign,o=o.timestamp,e)&&n&&i&&o?Promise.resolve(!0):Promise.resolve(!1)},t.open=function(){return function(e,t,n,i){return new(n=n||Promise)((function(o,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))}(t,void 0,void 0,(function(){var e=this;return function(e,t){var n,i,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},r={next:a(0),throw:a(1),return:a(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var c=[r,a];if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(o=2&c[0]?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,(c=o?[2&c[0],o.value]:c)[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,i=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(o=0<(o=s.trys).length&&o[o.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3]))s.label=c[1];else if(6===c[0]&&s.label<o[1])s.label=o[1],o=c;else{if(!(o&&s.label<o[2])){o[2]&&s.ops.pop(),s.trys.pop();continue}s.label=o[2],s.ops.push(c)}}c=t.call(e,s)}catch(a){c=[6,a],i=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,(function(t){switch(t.label){case 0:return this.createContainer(),this.setExitHandle((function(){return e.closeHandle()})),[4,this.checkParams()];case 1:return t.sent()?[2,this.initMessage().then((function(t){e.message_service=t,e.message_service.postMessage("initData",j({},e.config)),t.mountEvent("authorization",(function(n){var i=n.code,o=n.msg;n=n.type;return 200!==i?(e.destroyComponent(),Promise.reject(new Error("\u9274\u6743\u5931\u8d25"+o))):"CKT_BATCH_MATTING"===n?(e.config.imgUrls&&Array.isArray(e.config.imgUrls)&&0<e.config.imgUrls.length&&t.postMessage("insertImg",e.config.imgUrls),Promise.resolve()):void 0}))}),(function(e){throw new Error("error opening message service --- "+e)}))]:(this.destroyComponent(),[2,Promise.reject("\u53c2\u6570\u9a8c\u8bc1\u5931\u8d25\uff01")])}}))}))},t.closeHandle=function(){t.destroyComponent()},t.destroyComponent=function(){t.destoryContainer(),t.destoryMessageService()},t.destoryMessageService=function(){var e;t.message_iframe&&null!=(e=t.message_iframe.parentElement)&&e.removeChild(t.message_iframe),t.message_iframe=void 0,null!=(e=t.message_service)&&e.destoryMessageService(),t.message_service=void 0,t.batch_matting_iframe&&null!=(e=t.batch_matting_iframe.parentElement)&&e.removeChild(t.batch_matting_iframe),t.batch_matting_iframe=void 0,null!=(e=t.design_service)&&e.destoryMessageService(),t.design_service=void 0},t.close=function(){t.closeHandle()},t.config=e,t}(function(e,t){(Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}))(e,t)})(P,w),P.prototype=null===w?Object.create(w):(B.prototype=w.prototype,new B),O.prototype.updateConfig=function(e){this.config=e},O.getInstance=function(e){return O.instance?O.instance.updateConfig(e):O.instance=new O(j(j({env:"prod"},e),{request_url:window.location.origin})),O.instance},O.prototype.onCustomDownload=function(e){if(!this.message_service)throw new Error("\u8bf7\u5148\u6253\u5f00\u6279\u91cf\u62a0\u56fe\u540e\u64cd\u4f5c...");this.message_service.mountEvent("downloadImg",(function(t){return e(t)}))},O.prototype.initMessage=function(){var e=this;return this.message_service?Promise.resolve(this.message_service):new Promise((function(t,n){var i="https://www";switch(e.config.env){case"local":i="https://local-www";break;case"moni":i="https://moniwww";break;case"dev":i="http://local"}var s=document.getElementById("chuangkit-design-container"),r=document.createElement("iframe");r.id="chuangkit-design-iframe",r.style.width="100%",r.style.height="calc(100% - 32px)",r.style.backgroundColor="#fff",r.src=i+".chuangkit.com/api/batchmatting.html",r.style.display="none",r.setAttribute("frameborder","0"),r.onerror=function(e){return n(e)},(e.batch_matting_iframe=r).onload=function(){e.loadingEnd(),r.style.display="block";var n=new o(r.contentWindow,"CKT_BATCH_MATTING");t(n)},s.appendChild(r)}))};var z,G=O,W=function(){return(W=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},U=function(e,t,n,i){return new(n=n||Promise)((function(o,s){function r(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))},H=function(e,t){var n,i,o,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},r={next:a(0),throw:a(1),return:a(2)};return"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var c=[r,a];if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(o=2&c[0]?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,(c=o?[2&c[0],o.value]:c)[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,i=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!(o=0<(o=s.trys).length&&o[o.length-1])&&(6===c[0]||2===c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3]))s.label=c[1];else if(6===c[0]&&s.label<o[1])s.label=o[1],o=c;else{if(!(o&&s.label<o[2])){o[2]&&s.ops.pop(),s.trys.pop();continue}s.label=o[2],s.ops.push(c)}}c=t.call(e,s)}catch(a){c=[6,a],i=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}},F=Y;w=z=Ge;function Q(){this.constructor=F}function Y(e){var t=z.call(this,e)||this;return t.designMessageMap=new Map,t.closeHandle=function(e){void 0===e&&(e=!1),t.config&&1===t.config.closeType&&!e||(t.destroyComponent(),e&&t.designMessageMap.get("onClose")({message:"container_close"}))},t.destroyComponent=function(){t.destoryContainer(),t.destoryMessageService()},t.destoryMessageService=function(){var e;t.message_iframe&&null!=(e=t.message_iframe.parentElement)&&e.removeChild(t.message_iframe),t.message_iframe=void 0,null!=(e=t.message_service)&&e.destoryMessageService(),t.message_service=void 0,t.design_iframe&&null!=(e=t.design_iframe.parentElement)&&e.removeChild(t.design_iframe),t.design_iframe=void 0,null!=(e=t.design_service)&&e.destoryMessageService(),t.design_service=void 0},t.checkParams=function(){var e,n,i,o,s,r;return t.config&&(e=(r=t.config).appId,n=r.unionId,i=r.sign,o=r.timestamp,s=r.file,r=r.finishBtn,e&&n&&i&&o&&s)&&!(r&&10<r.length)?Promise.resolve(!0):Promise.resolve(!1)},t.getImgBlob=function(){return new Promise((function(e,n){return U(t,void 0,void 0,(function(){var t,i,o,s;return H(this,(function(r){switch(r.label){case 0:if("string"==typeof(t=this.config.file)&&((i=new XMLHttpRequest).responseType="blob",i.open("GET",t,!0),i.onreadystatechange=function(t){var i=(t=t.target).status;t=t.response;200===i&&t?e(t.slice(0,t.size,t.type)):200<i&&n(new Error("code: "+i+", msg: "+t))},i.send()),!(t instanceof File))return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),o=e,s=Blob.bind,[4,t.arrayBuffer()];case 2:return o.apply(void 0,[new(s.apply(Blob,[void 0,[r.sent()],{type:t.type}]))]),[3,4];case 3:return r.sent(),n(new Error("\u56fe\u7247\u8f6c\u6362\u5f02\u5e38\uff01")),[3,4];case 4:return[2]}}))}))}))},t.checkBlob=function(e){return 10485760<e.size||-1===e.type.indexOf("image")||-1<e.type.indexOf("svg")||-1<e.type.indexOf("gif")||0===e.size?Promise.resolve(!1):Promise.resolve(!0)},t.open=function(){return U(t,void 0,void 0,(function(){var e,t,n,i=this;return H(this,(function(o){switch(o.label){case 0:return this.createContainer(),this.setExitHandle((function(){return i.closeHandle(!0)})),[4,this.checkParams()];case 1:return e=o.sent(),[4,this.getImgBlob()];case 2:return t=o.sent(),[4,this.checkBlob(t)];case 3:return n=o.sent(),e&&n?[2,this.initMessage().then((function(e){(i.message_service=e).mountEvent("authorization",(function(e){var n=e.code,o=e.msg;e=e.type;return 200!==n?(i.destroyComponent(),Promise.reject(new Error("\u9274\u6743\u5931\u8d25"+o))):"CKT_MATTING_SDK"===e?(i.initDesign(t),Promise.resolve()):void 0})),e.postMessage("initData",W({},i.config))}),(function(e){throw new Error("error opening message service --- "+e)}))]:(this.destroyComponent(),[2,Promise.reject("\u53c2\u6570\u9a8c\u8bc1\u5931\u8d25\uff01")])}}))}))},t.close=function(){t.closeHandle(!0)},t.onClose=function(e){t.setUserCb("onClose",(function(){return null==e?void 0:e()}))},t.onSave=function(e){t.setUserCb("onSave",e)},t.editConfig=function(e){t.config=W(W({},t.config),e),t.editContainerConfig(t.config)},t.config=e,t}(function(e,t){(Object.setPrototypeOf||({__proto__:[]}instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}))(e,t)})(F,w),F.prototype=null===w?Object.create(w):(Q.prototype=w.prototype,new Q),Y.getInstance=function(e){return Y.instance=Y.instance?Y.instance:new Y(W(W({env:"prod"},e),{request_url:window.location.origin}))},Y.prototype.initMessage=function(){var e=this;return this.message_service?Promise.resolve(this.message_service):new Promise((function(t,n){if(e.message_iframe||!e.config)return e.message_service;e.message_iframe=document.createElement("iframe"),e.message_iframe.id="chuangkit-message-iframe",e.message_iframe.style.position="fixed",e.message_iframe.style.width="0px",e.message_iframe.style.height="0px",e.message_iframe.style.zIndex="-1",e.message_iframe.src="https://"+(e.config.env&&"prod"!==e.config.env?"moni"===e.config.env?"moni":e.config.env+"-":"")+"www.chuangkit.com/api/sdkauthorize.html",e.message_iframe.style.display="none",document.body.appendChild(e.message_iframe),e.message_iframe.onload=function(){var n=new o(e.message_iframe.contentWindow,"CKT_MATTING_SDK");t(n)},e.message_iframe.onerror=function(e){return n("\u521d\u59cb\u5316\u901a\u8baf\u6a21\u5757\u5931\u8d25\uff01"+e.toString())}}))},Y.prototype.initDesign=function(e){return U(this,void 0,void 0,(function(){var t,n,i=this;return H(this,(function(s){switch(s.label){case 0:return this.message_service?[4,this.initDesingIframe()]:[2];case 1:return t=s.sent(),n=new o(t.contentWindow,"MATTING_DESIGN"),(this.design_service=n).mountEvent("matting_loaded",(function(){i.loadingEnd(),t.style.display="block",n.postMessage("setImgBlob",{source:"openPlatform",imageBlob:e})})),n.mountEvent("matting_download",(function(e){e=e.imageBlob,i.closeHandle(),i.runUserCb("onSave",e)})),[2]}}))}))},Y.prototype.initDesingIframe=function(){var e=this;return new Promise((function(t,n){var i=(s=e.config).env,o=s.hideLogo,s=s.finishBtn,r=document.getElementById("chuangkit-design-container"),a=document.createElement("iframe");a.id="chuangkit-design-iframe",a.style.width="100%",a.style.height="100%",a.style.backgroundColor="#fff",a.style.display="none",a.src="https://"+(i&&"prod"!==i?i+"-":"")+"mater.chuangkit.com?type=iframe&isLogin=1&openPlatform=1"+(o?"&hideLogo=1":"")+"&downloadText="+(s||"\u5b8c\u6210"),a.setAttribute("frameborder","0"),a.onerror=function(e){return n(e)},t(e.design_iframe=a),r.appendChild(a)}))},Y.prototype.setUserCb=function(e,t){this.designMessageMap.set(e,t)},Y.prototype.runUserCb=function(e,t){this.designMessageMap.has(e)&&this.designMessageMap.get(e)(t)};var Z=Y,K=function(){return(K=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},R="chuangkit_ai_painter_iframe";function J(e){var t=this;this.messageMap=new Map,this.onGenerate=function(e){if(!t.aiPainterMessageService)throw new Error("\u8bf7\u7b49\u5f85\u521d\u59cb\u5316\u4e4b\u540e\u8c03\u7528...");if("function"!=typeof e)throw new Error("\u8bf7\u4f20\u5165\u56de\u8c03\u51fd\u6570");t.aiPainterMessageService.mountEvent("ai-parinter-generate-cb",(function(t){e(t)}))},this.onDownload=function(e){if(!t.aiPainterMessageService)throw new Error("\u8bf7\u7b49\u5f85\u521d\u59cb\u5316\u4e4b\u540e\u8c03\u7528...");if("function"!=typeof e)throw new Error("\u8bf7\u4f20\u5165\u56de\u8c03\u51fd\u6570");t.aiPainterMessageService.mountEvent("ai-parinter-download-cb",(function(t){e(t)}))},this.result=function(e){if(!t.aiPainterMessageService)throw new Error("\u8bf7\u7b49\u5f85\u521d\u59cb\u5316\u4e4b\u540e\u8c03\u7528...");if("function"!=typeof e)throw new Error("\u8bf7\u4f20\u5165\u56de\u8c03\u51fd\u6570");t.aiPainterMessageService.mountEvent("ai-parinter-result-cb",(function(t){e(t)}))},this.config=e}J.prototype.updateConfig=function(e){this.config=e},J.prototype.generate=function(){if(!this.aiPainterMessageService)throw new Error("\u8bf7\u7b49\u5f85\u521d\u59cb\u5316\u4e4b\u540e\u8c03\u7528");this.aiPainterMessageService.postMessage("ai-painter-generate",{})},J.getInstance=function(e){return J.instance?J.instance.updateConfig(e):J.instance=new J(K(K({env:"prod"},e),{request_url:window.location.origin})),J.instance},J.prototype.open=function(){var e=this;return this.config.appId&&this.config.container&&this.config.sign&&this.config.timestamp&&this.config.companyFlag?new Promise((function(t){var n;1==e.config.device_type?e.initMessage().then((function(n){(e.messageService=n).postMessage("initData",K(K({},e.config),{device_type:e.config.device_type})),n.mountEvent("authorization",(function(n){var i=n.code,o=n.msg;n=n.type;if(200!==i)throw new Error("\u9274\u6743\u5931\u8d25"+o);"CKT_AI_PAINTER"===n&&e.initPainterDesign().then((function(e){t(e)}))}))}),(function(e){throw new Error("error opening message service --- "+e)})):(n="https://"+(e.config.env&&"prod"!==e.config.env?"moni"===e.config.env?"moni":e.config.env+"-":"")+"www.chuangkit.com/api/aipainterauthorize?appId="+e.config.appId+"&unionId="+e.config.unionId+"×tamp="+e.config.timestamp+"&sign="+e.config.sign+"&env="+(e.config.env||"prod")+"&companyFlag="+e.config.companyFlag+"&mParam="+e.config.mParam+"&downloadType="+e.config.downloadType+"&generateType="+e.config.generateType+"&generateButtonTips="+encodeURIComponent(e.config.generateButtonTips)+"&request_url="+window.location.origin,window.location.href=n,t(!0))})):Promise.reject("\u8bf7\u68c0\u67e5\u53c2\u6570\u662f\u5426\u586b\u5199\u5b8c\u6574 (appId, sign, timestamp, container, companyFlag)")},J.prototype.close=function(){this.messageService&&this.messageService.destoryMessageService(),this.aiPainterMessageService&&this.aiPainterMessageService.destoryMessageService(),this.messageService=void 0,this.aiPainterMessageService=void 0;var e,t=document.getElementById(R);t&&null!=(e=t.parentNode)&&e.removeChild(t)},J.prototype.initMessage=function(){var e=this;return new Promise((function(t,n){var i=document.createElement("iframe");i.id="chuangkit-message-iframe",i.style.position="fixed",i.style.width="0px",i.style.height="0px",i.style.zIndex="-1",i.src="https://"+(e.config.env&&"prod"!==e.config.env?"moni"===e.config.env?"moni":e.config.env+"-":"")+"www.chuangkit.com/api/sdkauthorize.html",i.style.display="none",document.body.appendChild(i),i.onload=function(){var e=new o(i.contentWindow,"CKT_AI_PAINTER");t(e)},i.onerror=function(e){return n("\u521d\u59cb\u5316\u901a\u8baf\u6a21\u5757\u5931\u8d25\uff01"+e.toString())}}))},J.prototype.initPainterDesign=function(){var e=this;return new Promise((function(t,n){var i,s=e.config.container instanceof HTMLElement?e.config.container:document.querySelector(e.config.container),r=(s||n("DOM\u8282\u70b9\u672a\u627e\u5230\uff01"+e.config.container),"https://aiart");switch(e.config.env){case"local":r="https://local-aiart";break;case"moni":r="https://moni-aiart"}var a=r+".chuangkit.com",c=(e.config&&1==(null==(i=e.config)?void 0:i.aigc_env)?a+="/editor":a+="/print/"+e.config.companyFlag,a+="?appId="+(null==(i=e.config)?void 0:i.appId)+"&userFlag="+(null==(i=e.config)?void 0:i.unionId)+"&generateButtonTips="+(encodeURIComponent(e.config.generateButtonTips)||"")+"&generateType="+(e.config.generateType||0)+"&downloadType="+(e.config.downloadType||0)+"&m="+(e.config.mParam||0)+"&device_type="+(e.config.device_type||1),document.createElement("iframe"));c.id=R,c.style.width="100%",c.style.height="100%",c.setAttribute("frameborder","0"),c.src=a,c.onload=function(){var n=new o(c.contentWindow,"CKT_AI_PAINTER");e.aiPainterMessageService=n,t(n)},c.onerror=function(e){return n("\u6e32\u67d3DOM\u51fa\u9519"+e)},s.appendChild(c)}))};var q=J,X=function(){return(X=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},V="chuangkit-m-auth-iframe";function $(e){this.config=e}$.prototype.updateConfig=function(e){this.config=e},$.getInstance=function(e){return $.instance?$.instance.updateConfig(e):$.instance=new $(X({env:"prod"},e)),$.instance},$.prototype.createMAuthIframe=function(){var e=document.querySelector(this.config.container);if(!e)return Promise.reject("DOM\u8282\u70b9\u672a\u627e\u5230\uff01"+this.config.container);var t=document.createElement("iframe"),n=(t.id=V,t.style.width="100%",t.style.height="100%",t.setAttribute("frameborder","0"),"htt