1import{h as r,m as l,K as f}from"./main-9c32015c.js";import"./helpers-6b10caa0.js";function p(){var n,u=document.getElementById("import_google_btn"),s=document.getElementById("google_calendar_list"),i;u.onclick=function(){m()},window.addEventListener("message",function(t){t.data&&c(t.data)});function g(t){new r().get("google/request/auth".withApi()).then(function(e){n=e.url}).fail(function(){bootbox.alert(l.tr_1039+l.tr_1088)})}function m(){n&&(window.SafariViewController?SafariViewController.isAvailable(function(t){t?SafariViewController.show({url:n,hidden:!1,animated:!0,tintColor:"#307986",barColor:"#eef6f3",controlTintColor:"#307986"},function(e){},function(e){}):window.open(n,"_system","location=yes")}):f.Platform.CORDOVA&&f.Platform.ANDROID?window.open(n,"_system"):window.open(n,"_blank"))}function h(t){new r().post(("google/import/"+t).withApi(),ImportManager.getData()).then(function(e){if(e.errors)bootbox.alert(e.errors.general);else{if(e.events){if(e.events.length===1){var o=e.events[0];$.klender.moveToSelectedDate({date:o.getNearestDate()})}$.scheduler._setSyncEvents(e.events)}e.notImportedEvents&&e.notImportedEvents.length>0&&bootbox.alert((l.tr_1427+" "+e.notImportedEvents.join(", ")).trim()),e.success&&e.success.general&&bootbox.alert(e.success.general),exit("klender")}})}function w(t){for(var e=document.createDocumentFragment(),o=0,C=t.length;o<C;o++){var d=t[o],a=document.createElement("button");a.className="button_link google_calendar",a.textContent=d.name,a.dataset.id=d.id,a.onclick=function(_){_.preventDefault(),h(this.dataset.id)},e.appendChild(a)}s.clean().appendChild(e)}function v(){new r().get("google/calendars".withApi(),{headers:{code:i}}).then(function(t){t.errors?bootbox.alert(t.errors.general):t.calendars&&w(t.calendars)})}function c(t){var e=t.match(/code=(.+)/);e&&(i=e[1],window.SafariViewController&&SafariViewController.hide(),route("google_calendars",{type:Action.GOOGLE_CALENDARS}))}return{requestAuth:g,getCalendars:v,onAuth:c}}export{p as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.