var gcs=function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=3)}([function(e,t,n){(function(B,H){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.4+314e4831 */ e.exports=function(){"use strict";function u(e){return"function"==typeof e}var n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,t=void 0,o=void 0,s=function(e,t){p[r]=e,p[r+1]=t,2===(r+=2)&&(o?o(f):y())},e="undefined"!=typeof window?window:void 0,i=e||{},a=i.MutationObserver||i.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==B&&"[object process]"==={}.toString.call(B),l="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function d(){var e=setTimeout;return function(){return e(f,1)}}var p=new Array(1e3);function f(){for(var e=0;e";var a=e+" Diagram File";r.innerHTML+=""+a+"
",r.style.visibility="visible";var s=document.createElement("div");s.id="fileOptions";var c=[],u=0,l=!1;if(0!==n.localStorage.length){for(var d in n.localStorage)if(c.length":"
"}if(!l){var v=t+50;s.innerHTML+="

There may be more diagram files not shown. Click here to try loading more.

",document.getElementById("localStorageLoadMoreFiles").onclick=function(){n.showUI(e,v)}}if(r.appendChild(s),n.currentDiagramFile.id){var g=n.currentDiagramFile.id.replace(/ /g,o),y=document.getElementById(g+"-label");y&&(y.style.fontStyle="italic")}if("Save"===e){var w=document.createElement("div");w.id="userInputDiv",w.innerHTML+='Save Diagram As ',r.appendChild(w)}var b=document.createElement("div");b.id="submitDiv";var _=document.createElement("button");_.textContent=e,_.id="actionButton",_.onclick=function(){n.processUIResult(e)},b.appendChild(_),r.appendChild(b);var P=document.createElement("div"),D=document.createElement("button");return D.id="cancelButton",D.textContent="Cancel",D.onclick=function(){n.hideUI(!0)},P.appendChild(D),r.appendChild(P),n._deferredPromise.promise},S.prototype.processUIResult=function(e){var t=function(){for(var e=document.getElementsByName("localStorageFile"),t=null,n=0;nSave Diagram As
";var e=document.createElement("div");e.id="userInputDiv",e.innerHTML+='',n.appendChild(e);var r=document.createElement("div");r.id="submitDiv";var o=document.createElement("button");o.id="actionButton",o.textContent="Save",o.onclick=function(){var e=document.getElementById("gdb-userInput").value;""!==e&&void 0!==e&&null!=e&&(n.style.visibility="hidden",t.saveWithUI(e))},r.appendChild(o),n.appendChild(r);var i=document.createElement("div");i.id="cancelDiv";var a=document.createElement("button");return a.id="cancelButton",a.textContent="Cancel",a.onclick=function(){t.hideUI(!0)},i.appendChild(a),n.appendChild(i),t._deferredPromise.promise},e.prototype.hideUI=function(e){this.menuPath="",a.prototype.hideUI.call(this,e)},e.prototype.processUIResult=function(e){var t=this;var n=function(){for(var e=document.getElementsByName("dropBoxFile"),t=null,n=0;nSave Diagram As
";var n=document.createElement("div");n.id="userInputDiv",n.innerHTML+='',t.appendChild(n);var r=document.createElement("div");r.id="submitDiv";var o=document.createElement("button");o.id="actionButton",o.textContent="Save",o.onclick=function(){e.saveWithUI()},r.appendChild(o),t.appendChild(r);var i=document.createElement("div");i.id="cancelDiv";var a=document.createElement("button");return a.id="cancelButton",a.textContent="Cancel",a.onclick=function(){e.hideUI(!0)},i.appendChild(a),t.appendChild(i),e._deferredPromise.promise},e.prototype.saveWithUI=function(){var r=this,o=r.ui;return new i.Promise(function(e,t){if("hidden"===o.style.visibility)e(r.showUI());else{var n=document.getElementById("userInput").value;r.save(n),e(r.hideUI())}})},e.prototype.save=function(l){var d=this;return new i.Promise(function(u,e){if(l){-1===l.indexOf(".diagram")&&(l+=".diagram");d.gapiClient.request({path:"/drive/v3/files",method:"GET",params:{q:'trashed=false and name contains ".diagram" and mimeType = "application/json"'},callback:function(e){var t=e.files;if(t)for(var n=0;nSave Diagram As
";var n=document.createElement("div");n.id="userInputDiv",n.innerHTML+='',t.appendChild(n);var r=document.createElement("div");r.id="submitDiv";var o=document.createElement("button");o.id="actionButton",o.textContent="Save",o.onclick=function(){e.saveWithUI()},r.appendChild(o),t.appendChild(r);var i=document.createElement("div");i.id="cancelDiv";var a=document.createElement("button");return a.id="cancelButton",a.textContent="Cancel",a.onclick=function(){e.hideUI(!0)},i.appendChild(a),t.appendChild(i),e._deferredPromise.promise},e.prototype.saveWithUI=function(){var o=this,i=o.ui;return new l.Promise(function(e,t){if("hidden"===i.style.visibility)e(o.showUI());else{var r=document.getElementById("userInput").value;r&&-1===r.indexOf(".diagram")&&(r+=".diagram");var n={clientId:o.clientId,action:"query",openInNewWindow:!0,success:function(e){var t=e.value[0],n=e.accessToken;o.currentDiagramFile={id:null,name:r,token:n,parentReference:{driveId:t.parentReference.driveId,id:t.id},path:"placeholder"},o.hideUI(),o.save()}};r&&""!==r&&void 0!==r?o.oneDriveFilepicker.save(n):t("Cannot save file to OneDrive with save name "+r)}})},e.prototype.save=function(c){var u=this;return new l.Promise(function(n,r){if(c){var o=new XMLHttpRequest;-1===c.indexOf(".diagram")&&(c+=".diagram");var e=u.makeSaveFile();o.open("PUT","https://graph.microsoft.com/v1.0"+c+":/content",!0),o.setRequestHeader("Authorization","Bearer "+u.oauthToken),o.setRequestHeader("Content-Type","application/json"),o.onreadystatechange=function(){if(4===o.readyState)if(200<=o.status&&o.status<300){var e=JSON.parse(o.response),t={name:e.name,id:e.id,path:e.parentReference.path+"/"+e.name,parentReference:e.parentReference};n(t)}else{if(401!==o.status)throw Error(o.response);u.authorize(!0)}},o.send(e)}else if(u.currentDiagramFile.path){var i=u.currentDiagramFile.token,t=u.generateGraphUrl(u.currentDiagramFile,!0,!0),a=(e=u.makeSaveFile(),i?u.currentDiagramFile.token:u.oauthToken),s=new XMLHttpRequest;s.open("PUT",t,!0),s.setRequestHeader("Authorization","Bearer "+a),s.onload=function(){if(4!==s.readyState||200!==s.status&&201!==s.status)r(s.response);else{var e=JSON.parse(s.response),t={name:e.name,id:e.id,path:e.parentReference.path+"/"+e.name,token:i,parentReference:e.parentReference};u.currentDiagramFile=t,n(t),u._deferredPromise.promise.resolve(t),u._deferredPromise.promise=u.makeDeferredPromise()}},s.send(e)}else n(u.saveWithUI())})},e.prototype.loadWithUI=function(){var i=this;return new l.Promise(function(o,e){var t={clientId:i.clientId,action:"share",multiSelect:!1,advanced:{filter:".diagram"},success:function(e){var t=e.value[0],n=e.accessToken,r=t.parentReference.path+"/"+t.name;o(i.load(r,n))}};i.oneDriveFilepicker.open(t)})},e.prototype.load=function(n,o){var i=this;return new l.Promise(function(r,e){if(n){var t=o||i.oauthToken;i.getFile(n,t).then(function(t){var e=t["@microsoft.graph.downloadUrl"],n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){if(4===n.readyState&&200===n.status){i.loadFromFileContents(n.response);var e={name:t.name,id:t.id,path:t.parentReference.path+"/"+t.name,token:o,parentReference:{id:t.parentReference.id,driveId:t.parentReference.driveId}};i.currentDiagramFile=e,r(e)}},n.send()})}else e("Cannot load file from OneDrive with path "+n)})},e.prototype.removeWithUI=function(){var i=this;return new l.Promise(function(o,e){var t={clientId:i.clientId,action:"share",openInNewWindow:!0,success:function(e){if(e){var t=e.value[0],n=e.accessToken,r=t.parentReference.path+"/"+t.name;o(new l.Promise(function(e,t){e(i.remove(r,n))}))}}};i.oneDriveFilepicker.open(t)})},e.prototype.remove=function(i,e){var a=this,s=e||a.oauthToken;return new l.Promise(function(r,o){a.getFile(i,s).then(function(e){var t={name:e.name,id:e.id,path:e.parentReference.path+"/"+e.name},n=new XMLHttpRequest;n.open("DELETE","https://graph.microsoft.com/v1.0"+i,!0),n.setRequestHeader("Authorization","Bearer"+s),n.onload=function(){4===n.readyState&&204===n.status?(a.currentDiagramFile&&i===a.currentDiagramFile.path&&(a.currentDiagramFile={id:null,path:null,name:null}),r(t)):401===n.status?a.authorize(!0):o(n.response)},n.send()}).catch(function(e){throw Error(e)})})},e.prototype.generateGraphUrl=function(e,t,n){var r="https://graph.microsoft.com/v1.0/";return r+=t?"drives/"+e.parentReference.driveId+"/items/"+e.parentReference.id+"/children/"+e.name:"drives/"+e.parentReference.driveId+"/items/"+e.id,n&&(r+="/content"),r},e}(n(1).GoCloudStorage);t.GoOneDrive=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=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])},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=n(0),i=function(i){function t(e,t,n,r){var o=i.call(this,e,n)||this;return o._rootEndpoint=t,o.ui.id="goNetCoreCustomFilepicker",o._serviceName="Microsoft ASP .NET Core Web API",o._className="GoNetCore",o}return o(t,i),Object.defineProperty(t.prototype,"rootEndpoint",{get:function(){return this._rootEndpoint},enumerable:!0,configurable:!0}),t.prototype.authorize=function(e){void 0===e&&(e=!1);return new s.Promise(function(e,t){e(!0)})},t.prototype.showUI=function(m,h){var v=this,g=v.ui;h||(h=0);var y=t._MIN_FILES_IN_UI+h;g.innerHTML="";var e=m+" Diagram File";g.innerHTML+=""+e+"
",document.getElementsByTagName("body")[0].appendChild(g),g.style.visibility="visible";var w=document.createElement("div");w.id="fileOptions";var b=[],_=0,P=!1;return v.getFiles().then(function(e){if(0!==e.length)for(var t in e){var n=e[t];if(b.length":"
"}if(!P){var s=h+50;w.innerHTML+="

There may be more diagram files not shown. Click here to try loading more.

",document.getElementById("netCoreLoadMoreFiles").onclick=function(){v.showUI(m,s)}}if(g.appendChild(w),v.currentDiagramFile.id){var c=document.getElementById(v.currentDiagramFile.id+"-label");c&&(c.style.fontStyle="italic")}if("Save"===m){var u=document.createElement("div");u.id="userInputDiv",u.innerHTML+='Save Diagram As ',g.appendChild(u)}var l=document.createElement("div");l.id="submitDiv";var d=document.createElement("button");d.textContent=m,d.id="actionButton",d.onclick=function(){v.processUIResult(m)},l.appendChild(d),g.appendChild(l);var p=document.createElement("div"),f=document.createElement("button");f.id="cancelButton",f.textContent="Cancel",f.onclick=function(){v.hideUI(!0)},p.appendChild(f),g.appendChild(p)}),v._deferredPromise.promise},t.prototype.processUIResult=function(e){var t=function(){for(var e=document.getElementsByName("localStorageFile"),t=null,n=0;n"+e+"

",document.body.appendChild(n),setTimeout(function(){n.style.opacity="0",setTimeout(function(){n.parentNode.removeChild(n)},1e3)},1e3*t)},e.prototype.getStorageIconPath=function(e){if(null==this.iconsRelativeDirectory||void 0===this.iconsRelativeDirectory)return null;var t=this.iconsRelativeDirectory;switch(e){case"GoGoogleDrive":t+="googleDrive.jpg";break;case"GoOneDrive":t+="oneDrive.png";break;case"GoLocalStorage":t+="localStorage.png";break;case"GoDropBox":t+="dropBox.png"}return t},e.prototype.selectStorageService=function(){var u=this,l=this.storages;return new s.Promise(function(r,e){var t=u.menu;t.innerHTML="Select Storage Service
";var n=document.createElement("p");n.id="gcsmSelectedStorage",n.innerHTML=u.currentStorage.serviceName,t.appendChild(n),t.onchange=function(){for(var e=document.getElementsByName("storageSelection"),t=null,n=0;n"}),t.appendChild(o);t.innerHTML+="

This will be where you save / load diagram model data to / from. You will need to grant GoCloudStorage permission to access your files on the selected storage service.

";var i=document.createElement("div"),a=document.createElement("button");a.id="actionButton",a.textContent="Select",a.onclick=function(){for(var e=document.getElementsByName("storageSelection"),t=null,n=0;n