From 55fee2abb5cf995e3f1ed45669698c177a31084b Mon Sep 17 00:00:00 2001 From: Bashar Date: Mon, 28 Aug 2023 23:49:18 +0300 Subject: [PATCH] build SDK --- pluginTester/scripts/framework/app.min.js | 2 +- pluginTester/scripts/framework/web.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pluginTester/scripts/framework/app.min.js b/pluginTester/scripts/framework/app.min.js index 5853825e..fde23902 100755 --- a/pluginTester/scripts/framework/app.min.js +++ b/pluginTester/scripts/framework/app.min.js @@ -24,7 +24,7 @@ "use strict";function PluginInstanceAPI(t){this.templateUrl="pages/plugins/pluginInstanceDialog/pluginInstanceDialog.html",this.controller="pluginInstanceDialog",this.appId=t.appId,this.liveMode=t.liveMode,this.appHost=window.siteConfig.endPoints.appHost;t=JSON.parse(JSON.stringify(t));t.pluginId="pluginInstances",t.instanceId=1,this.ds=new DatastoreAPI(t)}PluginInstanceAPI.prototype={showDialog:function(t,n){window.openDialog?(t={templateUrl:this.templateUrl,controller:this.controller,size:"lg",data:t},window.openDialog(t,function(t){n&&n(null,t)})):console.error("openDialog isnt defined")},get:function(t,i){var n={};n.obj={filter:{"$json.instanceId":t},pageSize:1,withDynamicData:!0},this.ds.search(n,function(t,n){t?i(t,null):n&&n.length?i(null,n[0].data):i(null)})},_createReadUrl:function(){return this.appHost+"/api/appPluginInstances/getByIds/"+this.appId},_httpGet:function(t,n,i){bfUtils.http.get(t,{params:n}).success(function(t){i(null,t)}).error(function(t){i(t)})},search:function(t,n){var i;(t.title||t.instanceIds)&&(i={}),t.title&&(i["$json.title"]={$regex:t.title,$options:"-i"}),t.instanceIds&&(i["$json.instanceId"]={$in:t.instanceIds});t={obj:{filter:i,page:t.pageIndex,pageSize:t.pageSize,withDynamicData:!0,recordCount:!0},tag:""};this.ds.search(t,n)}}; "use strict";var deviceAPI={calendar:{addEvent:function(a,i){permissionRequestsAPI.queueRequest("calendar",this,function(){var e;if(!(e=window.plugins&&window.plugins.calendar?window.plugins.calendar:e))return console.warn("cannot complete action add event to calendar. so fake it"),void(0<=window.location.protocol.indexOf("http")?alert("Adding to calendar requires native app."):console.error("Calendar feature not installed"));a.startDate instanceof Date||(a.startDate=new Date(a.startDate)),a.endDate instanceof Date||(a.endDate=new Date(a.endDate));function n(e){i(null,e)}function t(e){i(e)}var o;a.options?((o=e.getCalendarOptions()).firstReminderMinutes=a.options.firstReminderMinutes||o.firstReminderMinutes,o.secondReminderMinutes=a.options.secondReminderMinutes||o.secondReminderMinutes,o.recurrence=a.options.recurrence||o.recurrence,a.options.recurrenceEndDate&&(o.recurrenceEndDate=new Date(a.options.recurrenceEndDate)),e.createEventWithOptions(a.title,a.location,a.notes,a.startDate,a.endDate,o,n,t)):e.createEvent(a.title,a.location,a.notes,a.startDate,a.endDate,n,t)})}},share:function(e,n){function t(){console.warn("device sharing plugin not found. defaulting to email sending"),window.location="mailto:?subject="+encodeURIComponent(e.subject)+"&body="+encodeURIComponent(e.text+" "+e.link),n(null,!0)}var o,a,i;window.plugins&&window.plugins.socialsharing?(window.plugins.socialsharing.share(e.text,e.subject,e.image,e.link),n(null,!0)):navigator.share?(console.warn("device sharing plugin not found. defaulting to the Web Share API"),o=e.subject,a=e.link,i=e.text,navigator.share({title:o,text:i,url:a}).then(function(){n(null,!0)}).catch(function(e){20!=e.code&&t(),console.log("Error sharing:",e)})):t()},onAppBackgrounded:function(e){document.addEventListener("deviceAppBackgrounded",e,!1)},onAppResumed:function(e){document.addEventListener("deviceAppResumed",e,!1)},getAppSchema:function(){var e=null;return e=window.appContext&&window.appContext.currentApp&&window.appContext.currentApp.appId?"app"+window.appContext.currentApp.appId.slice(0,6):e},contacts:{search:function(e,n){var t=this;permissionRequestsAPI.queueRequest("contacts",this,function(){t._search(e,n)})},_search:function(n,t){var e,o=new ComponentUIAPI,a=[],i={};navigator.contacts&&navigator.contacts.find?((e=new ContactFindOptions).desiredFields=[navigator.contacts.fieldType.displayName,navigator.contacts.fieldType.name,navigator.contacts.fieldType.nickname,navigator.contacts.fieldType.photos,navigator.contacts.fieldType.emails,navigator.contacts.fieldType.phoneNumbers],e.filter="",e.multiple=!0,navigator.contacts.find([""],function(e){e.forEach(function(e){var n;i.text=e.displayName||(null===(n=e.name)||void 0===n?void 0:n.formatted)||e.nickname||"".concat((null===(n=e.name)||void 0===n?void 0:n.givenName)||""," ").concat((null===(n=e.name)||void 0===n?void 0:n.familyName)||""),i.imageUrl=e.photos&&0".concat(e.value,"")}),e.emails&&e.emails.forEach(function(e){i.secondaryText+="
".concat(e.value,"
")}),i.text&&(a.push(i),i={})});o.openDrawer({header:n.header||" ",content:n.content||"",listItems:a,multiSelection:!0,multiSelectionActionButton:{text:n.drawerButtonText||"Import",type:n.drawerButtonType||"success"},enableFilter:!0},function(e,n){n&&n.forEach(function(e){delete e.text,delete e.secondaryText,delete e.imageUrl}),t(e,n)})},function(e){t(e,null)},e)):t("Contacts plugin is not integrated or not working properly",null)},showDialog:function(e,n){var t=this;permissionRequestsAPI.queueRequest("contacts",this,function(){t._showDialog(e,n)})},_showDialog:function(e,t){navigator.contacts&&navigator.contacts.pickContact?navigator.contacts.pickContact(function(e){var n={};n.name=e.displayName||e.name.formatted||e.nickname||"".concat(e.name.givenName||""," ").concat(e.name.familyName||""),n.emails=e.emails||[],n.photos=e.photos||[],n.phoneNumbers=e.phoneNumbers||[],t(null,n)},function(e){t(e,null)}):t("Contacts plugin is not integrated or not working properly",null)}}};document.addEventListener("deviceready",function(){window.open=function(e,n,t){var o,a="_blank"===n,n=cordova.InAppBrowser.open(e,n,t),t=n&&n.channels&&n.channels.close;return a&&t&&((o=document.getElementById("webviewBackdrop"))&&(o.querySelector("#removeBackdropBtn").addEventListener("click",function(){i()}),o.classList.remove("hide")),n&&n.addEventListener("close",function(){i()}),n&&n.addEventListener("exit",function(){i()})),n;function i(){var e=document.getElementById("webviewBackdrop");e&&!e.classList.contains("hide")&&(e.classList.add("closing"),setTimeout(function(){e.classList.replace("closing","hide")},250))}},"undefined"!=typeof cordova&&cordova.plugins&&cordova.plugins.backgroundMode&&cordova.plugins.backgroundMode.enable&&cordova.plugins.backgroundMode.setDefaults({title:"App is running in background",text:""})}); "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function HistoryAPI(t,s,e,i){var n;"object"==_typeof(t)?(this.appId=(n=t).appId,this.pluginId=n.pluginId,this.instanceId=n.instanceId,this.liveMode=n.liveMode):(this.appId=t,this.pluginId=s,this.instanceId=e,this.liveMode=i)}HistoryAPI.prototype={historyItems:[],push:function(t,s){if("undefined"==typeof emulatorSync){if("plugin"!=t.source){var e=-1;if(1e.currentStepOptions.maxLength&&(e.currentStepData.textValue=e.currentStepData.textValue.substring(0,e.currentStepOptions.maxLength),t.target.value=e.currentStepData.textValue),e.doneButton.disabled=!e.validate()}),i.appendChild(this.textarea),this.imageGallery=document.createElement("div"),this.imageGallery.id="imageGallery",this.geoContainer=document.createElement("div"),this.geoContainer.id="geo-container",this.geoContainer.classList="img-gallery-container",this.geoContainer.style.display="none",this.geoImage=document.createElement("img"),this.geoImage.id="geo-img",this.geoContainer.appendChild(this.geoImage),this.geoDeleteBtn=document.createElement("span"),this.geoDeleteBtn.className="galery-delete glyphicon glyphicon-minus-sign",this.geoDeleteBtn.onclick=function(){return e.setLocation()},this.geoContainer.appendChild(this.geoDeleteBtn),this.imageGallery.appendChild(this.geoContainer),i.appendChild(this.imageGallery),this.cancelButton=document.createElement("button"),this.cancelButton.className="inputapi-cancel titleBarTextAndIcons",this.dialogNavFlex.appendChild(this.cancelButton),this.title=document.createElement("h1"),this.title.className="inputapi-nav-title primary titleBarTextAndIcons ellipsis",this.title.style.whiteSpace="nowrap",this.dialogNavFlex.appendChild(this.title),this.titleSecondary=document.createElement("h1"),this.titleSecondary.className="inputapi-nav-title secondary titleBarTextAndIcons ellipsis",this.titleSecondary.style.whiteSpace="nowrap",this.dialogNavFlexSecondary.appendChild(this.titleSecondary),this.doneButton=document.createElement("button"),this.doneButton.className="inputapi-done titleBarTextAndIcons",this.dialogNavFlex.appendChild(this.doneButton),this.actionFooter=document.createElement("div"),this.actionFooter.className="inputapi-footer",i.appendChild(this.actionFooter),this.cameraBtn=document.createElement("span"),this.cameraBtn.className="icon icon-camera2 needsclick",this.cameraBtn.onclick=function(t){return e.showFileDialog()},this.actionFooter.appendChild(this.cameraBtn),this.geoPin=document.createElement("span"),this.geoPin.id="goc-pin",this.geoPin.className="icon icon-map-marker",this.geoPin.onclick=function(t){return e.showLocationModal()},this.actionFooter.appendChild(this.geoPin),this.gifBtn=document.createElement("span"),this.gifBtn.className="icon icon-gif",this.gifBtn.id="gif-btn",this.gifBtn.onclick=function(t){return e.showGifDialog()},this.actionFooter.appendChild(this.gifBtn),this.listDialog.id="listDialog";t=document.createElement("div");t.className="body backgroundColorTheme",this.listDialog.appendChild(t),this.listDialogHeader=document.createElement("h1"),this.listDialogHeader.className="list-header",t.appendChild(this.listDialogHeader),this.listDialogItems=document.createElement("form"),this.listDialogItems.className="input-list",t.appendChild(this.listDialogItems);i=document.createElement("div");i.className="button-container",t.appendChild(i),this.listDialogCancelBtn=document.createElement("button"),this.listDialogCancelBtn.className="cancel primaryTheme",i.appendChild(this.listDialogCancelBtn),this.listDialogConfirmBtn=document.createElement("button"),this.listDialogConfirmBtn.className="confirm primaryTheme",i.appendChild(this.listDialogConfirmBtn),0<=window.location.pathname.indexOf("pluginTester")?(document.getElementById("app").appendChild(this.inputDialog),document.getElementById("app").appendChild(this.listDialog),document.getElementById("app").appendChild(this.backdrop)):(document.body.appendChild(this.inputDialog),document.body.appendChild(this.listDialog),document.body.appendChild(this.backdrop)),this.initialized=!0},showLocationModal:function(){var d=this;window.spinner&&window.spinner.show(),this.getLocation(function(t,e){try{if(t)throw t;var i=e.coords,n=i.latitude,a=i.longitude,o=d.getMapUrl(e),l=o.mapUrl,r=o.thumbnail;if(d.currentStepOptions.attachments.location.required)return window.spinner&&window.spinner.hide(),d.geoDeleteBtn.style.display="none",d.setLocation({latitude:n,longitude:a},r);var s={title:"Send My Current Location",richContent:'\n \n '),action:{title:"Confirm",handler:function(){return d.setLocation({latitude:n,longitude:a},r)}}};window.spinner&&window.spinner.hide(),richModal.display(s)}catch(t){console.error("inputAPI location error",t);var c="Failed to determine location. Please try again later.";if(t.code)switch(t.code){case 1:c="App does not have location access.";break;case 2:c="Location information is not availible to this device.";break;case 3:c="Location request timed out. Try again.";break;case 4:c="Failed to determine location. Please try again later (code 4)";break;case 5:c="This app does not have access to this feature."}richModal.display({title:"Could not determine location",richContent:c}),window.spinner&&window.spinner.hide()}})},getLocation:function(i){var n,a=null;appApiKeys.get(function(t,e){(n=e.googleMapKey)||((a=new Error("no google API key")).code=5),a||"object"==("undefined"==typeof geoAPI?"undefined":_typeof(geoAPI))||((a=new Error("geoAPI not defined")).code=4),a?i(a,null):geoAPI.getCurrentPosition({timeout:1e4},function(t,e){e&&(e.googleMapKey=n),i(t,e)})})},setLocation:function(t,e){t&&e?"undefined"!=typeof tinymce&&tinymce.activeEditor?(tinymce.activeEditor.insertContent('')),this.currentStepData.location=t):(this.currentStepData.location=t,this.geoContainer.style.display="block",this.geoImage.src=e):(this.currentStepData.location={},this.geoContainer.style.display="none",this.geoImage.removeAttribute("src")),this.doneButton.disabled=!this.validate()},getMapUrl:function(t){var e=t.coords,i=e.latitude,n=e.longitude,e=t.googleMapKey,t="size=".concat(window.innerWidth,"x").concat(window.innerWidth),t="zoom=15&".concat(t,"&maptype=roadmap&key=").concat(e),e="center=".concat(i,",").concat(n),n="markers=color:blue|size:large|".concat(i,",").concat(n),n="".concat("https://maps.googleapis.com/maps/api/staticmap","?").concat(e,"&").concat(n,"&").concat(t),t=n.replace(/size:large/g,"size:mid").replace(/size=\d{1,4}x\d{1,4}/g,"size=100x100").replace(/zoom=15/g,"zoom=12");return{mapUrl:n,thumbnail:t}},showGifDialog:function(){var n,t,a,o=this,i=0inputAPI.currentStepOptions.maxLength&&(inputAPI.currentStepData.textValue=inputAPI.currentStepData.textValue.substring(0,inputAPI.currentStepOptions.maxLength),t.target.value=inputAPI.currentStepData.textValue),inputAPI.doneButton.disabled=!inputAPI.validate()})}}},fullWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e full_width Created with Sketch. ',halfWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e half_width Created with Sketch. ',thirdWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e third_width Created with Sketch. ',quarterWidthIcon:' \x3c!-- Generator: Sketch 59.1 (86144) - https://sketch.com --\x3e quarter_width Created with Sketch. ',_showTinyMceDialog:function(a,t){var e="image"===t?"Image":"Gif",i="Insert ".concat(e),t={title:"Save",handler:function(){var e;["fullWidth","halfWidth","thirdWidth","quarterWidth"].some(function(t){if(document.querySelector('input[value="'.concat(t,'"]')).checked)return e=t,!0});var t,i=tinyMCE.activeEditor.getContainer().clientWidth;switch(e){case"fullWidth":i="calc(".concat(i,"px - 2rem)"),t="full_width";break;case"halfWidth":i="calc(".concat(i/2,"px - 1rem)"),t="half_width";break;case"thirdWidth":i="calc((".concat(i,"px - 2rem) / 3)"),t="third_width";break;case"quarterWidth":i="calc(".concat(i/4,"px - .5rem)"),t="quarter_width"}var n=imageTools.resizeImage(a,{size:t,aspect:"1:1"});tinymce.activeEditor.insertContent('')),richModal.close()}},e='\n
\n

'.concat(e,' size

\n
\n \n \n ').concat(this.fullWidthIcon,'\n
\n
\n \n \n ').concat(this.halfWidthIcon,'\n
\n
\n \n \n ').concat(this.thirdWidthIcon,'\n
\n
\n \n \n ').concat(this.quarterWidthIcon,"\n
\n
\n ");richModal.display({title:i,richContent:e,action:t})},renderStep:function(e,i,n){var a=this;this.currentStepData={wysiwygValue:e.defaultValue||"",textValue:e.defaultValue||"",images:[],location:{},gifs:[]},e.maxLength=e.maxLength||2e3,this.currentStepOptions=e,this.title.innerHTML=e.title||"",this.titleSecondary.innerHTML=e.title||"";var t=this.currentStepOptions.attachments,o=t.location,l=t.images,r=t.gifs,s=!1;["images","gifs","location"].forEach(function(t){e.attachments[t]&&e.attachments[t].enable&&(e.attachments[t].required||(s=!0))}),this.actionFooter.style.display=s?"flex":"none",this.cameraBtn.style.display=l.enable&&this.currentStepData.images.length<6?"block":"none",this.geoPin.style.display=o.enable&&!o.required?"block":"none",this.gifBtn.style.display=r.enable?"block":"none",this.imageGallery.style.display=e.wysiwyg?"none":"flex",this.currentUserContainer.innerHTML="";var c=authAPI.getCurrentUser();this.userImage=document.createElement("img"),c&&c.imageUrl?"undefined"!=typeof imageTools?this.userImage.src=imageTools.cropImage(c.imageUrl,{size:"xs",aspect:"1:1",compression:70}):this.userImage.src=c.imageUrl:this.userImage.src="https://pluginserver.buildfire.com/styles/media/avatar-placeholder.png",this.userImage.className="inputapi-user-image",this.currentUserContainer.appendChild(this.userImage),this.userTitle=document.createElement("h1"),this.userTitle.className="inputapi-user-title ellipsis",c&&(this.userTitle.innerHTML=c.displayName||(c.firstName?c.firstName+" ":"")+(c.lastName||"")||""),this.currentUserContainer.appendChild(this.userTitle),e.wysiwyg?(document.getElementById("tinymce-styles")||document.head.appendChild(inputAPI.getTinyMceStyles()),"undefined"!=typeof Keyboard&&Keyboard.shrinkView&&Keyboard.shrinkView(!0),this.textarea.innerHTML=this.textarea.value=e.defaultValue||"",tinymce.init(this.getTinyMceOptions(e,this)),this.cameraBtn.onclick=function(t){return a.showFileDialog(!0)},this.gifBtn.onclick=function(t){return a.showGifDialog(!0)}):(this.textarea.placeholder=e.placeholder||"Type something...",this.textarea.maxLength=e.maxLength||2e3,this.textarea.value=e.defaultValue?e.defaultValue.substring(0,this.textarea.maxLength):"");t=document.createElement("div");t.className="btn-txt primary",t.innerHTML=e.saveText||(e._buffer.length?"Next":"Done");l=document.createElement("div");l.className="btn-txt secondary iconsTheme",l.innerHTML=e.saveText||(e._buffer.length?"Next":"Done");r=document.createElement("div");r.className="btn-txt primary",r.innerHTML=e.cancelText||"Cancel";c=document.createElement("div");for(c.className="btn-txt secondary iconsTheme",c.innerHTML=e.cancelText||"Cancel",this.doneButton.innerHTML="",this.cancelButton.innerHTML="",this.doneButton.appendChild(t),this.doneButton.appendChild(l),this.cancelButton.appendChild(r),this.cancelButton.appendChild(c),this.doneButton.onclick=function(t){a.doneButton.disabled||n(a.currentStepData)},this.cancelButton.onclick=function(t){return i()},this.backdrop.onclick=function(t){return i()},e.prefill&&(this.textarea.value=e.prefill),this.doneButton.disabled=!this.validate();this.imageGallery.childNodes[1];)this.imageGallery.removeChild(this.imageGallery.childNodes[1]);"object"==_typeof(e.defaultAttachments)&&(r=(l=e.defaultAttachments).images,c=l.gifs,l=l.location,r&&r.length&&(this.currentStepData.images=r).forEach(function(t){a.addToGallery(t,"images")}),c&&c.length&&(this.currentStepData.gifs=c).forEach(function(t){return a.addToGallery(t,"gifs")}),this.currentStepData.gifs=c,this.currentStepData.location=l),o.required?this.showLocationModal():this.setLocation()},showTextDialog:function(t,e){var i,n=this;t&&e&&("undefined"==typeof tinymce&&("function"==typeof t.some?t.some(function(t){return t.wysiwyg}):t.wysiwyg)?((i=document.createElement("script")).src=window._appRoot+"scripts/lib/tinymce/js/tinymce/tinymce.min.js",i.type="text/javascript",i.onload=function(){n._showTextDialog(t,e)},document.getElementsByTagName("head")[0].appendChild(i)):this._showTextDialog(t,e))},_showTextDialog:function(t,e){var n=this;if(t&&e){if(this.currentStepOptions&&this.currentStepOptions._buffer)return e({message:"inputDialog is already active"});this.initialized||this.init();var a=new PublicFilesAPI(window.appContext.currentApp),o=Array.isArray(t)?t:[t],l=[],i=!1,r=!1;if(o.forEach(function(t){t.cancelText&&9t*-Math.abs(1.25)&&e<1.25*t},processLazyImages:function(){var t=this;document.querySelectorAll(".lazy-img").forEach(function(e){return t.process(e)})}}};setTimeout(function(){gifAPI.initialized||gifAPI.init()},5e3); diff --git a/pluginTester/scripts/framework/web.min.js b/pluginTester/scripts/framework/web.min.js index 00ff8119..44d41932 100644 --- a/pluginTester/scripts/framework/web.min.js +++ b/pluginTester/scripts/framework/web.min.js @@ -1,4 +1,4 @@ -"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var a,i=Object.keys(t);return Object.getOwnPropertySymbols&&(a=Object.getOwnPropertySymbols(t),e&&(a=a.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,a)),i}function _objectSpread(t){for(var e=1;e=i.scrollHeight&&e.$apply(a.scrolly)})}}}),$app.service("ImageLibService",["$http",function(s){var a=null,n=null;return{loadImages:function(i){var e,o=i.appId;function t(){return new Promise(function(t,a){var e="".concat(siteConfig.endPoints.datastoreHost,"/app/").concat(o,"/image");s.get(e,{params:i}).then(function(e){t(e?e.data:null)}).catch(function(e){a(e)})})}return void 0!==i.startIndex||i.startKey||(i.startIndex=0),0!=i.startIndex||i.startWith?t():(n&&(e=(new Date).getTime()-n.getTime(),30"+e+"",s=0,e=function(){s++;try{for(var e,t=n.styleSheets[n.styleSheets.length-1],a=t.rules||t.cssRules,i=[],o=0;ol.generatedImages.length&&(l.activeIndex=1)},l.back=function(){l.activeIndex--,l.activeIndex<1&&(l.activeIndex=l.generatedImages.length)},l.generatedImages=[],l.activeIndex=1,l.uploadAIImageLoading=!1,l.generateAIImageStarted=!1,l.start=function(){l.createImageLoading=!0,l.aiImageGenerated=!1,l.aiImageGeneratingError=!1,l.imageLoaded=!1,c({method:"POST",url:"/api/app/".concat(imageLibCurrentApp.context.appId,"/ai/generateImage"),data:{prompt:y(),numberOfImages:1,size:"1024x1024",responseFormat:"url"}}).then(function(e){l.createImageLoading=!1,l.aiImageGenerated=!0,e&&e.data&&e.data.content&&l.generatedImages.push({url:function(e){switch(1 : \" / \\ | ? *":t&&!t.isFileExist?(o.errors=null,Object.defineProperty(o.data.newFile,"name",{writable:!0,value:a}),n.close({action:"rename",newFile:o.data.newFile})):o.errors.fileName="Name is already in use"},0!==(e=a).length&&(t="".concat(siteConfig.endPoints.datastoreHost,"/app/").concat(imageLibCurrentApp.context.appId,"/validateImage"),s.get(t,{params:{filename:e}}).success(function(e,t){i(null,e)}).error(function(e,t){console.error(e),i(e,null)})))}else o.errors.fileName="Image name cannot be empty";var e,i,t},o.replace=function(){o.close({action:"replace",newFile:o.data.newFile,existingFile:o.data.existingFile})},o.close=function(){n.close(0=i.scrollHeight&&e.$apply(a.scrolly)})}}}),$app.service("ImageLibService",["$http",function(n){var a=null,s=null;return{loadImages:function(i){var e,o=i.appId;function t(){return new Promise(function(t,a){var e="".concat(siteConfig.endPoints.datastoreHost,"/app/").concat(o,"/image");n.get(e,{params:i}).then(function(e){t(e?e.data:null)}).catch(function(e){a(e)})})}return void 0!==i.startIndex||i.startKey||(i.startIndex=0),0!=i.startIndex||i.startWith?t():(s&&(e=(new Date).getTime()-s.getTime(),30"+e+"",s=0,e=function(){s++;try{for(var e=r.styleSheets[r.styleSheets.length-1],t=e.rules||e.cssRules,a=[],i=0;il.generatedImages.length&&(l.activeIndex=1)},l.back=function(){l.activeIndex--,l.activeIndex<1&&(l.activeIndex=l.generatedImages.length)},l.generatedImages=[],l.activeIndex=1,l.uploadAIImageLoading=!1,l.generateAIImageStarted=!1,l.start=function(){l.createImageLoading=!0,l.aiImageGenerated=!1,l.aiImageGeneratingError=!1,l.imageLoaded=!1,g({method:"POST",url:"/api/app/".concat(imageLibCurrentApp.context.appId,"/ai/generateImage"),data:{prompt:k(),numberOfImages:1,size:"1024x1024",responseFormat:"url"}}).then(function(e){l.createImageLoading=!1,l.aiImageGenerated=!0,e&&e.data&&e.data.content&&l.generatedImages.push({url:function(e){switch(1 : \" / \\ | ? *":t&&!t.isFileExist?(o.errors=null,Object.defineProperty(o.data.newFile,"name",{writable:!0,value:a}),s.close({action:"rename",newFile:o.data.newFile})):o.errors.fileName="Name is already in use"},0!==(e=a).length&&(t="".concat(siteConfig.endPoints.datastoreHost,"/app/").concat(imageLibCurrentApp.context.appId,"/validateImage"),n.get(t,{params:{filename:e}}).success(function(e,t){i(null,e)}).error(function(e,t){console.error(e),i(e,null)})))}else o.errors.fileName="Image name cannot be empty";var e,i,t},o.replace=function(){o.close({action:"replace",newFile:o.data.newFile,existingFile:o.data.existingFile})},o.close=function(){s.close(0