(function(){function g(c,e,b,f,d,m){e[c]&&(b.push(c),(!0===e[c]||1===e[c])&&f.push(d+c+"/"+m))}function l(c,e,b,f,d){e=f+e+"/"+d;require._fileExists(c.toUrl(e+".js"))&&b.push(e)}function k(c,e,b){for(var f in e)e.hasOwnProperty(f)&&(!c.hasOwnProperty(f)||b)?c[f]=e[f]:"object"===typeof e[f]&&k(c[f],e[f],b)}var e=/(^.*(^|\/)nls(\/|$))([^\/]*)\/?([^\/]*)/;define("i18n",["module"],function(c){var h=c.config?c.config():{},h=h||{};return{version:"2.0.1+",load:function(b,f,d,m){m=m||{};m.locale&&(h.locale=
m.locale);var a=e.exec(b),n=a[1],c=a[4],t=a[5],r=c.split("-"),s=[],w={},v,u="";a[5]?(n=a[1],b=n+t):(t=a[4],c=h.locale,c||(c=h.locale="undefined"===typeof navigator?"root":(navigator.language||navigator.userLanguage||"root").toLowerCase()),r=c.split("-"));if(m.isBuild){s.push(b);l(f,"root",s,n,t);for(v=0;v<r.length;v++)m=r[v],u+=(u?"-":"")+m,l(f,u,s,n,t);f(s,function(){d()})}else f([b],function(a){var b=[],m;g("root",a,b,s,n,t);for(v=0;v<r.length;v++)m=r[v],u+=(u?"-":"")+m,g(u,a,b,s,n,t);f(s,function(){var q,
m,c;for(q=b.length-1;-1<q&&b[q];q--){c=b[q];m=a[c];if(!0===m||1===m)m=f(n+c+"/"+t);k(w,m)}d(w)})})}}})})();
define("orion/i18n",[],function(){return{load:function(g,l,k,e){e=e||{};var c=/(^.*(?:^|\/)nls(?:\/|$))([^\/]*)\/?([^\/]*)/,h=c.exec(g);if(h){if(!l.defined||l.defined(g))try{k(l(g));return}catch(b){}if(e.isBuild||e.isTest)k({});else if(l.specified&&!l.specified("orion/bootstrap"))k({});else{var f=h[1],d=h[3]?h[2]:"",m=h[3]||h[2];l(["orion/bootstrap"],function(a){a.startup().then(function(a){var b=a.serviceRegistry;a=b.getServiceReferences("orion.i18n.message");if(d)a.some(function(a){return g===a.getProperty("name")?
(b.getService(a).getMessageBundle().then(function(a){k(a)},function(){k({})}),!0):!1})||k({});else{var t={},r;a.forEach(function(a){var b=a.getProperty("name");if((h=c.exec(b))&&f===h[1]&&m===(h[3]||h[2]))if(d=h[3]?h[2]:""){if((a=e.locale||("undefined"!==typeof navigator?navigator.language||navigator.userLanguage:null))&&0===a.toLowerCase().indexOf(d.toLowerCase()))t[d]=!0,(!l.specified||!l.specified(b))&&define(b,["orion/i18n!"+b],function(a){return a})}else r=a});!l.specified||!l.specified(g)?r?
b.getService(r).getMessageBundle().then(function(a){Object.keys(t).forEach(function(d){"undefined"===typeof a[d]&&(a[d]=t[d])});define(g,[],a);k(a)},function(){define(g,[],t);k(t)}):(define(g,[],t),k(t)):k(t)}})})}}else k(null)}}});
define("git/nls/root/gitmessages",{Compare:"Compare","View the side-by-side compare":"View the side-by-side compare","Working Directory Version":"Working Directory Version","Working Directory":"Working Directory","View the working directory version of the file":"View the working directory version of the file","Loading...":"Loading...",Repositories:"All Git Repositories",Repo:"Repositories","0 on 1 - Git":"${0} on ${1} - Git",Git:"Git","Show in eclipse.org":"Show in eclipse.org","Show this repository at eclipse.org":"Show this repository at eclipse.org",
"Show in GitHub":"Show in GitHub","Show this repository in GitHub":"Show this repository in GitHub","Commit Details":"Commit Details","No Commits":"No Commits","commit: 0":"commit: ${0}","parent: 0":"parent: ${0}","authored by 0 (1) on 2":"authored by ${0} (${1}) on ${2}","committed by 0 (1)":"committed by ${0} (${1})","Tags:":"Tags:","No Tags":"No Tags",Diffs:"Changes",More:"More","Loading git log...":"Loading git log...",local:"local",remote:"remote","Git Log for ${0} branch ${1} on ":"Git Log for ${0} branch ${1} on ",
"Git Log for ${0} branch ${1}":"Git Log for ${0} branch ${1}","Log for branch ${0} - Git":"Log for branch ${0} - Git","Log for ${0} on ${1} - Git":"Log for ${0} on ${1} - Git","View All":"View All","Error ${0}: ":"Error ${0}: ","Loading ":"Loading ",Message:"Message",Author:"Author",Date:"Date",Actions:"Actions",Branches:"Branches",Tags:"Tags",Stage:"Stage","Unstaged removal":"Unstaged removal",Unstage:"Unstage","Staged removal":"Staged removal","Unstaged change":"Unstaged change","Staged change":"Staged change",
"Unstaged add":"Unstaged add","Staged add":"Staged add",Addition:"Addition",Deletion:"Deletion","Resolve Conflict":"Resolve Conflict",Conflicting:"Conflicting","Commit message":"Commit message","Record changes in the active branch":"Record changes in the active branch",Commit:"Commit","Amend last commit":"Amend last commit"," Amend":" Amend","Rebase in progress. Choose action:":"Rebase in progress. Choose action:","Committer name:":"Committer name:","email:":"email:","Author name: ":"Author name: ",
"Select a file on the left to compare...":"Select a file on the left to compare...",Unstaged:"Unstaged",Staged:"Staged","Recent commits on":"Recent commits on","Git Status":"Git Status","Go to Git Status":"Open the Git Status page for the repository containing this file or folder.","Recent commits on ${0}":"Recent commits on ${0}","Status for ${0} - Git":"Status for ${0} - Git","Status (${0})":"Status (${0})","Getting git incoming changes...":"Getting git incoming changes...","Loading recent commits...":"Loading recent commits...",
"Show the side-by-side compare":"Show the side-by-side compare","Change Committer or Author":"Change Committer or Author","Use Default Committer and Author":"Use Default Committer and Author",Checkout:"Checkout","Checkout the file, discarding the unstaged change":"Checkout the file, discarding the unstaged change","Your changes to the file will be lost. Are you sure you want to checkout?":"Your changes to the file will be lost. Are you sure you want to checkout?","Checking out...":"Checking out...",
"Stage the change":"Stage the change","Stage the selected changes":"Stage the selected changes","Staging...":"Staging...","Checkout all the selected files, discarding all changes":"Checkout all the selected files, discarding all changes","Your changes to all the selected files will be lost. Are you sure you want to checkout?":"Your changes to all the selected files will be lost. Are you sure you want to checkout?","Save Patch":"Save Patch","Save workspace changes as a patch":"Save workspace changes as a patch",
"Unstage the change":"Unstage the change","Unstaging...":"Unstaging...",Reset:"Reset","Reset the branch, discarding all staged and unstaged changes":"Reset the branch, discarding all staged and unstaged changes","All unstaged and staged changes in the working directory and index will be discarded and cannot be recovered.":"All unstaged and staged changes in the working directory and index will be discarded and cannot be recovered.","Are you sure you want to continue?":"Are you sure you want to continue?",
"Resetting local changes...":"Resetting local changes...","Continue rebase...":"Continue rebase...","Skipping patch...":"Skipping patch...","Aborting rebase...":"Aborting rebase...","Complete log":"Complete log","local VS index":"local VS index","index VS HEAD":"index VS HEAD","Compare(${0} : ${1})":"Compare(${0} : ${1})","Loading status...":"Loading status...","Committing...":"Committing...","The committer name is required.":"The committer name is required.","The committer mail is required.":"The committer mail is required.",
"The author name is required.":"The author name is required.","The author mail is required.":"The author mail is required.",". Repository still contains conflicts.":". Repository still contains conflicts.",". Repository contains unmerged paths. Resolve conflicts first.":". Repository contains unmerged paths. Resolve conflicts first.","Rendering ${0}":"Rendering ${0}",Configuration:"Configuration"," - Git":" - Git","Repositories - Git":"Repositories - Git",Repository:"Repository","Repository Not Found":"Repository Not Found",
"No Repositories":"No Repositories","Loading repository":"Loading repository","Loading repositories":"Loading repositories","(no remote)":"(no remote)","location: ":"location: ","${0} file(s) to stage and ${1} file(s) to commit.":"${0} file(s) to stage and ${1} file(s) to commit.","Nothing to commit.":"Nothing to commit.","Nothing to push.":"Nothing to push."," commit(s) to push.":" commit(s) to push.","You have no changes to commit.":"You have no changes to commit.","You have changes to commit in your workspace!":"You have changes to commit in your workspace!",
"Rebase in progress!":"Rebase in progress!","View all local and remote tracking branches":"View all local and remote tracking branches","tracks no branch, ":"tracks no branch, ","tracks ${0}, ":"tracks ${0}, ","last modified ${0} by ${1}":"last modified ${0} by ${1}","No Remote Branches":"No Remote Branches","Rendering branches":"Rendering branches",Commits:"Commits","Getting current branch":"Getting current branch","See Full Log":"See Full Log","See the full log":"See the full log",'Getting commits for "${0}" branch':'Getting commits for "${0}" branch',
"Rendering commits":"Rendering commits","Getting outgoing commits":"Getting outgoing commits","The branch is up to date.":"The branch is up to date.","You have no outgoing or incoming commits.":"You have no outgoing or incoming commits.",") by ":") by "," (SHA ":" (SHA ","Getting tags":"Getting tags","View all tags":"View all tags"," on ":" on "," by ":" by ",Remotes:"Remotes","Rendering remotes":"Rendering remotes","No Remotes":"No Remotes","Getting confituration":"Getting confituration","View all configuration entries":"View all configuration entries",
"Unstaged addition":"Unstaged addition","Staged addition":"Staged addition"," (Rebase in Progress)":" (Rebase in Progress)",Status:"Status","Log (0)":"Log (${0})","Log (0) - 1":"Log (${0}) - ${1}","Status for ${0} - Git ":"Status for ${0} - Git ","No Unstaged Changes":"No Unstaged Changes","No Staged Changes":"No Staged Changes",'Commits for "${0}" branch':'Commits for "${0}" branch',"Add Remote":"Add Remote","Remote Name:":"Remote Name:","Remote URI:":"Remote URI:","Apply Patch":"Apply Patch","Git Repository":"Git Repository",
"Go to the git repository":"Open the Git Repository page for this file or folder.","Clone Git Repository":"Clone Git Repository","Repository URL:":"Repository URL:","Existing directory:":"Existing directory:","New folder:":"New folder:","Choose a Folder":"Choose a Folder","Commit Changes":"Commit Changes","Message:":"Message:","Amend:":"Amend:","ChangeId:":"ChangeId:","Committer Name:":"Committer Name:","Committer Email:":"Committer Email:","Author Name:":"Author Name:","Author Email:":"Author Email:",
"The commit message is required.":"The commit message is required.","Git Credentials":"Git Credentials","Username:":"Username:","Private key:":"Private key:","Passphrase (optional):":"Passphrase (optional):","commit:":"commit: ","parent:":"parent: ","branches: ":"branches: ","tags: ":"tags: "," authored by ${0} {${1}) on ${2}":" authored by ${0} (${1}) on ${2}",Content:"Content","Go to ${0} section":"Go to ${0} section","Find Commit":"Find Commit","Type the commit name (sha1):":"Type the commit name (sha1):",
Search:"Search","Searching...":"Searching...","Looking for the commit":"Looking for the commit","New Branch:":"New Branch:","No remote selected":"No remote selected","Enter a name...":"Enter a name...",OK:"OK"," [New branch]":" [New branch]","Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}.":"Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}.","Link Repository":"Link Repository","Folder name:":"Folder name:","Repository was linked to ":"Repository was linked to ",
"Checkout the current tag, creating a local branch based on its contents.":"Checkout the current tag, creating a local branch based on its contents.","Checking out tag ${0}":"Checking out tag ${0}","Checkout the branch or corresponding local branch and make it active. If the remote tracking branch does not have a corresponding local branch, the local branch will be created first.":"Checkout the branch or corresponding local branch and make it active. If the remote tracking branch does not have a corresponding local branch, the local branch will be created first.",
"Checking out branch...":"Checking out branch...","Checking out branch ${0}...":"Checking out branch ${0}...","Branch checked out.":"Branch checked out.","New Branch":"New Branch","Add a new local branch to the repository":"Add a new local branch to the repository","Branch name":"Branch name",Delete:"Delete","Delete the local branch from the repository":"Delete the local branch from the repository","Are you sure you want to delete branch ${0}?":"Are you sure you want to delete branch ${0}?","Delete the remote tracking branch from the repository":"Delete the remote tracking branch from the repository",
"Are you sure?":"Are you sure?","You're going to delete remote branch ${0} and push the change.":"You're going to delete remote branch ${0} and push the change.","Removing remote branch: ":"Removing remote branch: ","Delete Remote Branch":"Delete Remote Branch","New Remote":"New Remote","Git Remote":"Git Remote","Go to Git Remote":"Open the remote Git Log page for this file or folder.","Add a new remote to the repository":"Add a new remote to the repository","Delete the remote from the repository":"Delete the remote from the repository",
"Are you sure you want to delete remote ${0}?":"Are you sure you want to delete remote ${0}?",Pull:"Pull","Pull from the repository":"Pull from the repository","Pulling: ":"Pulling: ","Pull Git Repository":"Pull Git Repository","Git Log":"Git Log","Go to Git Log":"Open the local Git Log page for this file or folder.","Open the log for the branch":"Open the log for the branch","Open the log for the repository":"Open the log for the repository","Open the status for the repository":"Open the status for the repository",
ShowInEditor:"Show in Editor",ShowInEditorTooltip:"Show the repository folder in the editor","Compare With Each Other":"Compare With Each Other","Compare With Working Tree":"Compare With Working Tree",Open:"Open",Fetch:"Fetch","Fetch from the remote":"Fetch from the remote","Password:":"Password:","User Name:":"User Name:","Fetching remote: ":"Fetching remote: ","Force Fetch":"Force Fetch","Fetch from the remote branch into your remote tracking branch overriding its current content":"Fetch from the remote branch into your remote tracking branch overriding its current content",
"You're going to override content of the remote tracking branch. This can cause the branch to lose commits.":"You're going to override content of the remote tracking branch. This can cause the branch to lose commits.",Merge:"Merge","Merge the content from the branch to your active branch":"Merge the content from the branch to your active branch",". Go to ${0}.":". Go to ${0}.","Git Status page":"Git Status page",Rebase:"Rebase","Rebase your commits by removing them from the active branch, starting the active branch again based on the latest state of the selected branch ":"Rebase your commits by removing them from the active branch, starting the active branch again based on the latest state of the selected branch ",
"Rebase on top of ":"Rebase on top of ",". Some conflicts occurred. Please resolve them and continue, skip patch or abort rebasing":". Some conflicts occurred. Please resolve them and continue, skip patch or abort rebasing",". Repository state is invalid (i.e. already during rebasing)":". Repository state is invalid (i.e. already during rebasing)",". Repository contains unmerged paths":". Repository contains unmerged paths",". Repository contains pending changes. Please commit or stash them":". Repository contains pending changes. Please commit or stash them",
"Rebase your commits by removing them from the active branch, ":"Rebase your commits by removing them from the active branch, ","starting the active branch again based on the latest state of '":"starting the active branch again based on the latest state of '","and applying each commit again to the updated active branch.":"and applying each commit again to the updated active branch.","Push All":"Push All","Push commits and tags from your local branch into the remote branch":"Push commits and tags from your local branch into the remote branch",
"Push Branch":"Push Branch","Push commits without tags from your local branch into the remote branch":"Push commits without tags from your local branch into the remote branch","Push for Review":"Push for Review","Push commits to Gerrit Code Review":"Push commits to Gerrit Code Review","Force Push Branch":"Force Push Branch","Push commits without tags from your local branch into the remote branch overriding its current content":"Push commits without tags from your local branch into the remote branch overriding its current content",
"Pushing remote: ":"Pushing remote: ","Choose Branch":"Choose Branch","Force Push All":"Force Push All","Push commits and tags from your local branch into the remote branch overriding its current content":"Push commits and tags from your local branch into the remote branch overriding its current content","You're going to override content of the remote branch. This can cause the remote repository to lose commits.":"You're going to override content of the remote branch. This can cause the remote repository to lose commits.",
"\x3c Previous Page":"\x3c Previous Page","Show previous page of git log":"Show previous page of git log","Show previous page of git tags":"Show previous page of git tags","Next Page \x3e":"Next Page \x3e","Show next page of git log":"Show next page of git log","Show next page of git tags":"Show next page of git tags","Push from your local branch into the selected remote branch":"Push from your local branch into the selected remote branch","Reset your active branch to the state of the selected branch. Discard all staged and unstaged changes.":"Reset your active branch to the state of the selected branch. Discard all staged and unstaged changes.",
GitResetIndexConfirm:"The content of your active branch will be replaced with ${0}. All unstaged and staged changes will be discarded and cannot be recovered. Are you sure?","Resetting index...":"Resetting index...","Name:":"Name:",Tag:"Tag","Create a tag for the commit":"Create a tag for the commit","Tag name":"Tag name","Delete the tag from the repository":"Delete the tag from the repository","Are you sure you want to delete tag ${0}?":"Are you sure you want to delete tag ${0}?","Cherry-Pick":"Cherry-Pick",
"Apply the change introduced by the commit to your active branch":"Apply the change introduced by the commit to your active branch","Nothing changed.":"Nothing changed.",". Some conflicts occurred":". Some conflicts occurred","Fetch from the remote branch into your remote tracking branch":"Fetch from the remote branch into your remote tracking branch","Fetch Git Repository":"Fetch Git Repository",Push:"Push","Push from your local branch into the remote branch":"Push from your local branch into the remote branch",
"Push Git Repository":"Push Git Repository","Key:":"Key:","Value:":"Value:","New Configuration Entry":"New Configuration Entry",Edit:"Edit","Edit the configuration entry":"Edit the configuration entry","Delete the configuration entry":"Delete the configuration entry","Are you sure you want to delete ${0}?":"Are you sure you want to delete ${0}?","Clone Repository":"Clone Repository","Clone an existing Git repository to a folder":"Clone an existing Git repository to a folder","Cloning repository: ":"Cloning repository: ",
"Init Repository":"Init Repository","Create a new Git repository in a new folder":"Create a new Git repository in a new folder","Initializing repository: ":"Initializing repository: ","Init Git Repository":"Init Git Repository","Delete the repository":"Delete the repository","Are you sure you want do delete ${0} repositories?":"Are you sure you want do delete ${0} repositories?","Apply a patch on the selected repository":"Apply a patch on the selected repository","Show content":"Show content","Commit name:":"Commit name:",
"Open Commit":"Open Commit","Open the commit with the given name":"Open the commit with the given name","No commits found":"No commits found","Staging changes":"Staging changes","Commit message:":"Commit message:","Committing changes":"Committing changes","Fetching previous commit message":"Fetching previous commit message","Resetting local changes":"Resetting local changes","Checkout files, discarding all changes":"Checkout files, discarding all changes","Show Patch":"Show Patch","Show workspace changes as a patch":"Show workspace changes as a patch",
Continue:"Continue","Contibue Rebase":"Contibue Rebase","Skip Patch":"Skip Patch",Abort:"Abort","Abort Rebase":"Abort Rebase","Your changes to the selected files will be discarded and cannot be recovered.":"Your changes to the selected files will be discarded and cannot be recovered.","Active Branch Log":"Git Log (Active Branch)","Show the log for the active local branch":"Show the log for the active local branch","Remote Branch Log":"Git Log (Remote Branch)","Show the log for the corresponding remote tracking branch":"Show the log for the corresponding remote tracking branch",
"See Full Status":"See Full Status","See the status":"See the status","Choose target location":"Choose target location","Default target location":"Default target location","Change...":"Change...","Merge Squash":"Merge Squash","Squash the content of the branch to the index":"Squash the content of the branch to the index","Local Branch Name:":"Local Branch Name:","Filter items":"Filter items","Filter remote branches":"Filter remote branches","Paste link in email or IM":"Paste link in email or IM","Show Commit in GitHub":"Show Commit in GitHub",
"Show Repository in GitHub":"Show Repository in GitHub","Show this commit in GitHub":"Show this commit in GitHub","Show Commit in eclipse.org":"Show Commit in eclipse.org","Show this commit in eclipse.org":"Show this commit in eclipse.org","Show Repository in eclipse.org":"Show Repository in eclipse.org","Show this repository in eclipse.org":"Show this repository in eclipse.org","Ask for review":"Ask for review","Ask for review tooltip":"Send email with request for commit review","Reviewer name":"Reviewer name",
"Contribution Review Request":"Contribution Review Request","Send the link to the reviewer":"Send the link to the reviewer","Private key file (optional):":"Private key file (optional):","Don't prompt me again:":"Don't prompt me again:","Your private key will be saved in the browser for further use":"Your private key will be saved in the browser for further use","Loading Contribution Review Request...":"Loading Contribution Review Request...","The commit can be found in the following repositories":"The commit can be found in the following repositories",
"Try to update your repositories":"Try to update your repositories","Create new repository":"Create new repository","Attach the remote to one of your existing repositories":"Attach the remote to one of your existing repositories","You are reviewing contribution ${0} from ${1}":"You are reviewing contribution ${0} from ${1}","Unfortunately the commit can not be found in your workspace. To see it try one of the following: ":"Unfortunately the commit can not be found in your workspace. To see it try one of the following: ",
"To review the commit you can also:":"To review the commit you can also:","Contribution Review Request for ${0} on ${1}":"Contribution Review Request for ${0} on ${1}","Failing paths: ${0}":"Failing paths: ${0}","Problem while performing the action":"Problem while performing the action","Go to the Orion repositories page to provide a git repository URL. Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL. Once the repository is created, it will appear in the Navigator.",
"URL:":"URL:","File:":"File:",Submit:"Submit","git url:":"git url: ",Revert:"Revert","Revert changes introduced by the commit into your active branch":"Revert changes introduced by the commit into your active branch",". Could not revert into active branch":". Could not revert into active branch",Login:"Login","Authentication required for: ${0}. ${1} and re-try the request.":"Authentication required for: ${0}. ${1} and re-try the request.","Signed-off-by: ":"Signed-off-by: ","Change-Id: ":"Change-Id: "});
define("git/nls/gitmessages",["orion/i18n!git/nls/gitmessages","git/nls/root/gitmessages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
(function(){function g(){for(var c=navigator.userAgent,e={browser:!1,version:!1},b=[{name:"Chrome/Chromium",regExp:/(?:chrome|crios|chromium)\/(\d+)/i,minVersion:24},{name:"Firefox",regExp:/firefox\/(\d+)/i,minVersion:17},{name:"Microsoft Internet Explorer",regExp:/msie\s(\d+)/i,minVersion:10},{name:"Microsoft Internet Explorer",regExp:/Trident\/(\d+)/i,minVersion:6},{name:"Safari",regExp:/version\/(\d+).*?safari/i,minVersion:6}],f=0;f<b.length;f++){var d=b[f],m=c.match(d.regExp);if(m){e.browser=
!0;e.version=m[1]>=d.minVersion;e.name=d.name;break}}return e}function l(){try{return"localStorage"in window&&null!==window.localStorage}catch(c){return!1}}function k(c){alert(c);throw Error("unsupported browser");}var e=g();if(e.browser)e.version||k("Sorry, your browser version is not supported.\n\nTo use Orion, please upgrade to the latest version of "+e.name+".\n");else if(l()&&!localStorage.skipBrowserCheck)if(confirm("Sorry, your browser is not supported. The latest version of Chrome, Firefox or Safari web browser is recommended.\nContinue anyway?"))localStorage.skipBrowserCheck=
1;else throw"unsupported browser";else l()||k("Sorry, your browser is not supported.\n\nTo use Orion, the latest version of the Chrome, Firefox, or Safari web browser is recommended.\n");return{isSupportedBrowser:g,supportsLocalStorage:l,throwBrowserAlert:k}})();define("orion/browserCompatibility",function(){});
(function(g,l){"function"===typeof define&&define.amd?define("orion/Deferred",l):"object"===typeof exports?module.exports=l():(g.orion=g.orion||{},g.orion.Deferred=l())})(this,function(){function g(){for(var b;b=c.shift();)b();h=!1}function l(f){c.push(f);h||(h=!0,b())}function k(b){return function(d){b(d)}}function e(){function b(){for(var a;a=h.shift();){var d=a.deferred,f="fulfilled"===c?"resolve":"reject";a=a[f];if("function"===typeof a)try{var m=a(n),e=m&&("object"===typeof m||"function"===typeof m)&&
m.then;if("function"===typeof e)if(m===d.promise)d.reject(new TypeError);else{var g=m.cancel;"function"===typeof g?d._parentCancel=g.bind(m):delete d._parentCancel;e.call(m,k(d.resolve),k(d.reject),k(d.progress))}else d.resolve(m)}catch(r){d.reject(r)}else d[f](n)}}function d(a){delete g._parentCancel;c="rejected";n=a;h.length&&l(b)}function m(a){function k(a){return function(d){(!c||"assumed"===c)&&a(d)}}delete g._parentCancel;try{var v=a&&("object"===typeof a||"function"===typeof a)&&a.then;if("function"===
typeof v)if(a===g)d(new TypeError);else{c="assumed";var u=a&&a.cancel;if("function"!==typeof u){var y=new e;a=y.promise;try{v(y.resolve,y.reject,y.progress)}catch(x){y.reject(x)}u=a.cancel;v=a.then}n=a;v.call(a,k(m),k(d));g._parentCancel=u.bind(a)}else c="fulfilled",n=a,h.length&&l(b)}catch(z){k(d)(z)}}function a(){var a=g._parentCancel;a?(delete g._parentCancel,a()):c||(a=Error("Cancel"),a.name="Cancel",d(a))}var n,c,h=[],g=this;this.resolve=function(a){c||m(a);return g};this.reject=function(a){c||
d(a);return g};this.progress=function(a){c||h.forEach(function(d){if(d.progress)try{d.progress(a)}catch(b){}});return g.promise};this.cancel=function(){g._parentCancel?setTimeout(a,0):a();return g};this.then=function(a,d,m){var n=new e;n._parentCancel=g.promise.cancel;h.push({resolve:a,reject:d,progress:m,deferred:n});("fulfilled"===c||"rejected"===c)&&l(b);return n.promise};this.promise={then:g.then,cancel:g.cancel}}var c=[],h=!1,b=function(){if("undefined"!==typeof process&&"function"===typeof process.nextTick){var b=
process.nextTick;return function(){b(g)}}if("function"===typeof MutationObserver){var d=document.createElement("div");(new MutationObserver(g)).observe(d,{attributes:!0});return function(){d.setAttribute("class","_tick")}}return function(){setTimeout(g,0)}}();e.all=function(b,d){function m(a,d){h||(p[a]=d,0===--c&&g.resolve(p))}function a(a,b){if(!h){if(d)try{m(a,d(b));return}catch(f){b=f}g.reject(b)}}var c=b.length,p=[],h=!1,g=new e;g.then(void 0,function(){h=!0;b.forEach(function(a){a.cancel&&a.cancel()})});
0===c?g.resolve(p):b.forEach(function(d,b){d.then(m.bind(void 0,b),a.bind(void 0,b))});return g.promise};e.when=function(b,d,m,a){var c;b&&"function"===typeof b.then||(c=new e,c.resolve(b),b=c.promise);return b.then(d,m,a)};return e});
define("orion/EventTarget",[],function(){function g(){this._namedListeners={}}g.prototype={dispatchEvent:function(g){if(!g.type)throw Error("unspecified type");var k=this._namedListeners[g.type];k&&k.forEach(function(e){try{"function"===typeof e?e(g):e.handleEvent(g)}catch(c){"undefined"!==typeof console&&console.log(c)}});return!g.defaultPrevented},addEventListener:function(g,k){if("function"===typeof k||k.handleEvent)this._namedListeners[g]=this._namedListeners[g]||[],this._namedListeners[g].push(k)},
removeEventListener:function(g,k){var e=this._namedListeners[g];if(e)for(var c=0;c<e.length;c++)if(e[c]===k){1===e.length?delete this._namedListeners[g]:e.splice(c,1);break}}};g.prototype.constructor=g;g.attach=function(l){var k=new g;l.dispatchEvent=k.dispatchEvent.bind(k);l.addEventListener=k.addEventListener.bind(k);l.removeEventListener=k.removeEventListener.bind(k)};return g});
define("orion/serviceregistry",["orion/Deferred","orion/EventTarget"],function(g,l){function k(b,d,m){this._properties=m||{};this._properties["service.id"]=b;this._properties.objectClass=d;this._properties["service.names"]=d}function e(b,d,m){this._serviceId=b;this._serviceReference=d;this._internalRegistry=m}function c(b,d){function m(a){return function(){var m;try{if(!d())throw Error("Service was unregistered");var c=b[a].apply(b,Array.prototype.slice.call(arguments));if(c&&"function"===typeof c.then)return c;
m=new g;m.resolve(c)}catch(e){m=new g,m.reject(e)}return m.promise}}for(var a in b)"function"===typeof b[a]&&(this[a]=m(a))}function h(b,d){this.type=b;this.serviceReference=d}function b(){this._entries=[];this._namedReferences={};this._serviceEventTarget=new l;var b=this;this._internalRegistry={isRegistered:function(d){return b._entries[d]?!0:!1},unregisterService:function(d){var m=b._entries[d];if(!m)throw Error("Service has already been unregistered: "+d);var a=m.reference;b._serviceEventTarget.dispatchEvent(new h("unregistering",
a));b._entries[d]=null;a.getProperty("objectClass").forEach(function(d){for(var m=b._namedReferences[d],c=0;c<m.length;c++)if(m[c]===a){1===m.length?delete b._namedReferences[d]:m.splice(c,1);break}})},modifyService:function(d){var m=b._entries[d];if(!m)throw Error("Service not found while trying to send modified event: "+d);b._serviceEventTarget.dispatchEvent(new h("modified",m.reference))}}}k.prototype={getPropertyKeys:function(){var b=[],d;for(d in this._properties)this._properties.hasOwnProperty(d)&&
b.push(d);return b},getProperty:function(b){return this._properties[b]}};k.prototype.constructor=k;e.prototype={unregister:function(){this._internalRegistry.unregisterService(this._serviceId)},getReference:function(){if(!this._internalRegistry.isRegistered(this._serviceId))throw Error("Service has already been unregistered: "+this._serviceId);return this._serviceReference},setProperties:function(b){var d=this._serviceReference._properties;this._serviceReference._properties=b||{};b["service.id"]=this._serviceId;
b.objectClass=d.objectClass;b["service.names"]=d["service.names"];this._internalRegistry.modifyService(this._serviceId)}};e.prototype.constructor=e;b.prototype={getService:function(b){var d;if("string"===typeof b)(b=this._namedReferences[b])&&b.some(function(b){d=this._entries[b.getProperty("service.id")].service;return!!d},this);else if(b=this._entries[b.getProperty("service.id")])d=b.service;return d||null},getServiceReferences:function(b){if(b)return this._namedReferences[b]?this._namedReferences[b]:
[];var d=[];this._entries.forEach(function(b){b&&d.push(b.reference)});return d},registerService:function(b,d,m){if("undefined"===typeof d||null===d)throw Error("invalid service");"string"===typeof b?b=[b]:Array.isArray(b)||(b=[]);var a=this._entries.length,n=new k(a,b,m),p=this._namedReferences;b.forEach(function(a){p[a]=p[a]||[];p[a].push(n)});b=new c(d,this._internalRegistry.isRegistered.bind(null,a));this._entries.push({reference:n,service:b});b=this._internalRegistry;this._serviceEventTarget.dispatchEvent(new h("registered",
n));return new e(a,n,b)},addEventListener:function(b,d){this._serviceEventTarget.addEventListener(b,d)},removeEventListener:function(b,d){this._serviceEventTarget.removeEventListener(b,d)}};b.prototype.constructor=b;return{ServiceRegistry:b}});
define("orion/xhr",["orion/Deferred"],function(g){function l(g,e,c,h){var b="undefined"!==typeof c.response?c.response:c.responseText,f;try{f=c.status}catch(d){f=0}g={args:e,response:b,responseText:"string"===typeof b?b:null,status:f,url:g,xhr:c};"undefined"!==typeof h&&(g.error=h);return g}return function(k,e,c){c=c||{};var h=3<arguments.length&&arguments[3]?arguments[3]:new XMLHttpRequest,b=new g,f=c.headers||{},d=c.log||!1,m;"undefined"===typeof f["X-Requested-With"]&&(f["X-Requested-With"]="XMLHttpRequest");
if("undefined"!==typeof c.data&&("POST"===k||"PUT"===k))m=c.data;var a=!1,n=!1;b.promise.then(void 0,function(d){a=!0;!n&&d instanceof Error&&"Cancel"===d.name&&h.abort()});h.onabort=function(){n=!0;if(!a){var d=Error("Cancel");d.name="Cancel";b.reject(d)}};h.onload=function(){var a=l(e,c,h);200<=h.status&&400>h.status?b.resolve(a):(b.reject(a),d&&"undefined"!==typeof console&&console.log(Error(h.statusText)))};h.onerror=function(){var a=l(e,c,h);b.reject(a);d&&"undefined"!==typeof console&&console.log(Error(h.statusText))};
h.onprogress=function(a){a.xhr=h;b.progress(a)};try{h.open(k,e,!0);"string"===typeof c.responseType&&(h.responseType=c.responseType);if("number"===typeof c.timeout)if("number"===typeof h.timeout)h.timeout=c.timeout,h.addEventListener("timeout",function(a){b.reject(l(e,c,h,"Timeout exceeded"))});else{var p=setTimeout(function(){b.reject(l(e,c,h,"Timeout exceeded"))},c.timeout);b.promise.then(clearTimeout.bind(null,p),clearTimeout.bind(null,p))}Object.keys(f).forEach(function(a){h.setRequestHeader(a,
f[a])});h.send(m||null)}catch(t){b.reject(l(e,c,h,t))}return b.promise}});
define("orion/preferences",["require","orion/Deferred","orion/xhr"],function(g,l,k){function e(d,a){this._name=d;this._providers=a;this._flushPending=!1;this._cached=null;this._stores=[];this._pendingDeletes=[];this._dirty=[]}function c(d,a){return{get:function(b,f){if(0===a)return null;var c=localStorage.getItem(d+b);if(null===c)return null;c=JSON.parse(c);return f||-1===a||c._expires&&c._expires>(new Date).getTime()?(delete c._expires,c):null},set:function(b,f){if(0!==a)if(-1!==a&&(f._expires=(new Date).getTime()+
1E3*a),0===Object.keys(f).length)localStorage.removeItem(d+b);else{var c=JSON.stringify(f);localStorage.setItem(d+b,c);delete f._expires}},remove:function(a){localStorage.removeItem(d+a)}}}function h(d){this._currentPromises={};this._cache=new c("/orion/preferences/user",3600);this._service=null;this.available=function(){if(!this._service){var a=d.getServiceReferences("orion.core.preference.provider");0<a.length&&(this._service=d.getService(a[0]))}return!!this._service}}function b(d){this._location=
d;this._currentPromise=null;this._cache=new c("/orion/preferences/default",3600)}function f(){this._cache=new c("/orion/preferences/local",-1)}function d(d,a){this._userProvider=new h(d);this._localProvider=new f;a=a||"defaults.pref";-1===a.indexOf("://")&&(a=g.toUrl(a));this._defaultsProvider=new b(a);this._serviceRegistration=d.registerService("orion.core.preference",this)}e.prototype={_flush:function(){for(var d=[],a=0;a<this._stores.length;++a){var b=this._stores[a];-1!==this._dirty.indexOf(b)&&
d.push(this._providers[a].put(this._name,b));if(this._pendingDeletes[a]&&0<this._pendingDeletes[a].length){for(b=0;b<this._pendingDeletes[a].length;b++)d.push(this._providers[a].remove(this._name,this._pendingDeletes[a][b]));delete this._pendingDeletes[a]}}this._dirty=[];return l.all(d)},_scheduleFlush:function(d){d&&-1===this._dirty.indexOf(d)&&this._dirty.push(d);this._flushPending||(this._flushPending=!0,window.setTimeout(function(){this._flushPending&&(this._flushPending=!1,this._flush())}.bind(this),
0))},_getCached:function(){if(!this._cached){this._cached={};for(var d=0;d<this._stores.length;++d){var a=this._stores[d],b;for(b in a)a.hasOwnProperty(b)&&"undefined"===typeof this._cached[b]&&(this._cached[b]=a[b])}}return this._cached},keys:function(){return Object.keys(this._getCached())},get:function(d){return this._getCached()[d]},put:function(d,a){if(0!==this._stores.length){var b=this._stores[0];b[d]!==a&&(b[d]=a,this._cached=null,this._scheduleFlush(b))}},remove:function(d){for(var a=0;a<
this._stores.length;++a){var b=this._stores[a];if(b.hasOwnProperty(d))return delete b[d],this._pendingDeletes[a]||(this._pendingDeletes[a]=[]),this._pendingDeletes[a].push(d),this._cached=null,this._scheduleFlush(),!0}return!1},clear:function(){for(var d=0;d<this._stores.length;++d)this._stores[d]={},this._scheduleFlush(this._stores[d]);this._cached=null},sync:function(d){if(this._flushPending)return this._flushPending=!1,this._flush();for(var a=this,b=[],f=0;f<this._providers.length;++f)b.push(this._providers[f].get(this._name,
d).then(function(d){return function(b){a._stores[d]=b}}(f)));return l.all(b).then(function(){a._cached=null;a._getCached()})},flush:function(){this._flush()}};h.prototype={get:function(d,a){if(this._currentPromises[d])return this._currentPromises[d];var b=new l,f=null;a?this._cache.remove(d):f=this._cache.get(d);if(null!==f)b.resolve(f);else{this._currentPromises[d]=b;var c=this;this._service.get(d).then(function(a){c._cache.set(d,a);delete c._currentPromises[d];b.resolve(a)},function(a){404===a.status?
(a={},c._cache.set(d,a),delete c._currentPromises[d],b.resolve(a)):(delete c._currentPromises[d],b.resolve(c._cache.get(d,!0)||{}))})}return b},put:function(d,a){this._cache.set(d,a);return this._service.put(d,a)},remove:function(d,a){var b=this._cache.get(d);delete b[a];this._cache.set(d,b);return this._service.remove(d,a)}};b.prototype={get:function(d,a){if(this._currentPromise)return this._currentPromise;var b=new l,f=null;a?this._cache.remove(d):f=this._cache.get(d);if(null!==f)b.resolve(f);else{this._currentPromise=
b;var c=this;k("GET",this._location,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(a){a=JSON.parse(a.response);c._cache.set(d,a[d]||{});c._currentPromise=null;b.resolve(a[d]||{})},function(a){401===a.xhr.status||404===a.xhr.status?(c._cache.set(d,{}),c._currentPromise=null,b.resolve({})):(c._currentPromise=null,a=c._cache.get(d,!0),null!==a?b.resolve(a[d]||{}):b.resolve({}))})}return b},put:function(d,a){var b=new l;b.resolve();return b},remove:function(d,a){var b=this._cache.get(d);
delete b[a];this.put(d,b)}};f.prototype={get:function(d){var a=new l;d=this._cache.get(d);null!==d?a.resolve(d):a.resolve({});return a},put:function(d,a){var b=new l;this._cache.set(d,a);b.resolve();return b},remove:function(d,a){var b=this._cache.get(d);delete b[a];this.put(d,b)}};d.DEFAULT_SCOPE=1;d.LOCAL_SCOPE=2;d.USER_SCOPE=4;d.prototype={listenForChangedSettings:function(b,a,f){if(!a||"number"!==typeof a||7<a||1>a)f=a,a=d.DEFAULT_SCOPE|d.LOCAL_SCOPE|d.USER_SCOPE;window.addEventListener("storage",
f,!1);return 0!==(d.USER_SCOPE&a)?"/orion/preferences/user"+b:0!==(d.LOCAL_SCOPE&a)?"/orion/preferences/local"+b:"/orion/preferences/default"+b},getPreferences:function(b,a){if(!a||"number"!==typeof a||7<a||1>a)a=d.DEFAULT_SCOPE|d.LOCAL_SCOPE|d.USER_SCOPE;var f=[];d.USER_SCOPE&a&&this._userProvider.available()&&f.push(this._userProvider);d.LOCAL_SCOPE&a&&f.push(this._localProvider);d.DEFAULT_SCOPE&a&&f.push(this._defaultsProvider);var c=new e(b,f);return c.sync().then(function(){return c})},getSetting:function(d,
a,b){for(var f,c=0;c<d.length;c++)if(d[c].label===a)for(var e=0;e<d[c].data.length;e++)if(d[c].data[e].label===b){f=d[c].data[e].value;break}return f}};return{PreferencesService:d}});
(function(){function g(a){if("string"!==typeof a)throw new TypeError;}function l(a){return a?a.split("\x26"):[]}function k(a){return 0===a.length?"":a.join("\x26")}function e(a){var d=/([^=]*)(?:=?)(.*)/.exec(a);a=d[1]?decodeURIComponent(d[1]):"";d=d[2]?decodeURIComponent(d[2]):"";return[a,d]}function c(a){var d=encodeURIComponent(a[0]);a[1]&&(d+="\x3d"+encodeURIComponent(a[1]));return d}function h(a,d){var b="",q=[],f=0;return{next:function(){b!==a.query&&(b=a.query,q=l(b));if(f<q.length){var m=
e(q[f++]);switch(d){case "keys":return m[0];case "values":return m[1];case "keys+values":return[m[0],m[1]];default:throw new TypeError;}}throw B;}}}function b(a){Object.defineProperty(this,"_url",{get:function(){return a._url}})}function f(a){return a?/[1-9]\d*$/.exec(a)[0]:""}function d(a){var d=[];a.split("/").forEach(function(a){".."===a?d.pop():"."!==a&&d.push(a)});return d.join("/")}function m(a){return a.replace(/\s/g,function(a){return"%"+a.charCodeAt(0).toString(16)})}function a(a,b){if("string"!==
typeof a)throw new TypeError;a=m(a);var q=r.exec(a);if(!q)return null;var c={};c.scheme=q[1]||"";if(c.scheme&&!w.test(c.scheme))return null;var B=q[2];if(B&&(B=s.exec(B),c.userinfo=B[1],c.host=B[2],c.port=B[3],c.port&&!v.test(c.port)))return null;c.path=q[3];c.query=q[4];c.fragment=q[5];!c.scheme&&b&&(c.scheme=b.scheme,!c.host&&b.host&&(c.userinfo=b.userinfo,c.host=b.host,c.port=b.port,c.pathRelative=!0));c.pathRelative&&(c.path?"/"!==c.path[0]&&(q=/^(.*\/)[^\/]*$/.exec(b.path)[1]||"/",c.path=q+c.path):
c.path=b.path);c.scheme&&(c.scheme=c.scheme.toLowerCase());c.port&&(c.port=f(c.port));c.host&&c.path&&(c.path=d(c.path));return c}function n(d,q){var f;if(q){q=q.href||q;f=a(q);if(!f||!f.scheme)throw new SyntaxError;Object.defineProperty(this,"_baseURL",{value:f})}f=a(d,f);if(!f)throw new SyntaxError;Object.defineProperty(this,"_input",{value:d,writable:!0});Object.defineProperty(this,"_url",{value:f,writable:!0});var c=new b(this);Object.defineProperty(this,"query",{get:function(){return this._url?
c:null},enumerable:!0})}try{var p;if("function"===typeof window.URL&&0!==window.URL.length&&"http:"===(p=new window.URL("http://www.w3.org?q")).protocol&&p.query)return}catch(t){}var r=/^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/,s=/^(?:(.*)@)?(\[[^\]]*\]|[^:]*)(?::(.*))?$/,w=/^([a-zA-Z](?:[a-zA-Z0-9+-.])*)$/,v=/^\d*$/,u=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)$/,y=/^(\[[^\]\/?#\s]*\]|[^:\/?#\s]*)(?::(\d*))?$/,x=/^([^?#\s]*)$/,z=/^([^\s]*)$/,q=/^\S*$/,A=/([^:]*):?(.*)/,B="undefined"!==
typeof StopIteration?StopIteration:Error("Stop Iteration"),C={"ftp:":"21","gopher:":"70","http:":"80","https:":"443","ws:":"80","wss:":"443"};Object.defineProperties(b.prototype,{get:{value:function(a){g(a);var d;l(this._url.query).some(function(b){b=e(b);if(b[0]===a)return d=b[1],!0});return d},enumerable:!0},set:{value:function(a,d){g(a);g(d);var b=l(this._url.query);b.some(function(q,f){var m=e(q);if(m[0]===a)return m[1]=d,b[f]=c(m),!0})||b.push(c([a,d]));this._url.query=k(b)},enumerable:!0},has:{value:function(a){g(a);
return l(this._url.query).some(function(d){if(e(d)[0]===a)return!0})},enumerable:!0},"delete":{value:function(a){g(a);var d=l(this._url.query),b=d.filter(function(d){return e(d)[0]!==a});return b.length!==d.length?(this._url.query=k(b),!0):!1},enumerable:!0},clear:{value:function(){this._url.query=""},enumerable:!0},forEach:{value:function(a,d){if("function"!==typeof a)throw new TypeError;var b=h(this._url,"keys+values");try{for(;;){var q=b.next();a.call(d,q[1],q[0],this)}}catch(f){if(f!==B)throw f;
}},enumerable:!0},keys:{value:function(){return h(this._url,"keys")},enumerable:!0},values:{value:function(){return h(this._url,"values")},enumerable:!0},items:{value:function(){return h(this._url,"keys+values")}},size:{get:function(){return l(this._url.query).length},enumerable:!0},getAll:{value:function(a){g(a);var d=[];l(this._url.query).forEach(function(b){b=e(b);b[0]===a&&d.push(b[1])});return d},enumerable:!0},append:{value:function(a,d){g(a);g(d);var b=l(this._url.query);b.push(c([a,d]));this._url.query=
k(b)},enumerable:!0}});Object.defineProperties(n.prototype,{href:{get:function(){var a;if(this._url){a=this._url;var d=a.scheme?a.scheme+":":"";a.host&&(d+="//",a.userinfo&&(d+=a.userinfo+"@"),d+=a.host,a.port&&(d+=":"+a.port));d+=a.path;a.query&&(d+="?"+a.query);a.fragment&&(d+="#"+a.fragment);a=d}else a=this._input;return a},set:function(d){g(d);this._input=d;this._url=a(this._input,this._baseURL)},enumerable:!0},origin:{get:function(){return this._url&&this._url.host?this.protocol+"//"+this.host:
""},enumerable:!0},protocol:{get:function(){return this._url?this._url.scheme+":":":"},set:function(a){g(a);if(this._url&&(a=":"===a.slice(-1)?a.substring(0,a.length-1):a,""===a||w.test(a)))this._url.scheme=a.toLowerCase()},enumerable:!0},_userinfo:{get:function(){return this._url?this._url.userinfo:""},set:function(a){g(a);this._url&&(this._url.userinfo=a)}},username:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[1]||"")},set:function(a){g(a);if(this._url){var d=
A.exec(this._userinfo);a=[encodeURIComponent(a||"")];d[2]&&a.push(d[2]);this._userinfo=a.join(":")}},enumerable:!0},password:{get:function(){if(!this._url)return"";var a=A.exec(this._userinfo);return decodeURIComponent(a[2]||"")},set:function(a){g(a);if(this._url){var d=[A.exec(this._userinfo)[1]||""];a&&d.push(encodeURIComponent(a));this._userinfo=d.join(":")}},enumerable:!0},host:{get:function(){var a="";this._url&&this._url.host&&(a+=this._url.host,this._url.port&&(a+=":"+this._url.port));return a},
set:function(a){g(a);if(this._url&&(a=y.exec(a)))this._url.host=a[1],this._url.port=f(a[2])},enumerable:!0},hostname:{get:function(){return this._url?this._url.host:""},set:function(a){g(a);this._url&&u.exec(a)&&(this._url.host=a)},enumerable:!0},port:{get:function(){var a=this._url?this._url.port||"":"";a&&a===C[this.protocol]&&(a="");return a},set:function(a){g(a);this._url&&v.exec(a)&&(this._url.port=f(a))},enumerable:!0},pathname:{get:function(){return this._url?this._url.path:""},set:function(a){g(a);
this._url&&x.exec(a)&&(this._url.host&&a&&"/"!==a[0]&&(a="/"+a),this._url.path=a?d(a):"")},enumerable:!0},search:{get:function(){return this._url&&this._url.query?"?"+this._url.query:""},set:function(a){g(a);this._url&&(a&&"?"===a[0]&&(a=a.substring(1)),z.exec(a)&&(this._url.query=a))},enumerable:!0},hash:{get:function(){return this._url&&this._url.fragment?"#"+this._url.fragment:""},set:function(a){g(a);this._url&&(a&&"#"===a[0]&&(a=a.substring(1)),q.exec(a)&&(this._url.fragment=a))},enumerable:!0}});
if((p=window.URL||window.webkitURL)&&p.createObjectURL)Object.defineProperty(n,"createObjectURL",{value:p.createObjectURL.bind(p),enumerable:!1}),Object.defineProperty(n,"revokeObjectURL",{value:p.revokeObjectURL.bind(p),enumerable:!1});window.URL=n})();define("orion/URL-shim",function(){});
define("orion/pluginregistry",["orion/Deferred","orion/EventTarget","orion/URL-shim"],function(g,l,k){function e(a,d){var b=Object.keys(a),f=Object.keys(d);if(b.length!==f.length)return!1;b.sort();f.sort();for(var c=0,m=b.length;c<m;c++){var n=b[c];if(n!==f[c])return!1;var e=a[n],n=d[n];if(e!==n&&JSON.stringify(e)!==JSON.stringify(n))return!1}return!0}function c(a){if(-1===a.indexOf("://"))try{return(new URL(a,location.href)).href}catch(d){}return a}function h(a){var d=null,b={key:function(b){return(d=
d||Object.keys(a))[b]},getItem:function(d){return a[d]},setItem:function(b,f){a[b]=f;d=null},removeItem:function(b){delete a[b];d=null},clear:function(){(d=d||Object.keys(a)).forEach(function(d){delete a[d]}.bind(this));d=null}};Object.defineProperty(b,"length",{get:function(){return(d=d||Object.keys(a)).length}});return b}function b(a,d){if(d&&d instanceof XMLHttpRequest){var b,f;try{b=d.status,f=d.statusText}catch(c){b=0,f=""}return{status:b||0,statusText:f}}return d}function f(a){var d=a?JSON.parse(JSON.stringify(a,
b)):a;a instanceof Error&&(d.__isError=!0,d.message=d.message||a.message,d.name=d.name||a.name);return d}function d(a,d){this.type=a;this.plugin=d}function m(a,d){this.__objectId=a;this.__methods=d}function a(a,b,c){function n(a){O&&c.postMessage(a,O)}function h(a){if(!O)return(new g).reject(Error("plugin not connected"));a.id=String($++);var d=new g;W[a.id]=d;d.then(null,function(d){"active"===D&&d instanceof Error&&"Cancel"===d.name&&n({requestId:a.id,method:"cancel",params:d.message?[d.message]:
[]})});var b=Object.prototype.toString;a.params.forEach(function(q,f){if("[object Object]"===b.call(q)&&!(q instanceof m)){var c,B;for(c in q)"[object Function]"===b.call(q[c])&&(B=B||[],B.push(c));if(B){var A=P++;T[A]=q;c=function(){delete T[A]};d.then(c,c);a.params[f]=new m(A,B)}}});c.postMessage(a,O);return d.promise}function k(a,d){a||0===a?n({id:a,result:null,error:d}):console.log(d)}function u(a,d,b,q){q.forEach(function(a,d){if(a&&"undefined"!==typeof a.__objectId){var b={};a.__methods.forEach(function(d){b[d]=
function(){return h({objectId:a.__objectId,method:d,params:Array.prototype.slice.call(arguments)})}});q[d]=b}});var c=void 0===typeof a?null:{id:a,result:null,error:null};try{var m=b.apply(d,q);c&&(m&&"function"===typeof m.then?(R[a]=m,m.then(function(d){delete R[a];c.result=d;n(c)},function(d){R[a]&&(delete R[a],c.error=f(d),n(c))},function(){n({responseId:a,method:"progress",params:Array.prototype.slice.call(arguments)})})):(c.result=m,n(c)))}catch(B){c&&(c.error=f(B),n(c))}}function y(a){try{if(a.method){var d=
a.method,b=a.params||[];if("serviceId"in a){var q=Z[a.serviceId];q||k(a.id,"service not found");d in q?u(a.id,q,q[d],b):k(a.id,"method not found")}else if("objectId"in a){var f=T[a.objectId];f||k(a.id,"object not found");d in f?u(a.id,f,f[d],b):k(a.id,"method not found")}else if("requestId"in a){var m=R[a.requestId];m&&"cancel"===d&&m.cancel&&m.cancel.apply(m,b)}else if("responseId"in a){var A=W[a.responseId];A&&"progress"===d&&A.progress&&A.progress.apply(A,b)}else if("plugin"===a.method){var n=
a.params[0];Q({headers:n.headers,services:n.services}).then(function(){G&&G.resolve(B)})}else if("timeout"===a.method)G&&G.reject(a.error);else throw Error("Bad method: "+a.method);}else{var e=W[String(a.id)];delete W[String(a.id)];if(a.error){var p=c.handleServiceError(B,a.error);e.reject(p)}else e.resolve(a.result)}}catch(h){console.log("Plugin._messageHandler "+h)}}function x(a){var d={};if(a.methods&&(a.methods.forEach(function(b){d[b]=function(){var d={serviceId:a.serviceId,method:b,params:Array.prototype.slice.call(arguments)};
return"active"===D?h(d):B.start({"transient":!0}).then(function(){return h(d)})}}),d.addEventListener&&d.removeEventListener)){var b=new l,q=P++;T[q]={handleEvent:b.dispatchEvent.bind(b)};var f=new m(q,["handleEvent"]),c=d.addEventListener;d.addEventListener=function(a,d){b._namedListeners[a]||c(a,f);b.addEventListener(a,d)};var A=d.removeEventListener;d.removeEventListener=function(a,d){b.removeEventListener(a,d);b._namedListeners[a]||A(a,f)}}return d}function z(d){var b=JSON.parse(JSON.stringify(d.properties));
b.__plugin__=a;d=d.names||d.type||[];Array.isArray(d)||(d=[d]);b.objectClass=d;return b}function q(a){var d=x(a),b=z(a),b=c.registerService(a.names||a.type,d,b);J[a.serviceId]={registration:b,proxy:d}}function A(){c.persist(a,{created:C,headers:I,services:N,autostart:H,lastModified:E})}var B=this;b=b||{};var C=b.created||(new Date).getTime(),I=b.headers||{},N=b.services||[],H=b.autostart,E=b.lastModified||0,D="installed",F,G,O,U,J={},$=0,P=0,R={},W={},T={},Z={},Q;this._persist=A;this._resolve=function(){D=
"resolved";c.dispatchEvent(new d("resolved",B))};this._getAutostart=function(){return H};this._getCreated=function(){return C};this.getLocation=function(){return a};this.getHeaders=function(){return JSON.parse(JSON.stringify(I))};this.getName=function(){var a=this.getHeaders();return a?a.name||"":null};this.getVersion=function(){var a=this.getHeaders();return a?a.version||"0.0.0":null};this.getLastModified=function(){return E};this.getServiceReferences=function(){var a=[];Object.keys(J).forEach(function(d){a.push(J[d].registration.getReference())});
return a};this.setParent=function(a){return U!==a?(U=a,B.stop({"transient":!0}).then(function(){if("started"===H)return B.start({"transient":!0});if("lazy"===H)return B.start({lazy:!0,"transient":!0})})):(new g).resolve()};this.getState=function(){return D};this.start=function(b){if("uninstalled"===D)return(new g).reject(Error("Plugin is uninstalled"));if(F)return F.promise.then(this.start.bind(this,b));if("active"===D)return(new g).resolve();if(!b||!b.transient){var f=b&&b.lazy?"lazy":"started";
f!==H&&(H=f,A())}f=c.getState();if("starting"!==f&&"active"!==f)return b.transient?(new g).reject(Error("start transient error")):(new g).resolve();if("installed"===D)try{this._resolve()}catch(m){return(new g).reject(m)}"resolved"===D&&N.forEach(function(a){q(a)});if(b&&b.lazy)return"starting"!==D&&(D="starting",c.dispatchEvent(new d("lazy activation",B))),(new g).resolve();var n=new g;F=n;D="starting";c.dispatchEvent(new d("starting",B));G=new g;O=c.connect(a,y,U);G.then(function(){G=null;D="active";
c.dispatchEvent(new d("started",B));F=null;n.resolve()},function(){G=null;D="stopping";c.dispatchEvent(new d("stopping",B));Object.keys(J).forEach(function(a){J[a].registration.unregister();delete J[a]});c.disconnect(O);O=null;D="resolved";F=null;c.dispatchEvent(new d("stopped",B));n.reject(Error("plugin activation error"))});return n.promise};this.stop=function(a){if("uninstalled"===D)return(new g).reject(Error("Plugin is uninstalled"));if(F)return F.promise.then(this.stop.bind(this,a));if((!a||
!a.transient)&&"stopped"!==H)H="stopped",A();if("active"!==D&&"starting"!==D)return(new g).resolve();F=a=new g;D="stopping";c.dispatchEvent(new d("stopping",B));Object.keys(J).forEach(function(a){J[a].registration.unregister();delete J[a]});O&&(c.disconnect(O),O=null);D="resolved";F=null;c.dispatchEvent(new d("stopped",B));a.resolve();return a.promise};Q=function(b){if("uninstalled"===D)return(new g).reject(Error("Plugin is uninstalled"));if(!b)return 0===E&&(E=(new Date).getTime(),A()),c.loadManifest(a).then(Q);
var f=I,m=N,n=H;I=b.headers||{};N=b.services||{};H=b.autostart||H;b.lastModified?E=b.lastModified:(E=(new Date).getTime(),A());if(e(I,f)&&e(N,m)&&H===n)return(new g).resolve();if("active"===D||"starting"===D){var h=[];Object.keys(N).forEach(function(a){var d=N[a];h.push(a);var b=J[a];if(b){if(e(d.methods,Object.keys(b.proxy))){a=z(d);var f=b.registration.getReference(),c={};f.getPropertyKeys().forEach(function(a){c[a]=f.getProperty(a)});e(a,c)||b.registration.setProperties(a);return}b.registration.unregister();
delete J[a]}q(d)});Object.keys(J).forEach(function(a){-1===h.indexOf(a)&&(J[a].registration.unregister(),delete J[a])})}"active"===D&&(c.disconnect(O),G=new g,O=c.connect(a,y,U),G.then(function(){G=null},function(){G=null;D="stopping";c.dispatchEvent(new d("stopping"),B);Object.keys(J).forEach(function(a){J[a].registration.unregister();delete J[a]});c.disconnect(O);O=null;D="resolved";c.dispatchEvent(new d("stopped",B))}));return(new g).resolve()};this.update=function(a){return Q(a).then(function(){c.dispatchEvent(new d("updated",
B))})};this.uninstall=function(){if("uninstalled"===D)return(new g).reject(Error("Plugin is uninstalled"));if("active"===D||"starting"===D||"stopping"===D)return this.stop().then(this.uninstall.bind(this),this.uninstall.bind(this));c.removePlugin(this);D="uninstalled";c.dispatchEvent(new d("uninstalled",B));return(new g).resolve()}}var n=/^http[s]?/i;return{Plugin:a,PluginRegistry:function(b,f){function m(a){var d=a.source;y.some(function(b){if(d===b.target){try{var q;if("undefined"===typeof b.useStructuredClone){var f=
"string"!==typeof a.data;q=f?a.data:JSON.parse(a.data);b.useStructuredClone=f}else q=b.useStructuredClone?a.data:JSON.parse(a.data);b.handler(q)}catch(c){}return!0}})}f=f||{};var e=f.storage||localStorage;e.getItem||(e=h(e));var k="installed",v,u=[],y=[],x=new l,z={},q={registerService:b.registerService.bind(b),connect:function(a,d,b,q){function f(a){a=Error(a);a.name="timeout";d({method:"timeout",error:a})}var c={handler:d,url:a},m=setTimeout(f.bind(null,"Load timeout for: "+a),q||15E3),n=document.createElement("iframe");
n.name=a+"_"+(new Date).getTime();n.src=a;n.onload=function(){clearTimeout(m);m=setTimeout(f.bind(null,"Plugin handshake timeout for: "+a),5E3)};n.sandbox="allow-scripts allow-same-origin";n.style.width=n.style.height="100%";n.frameBorder=0;(b||v).appendChild(n);c.target=n.contentWindow;c.close=function(){clearTimeout(m);if(n){var a=n.parentNode;a&&a.removeChild(n);n=null}};y.push(c);return c},disconnect:function(a){for(var d=0;d<y.length;d++)if(a===y[d]){y.splice(d,1);try{a.close()}catch(b){}break}},
removePlugin:function(a){for(var d=0;d<u.length;d++)if(a===u[d]){u.splice(d,1);break}e.removeItem("plugin."+a.getLocation())},persist:function(a,d){e.setItem("plugin."+a,JSON.stringify(d))},postMessage:function(a,d){d.target.postMessage(d.useStructuredClone?a:JSON.stringify(a),d.url)},dispatchEvent:function(a){try{x.dispatchEvent(a)}catch(d){console&&console.log("PluginRegistry.dispatchEvent "+d)}},loadManifest:function(a){var d=new g,b=q.connect(a,function(a){b&&a.method&&("manifest"===a.method||
"plugin"===a.method?(a=a.params[0],q.disconnect(b),b=null,d.resolve(a)):"timeout"===a.method&&(q.disconnect(b),b=null,d.reject(a.error)))});return d.promise},getState:function(){return k},handleServiceError:function(a,d){if(d&&401===d.status){var b=a.getHeaders(),q=a.getName()||a.getLocation(),f=document.createElement("span");f.appendChild(document.createTextNode("Authentication required for: "+q+"."));b.login&&(f.appendChild(document.createTextNode(" ")),q=document.createElement("a"),q.target="_blank",
q.textContent="Login",q.href=b.login,n.test(q.href)?(f.appendChild(q),f.appendChild(document.createTextNode(" and re-try the request."))):console.log("Illegal Login URL: "+b.login));return{Severity:"Error",HTML:!0,Message:(new XMLSerializer).serializeToString(f)}}if(d.__isError){var c=d;d=Error(c.message);Object.keys(c).forEach(function(a){d[a]=c[a]});delete d.__isError}return d}};this.getLocation=function(){return"System"};this.getHeaders=function(){return{}};this.getName=function(){return"System"};
this.getVersion=function(){return"0.0.0"};this.getLastModified=function(){return 0};this.getState=q.getState;this.init=function(){if(!("starting"===k||"active"===k||"stopping"===k)){addEventListener("message",m,!1);for(var d=[],b=0,n=e.length;b<n;b++)d.push(e.key(b));d.forEach(function(d){if(0===d.indexOf("plugin.")){var b=d.substring(7);d=JSON.parse(e.getItem(d));d.created&&u.push(new a(b,d,q))}});u.sort(function(a,d){return a._getCreated()<d._getCreated()?-1:1});f.parent?v=f.parent:(v=document.createElement("div"),
f.visible||(v.style.display="none",v.style.visibility="hidden"),document.body.appendChild(v));f.plugins&&Object.keys(f.plugins).forEach(function(d){d=c(d);if(!this.getPlugin(d)){var b=f.plugins[d];"object"!==typeof b&&(b={});b.autostart=b.autostart||f.defaultAutostart||"lazy";u.push(new a(d,b,q))}}.bind(this));k="starting"}};this.start=function(){"starting"!==k&&this.init();if("starting"!==k)return(new g).reject("Cannot start framework. Framework is already "+k+".");var a=[],d=(new Date).getTime();
u.forEach(function(b){var q=b._getAutostart();0===b.getLastModified()?a.push(b.update().then(function(){if("started"===q)return b.start({"transient":!0});if("lazy"===q)return b.start({lazy:!0,"transient":!0});b._resolve()})):"started"===q?a.push(b.start({"transient":!0})):"lazy"===q?(a.push(b.start({lazy:!0,"transient":!0})),d>b.getLastModified()+864E5&&b.update()):b._resolve()});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){k="active"})};this.stop=function(){if("starting"!==
k&&"active"!==k)return(new g).reject("Cannot stop registry. Registry is already "+k+".");k="stopping";var a=[];u.forEach(function(d){a.push(d.stop({"transient":!0}))});return g.all(a,function(a){console.log("PluginRegistry.stop "+a)}).then(function(){if(!f.parent){var a=v.parentNode;a&&a.removeChild(v)}v=null;removeEventListener("message",m);k="resolved"})};this.update=function(){this.stop().then(this.start.bind(this))};this.uninstall=function(){return(new g).reject("Cannot uninstall registry")};
this.installPlugin=function(b,f){b=c(b);var m=this.getPlugin(b);if(m)return(new g).resolve(m);if(z[b])return z[b];if(f)return m=new a(b,f,q),u.push(m),m._persist(),q.dispatchEvent(new d("installed",m)),(new g).resolve(m);var n=q.loadManifest(b).then(function(f){m=new a(b,f,q);u.push(m);m._persist();delete z[b];q.dispatchEvent(new d("installed",m));return m},function(a){delete z[b];throw a;});return z[b]=n};this.getPlugins=function(){return u.slice()};this.getPlugin=function(a){var d=null;a=c(a);u.some(function(b){if(a===
b.getLocation())return d=b,!0});return d};this.addEventListener=x.addEventListener.bind(x);this.removeEventListener=x.removeEventListener.bind(x);this.resolvePlugins=function(){var a=!0;u.forEach(function(d){a=a&&d._resolve()});return a}}}});
define("orion/serviceTracker",[],function(){function g(e,c){function h(a){var b=a.getProperty("service.id"),c=this.addingService(a);c&&(f[b]=a,d[b]=c)}function b(a){var b=a.getProperty("service.id"),c=d[b];delete f[b];delete d[b];this.removedService(a,c)}this.serviceRegistry=e;var f={},d={},m=l,a,n;this.close=function(){if(m!==k)throw"Already closed";m=l;e.removeEventListener("registered",a);e.removeEventListener("unregistering",n);n=a=null;var d=this;this.getServiceReferences().forEach(function(a){b.call(d,
a)});if("function"===typeof this.onClose)this.onClose()};this.getServiceReferences=function(){var a=Object.keys(f);return!a.length?null:a.map(function(a){return f[a]})};this.open=function(){if(m!==l)throw"Already open";m=k;var d=this;a=function(a){if(-1!==a.serviceReference.getProperty("objectClass").indexOf(c)&&(h.call(d,a.serviceReference),"function"===typeof d.onServiceAdded))return d.onServiceAdded(a.serviceReference,d.serviceRegistry.getService(a.serviceReference))};n=function(a){-1!==a.serviceReference.getProperty("objectClass").indexOf(c)&&
b.call(d,a.serviceReference)};e.addEventListener("registered",a);e.addEventListener("unregistering",n);e.getServiceReferences(c).forEach(function(a){h.call(d,a);if("function"===typeof d.onServiceAdded)return d.onServiceAdded(a,e.getService(a))});if("function"===typeof this.onOpen)this.onOpen()}}var l=0,k=1;g.prototype={addingService:function(e){return this.serviceRegistry.getService(e)},onOpen:null,onClose:null,onServiceAdded:null,removedService:function(e,c){}};return g});
define("orion/objects",[],function(){function g(g){for(var k=1;k<arguments.length;k++){var e=arguments[k],c;for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(g[c]=e[c])}return g}return{clone:function(l){if(Array.isArray(l))return Array.prototype.slice.call(l);var k=Object.create(Object.getPrototypeOf(l));g(k,l);return k},mixin:g,toArray:function(g){return Array.isArray(g)?g:[g]}}});
define("orion/config",["orion/Deferred","orion/serviceTracker","orion/objects"],function(g,l,k){var e,c,h,b,f,d="pid";e=function(a,b,f){function c(a,d,f){d.forEach(function(c,m){try{var q=a[m].getProperty("__plugin__"),A=q&&b.getPlugin(q);(!q||A&&"active"===A.getState())&&d[m].updated(f)}catch(B){"undefined"!==typeof console&&console.log(B)}})}l.call(this,a,"orion.cm.managedservice");var m={},e={},h=function(b){var c=[];b.plugin.getServiceReferences().forEach(function(b){if(-1!==b.getProperty("objectClass").indexOf("orion.cm.managedservice")){var m=
b.getProperty(d);b=a.getService(b);m&&b&&(m=(m=f._find(m))&&m.getProperties(),c.push(b.updated(m)))}});return g.all(c)};this.addingService=function(b){var f=b.getProperty(d),c=a.getService(b);if(!f||!c)return null;m[f]||(m[f]=[]);e[f]||(e[f]=[]);m[f].push(b);e[f].push(c);return c};this.onServiceAdded=function(a,b){var m=a.getProperty(d),m=f._find(m);c([a],[b],m&&m.getProperties())};this.onOpen=function(){b.addEventListener("started",h)};this.onClose=function(){b.removeEventListener("started",h)};
this.notifyUpdated=function(a){var d=a.getPid();c(m[d]||[],e[d]||[],a.getProperties())};this.notifyDeleted=function(a){a=a.getPid();c(m[a]||[],e[a]||[],null)};this.removedService=function(a,b){var f=a.getProperty(d),c=m[f],n=e[f];1<c.length?c.splice(c.indexOf(a),1):delete m[f];1<n.length?n.splice(n.indexOf(b),1):delete e[f]}};c=function(){function a(a,d,f){this.store=new h(this,f);this.configAdmin=new b(this,this.store);this.tracker=new e(a,d,this.store)}a.prototype={getConfigurationAdmin:function(){var a=
this;return this.configAdmin._init().then(function(d){a.tracker.open();return d})},notifyDeleted:function(a){this.tracker.notifyDeleted(a)},notifyUpdated:function(a){this.tracker.notifyUpdated(a)}};return a}();b=function(){function a(a,d){this.factory=a;this.store=d}a.prototype={_init:function(){var a=this;return this.store._init().then(function(){return a})},getConfiguration:function(a){return this.store.get(a)},listConfigurations:function(){return this.store.list()}};return a}();var m="/cm/configurations";
h=function(){function a(a,b){this.factory=a;this.prefsService=b;this.configs=Object.create(null);this.pref=null;var c=this;this.initPromise=this.prefsService.getPreferences(m).then(function(a){c.pref=a;a.keys().forEach(function(b){if(!c.configs[b]){var m=a.get(b);"object"===typeof m&&null!==m&&0<Object.keys(m).length&&(m[d]=b,c.configs[b]=new f(c.factory,c,m))}})})}a.prototype={_init:function(){return this.initPromise},_find:function(a){return this.configs[a]||null},get:function(a){var d=this._find(a);
d||(d=new f(this.factory,this,a),this.configs[a]=d);return d},list:function(){var a=this,d=[];this.pref.keys().forEach(function(b){(b=a._find(b))&&null!==b.getProperties()&&d.push(b)});return d},remove:function(a){this.pref.remove(a);delete this.configs[a]},save:function(a,d){this.pref.put(a,d.getProperties(!0)||{})}};return a}();f=function(){function a(a,b){b=k.clone(b);delete b[d];a.properties=b}function b(f,c,m){this.factory=f;this.store=c;if(null!==m&&"object"===typeof m)this.pid=m[d],a(this,
m);else if("string"===typeof m)this.pid=m,this.properties=null;else throw Error("Invalid pid/properties "+m);}b.prototype={_checkRemoved:function(){if(this._removed)throw Error("Configuration was removed");},getPid:function(){this._checkRemoved();return this.pid},getProperties:function(a){this._checkRemoved();var b=null;this.properties&&(b=k.clone(this.properties),a||(b[d]=this.pid));return b},remove:function(){this._checkRemoved();this.factory.notifyDeleted(this);this.store.remove(this.pid);this._removed=
!0},update:function(d){this._checkRemoved();a(this,d);this.store.save(this.pid,this);this.factory.notifyUpdated(this)},toString:function(){return"[ConfigImpl pid: "+this.pid+", properties: "+JSON.stringify(this.properties)+"]"}};return b}();return{ConfigurationAdminFactory:c}});
define("orion/bootstrap","require orion/Deferred orion/serviceregistry orion/preferences orion/pluginregistry orion/config".split(" "),function(g,l,k,e,c,h){var b;return{startup:function(){if(b)return b;b=new l;var f=new k.ServiceRegistry,d=new e.PreferencesService(f);return d.getPreferences("/plugins").then(function(m){var a={plugins:{}};m.keys().forEach(function(d){var b=g.toUrl(d);a.plugins[b]=m[d]});var n=new c.PluginRegistry(f,a);return n.start().then(function(){if(0<f.getServiceReferences("orion.core.preference.provider").length)return d.getPreferences("/plugins",
d.USER_SCOPE).then(function(a){var d=[];a.keys().forEach(function(a){a=g.toUrl(a);n.getPlugin(a)||d.push(n.installPlugin(a,{autostart:"lazy"}).then(function(a){return a.update().then(function(){return a.start({lazy:!0})})}))});return l.all(d,function(a){console.log(a)})})}).then(function(){return(new h.ConfigurationAdminFactory(f,n,d)).getConfigurationAdmin().then(f.registerService.bind(f,"orion.cm.configadmin"))}).then(function(){var a=f.getService("orion.core.auth");if(a){var d=a.getUser().then(function(d){if(d)localStorage.setItem("lastLogin",
(new Date).getTime());else return a.getAuthForm(window.location.href).then(function(a){setTimeout(function(){window.location=a},0)})}),b=localStorage.getItem("lastLogin");if(!b||b<(new Date).getTime()-9E5)return d}}).then(function(){var a={serviceRegistry:f,preferences:d,pluginRegistry:n};b.resolve(a);return a})})}}});
define("orion/nls/root/messages",{Navigator:"Navigator",Sites:"Sites",Shell:"Shell",ShellLinkWorkspace:"Workspace Shell","Get Plugins":"Get Plugins",Global:"Global",Editor:"Editor",EditorRelatedLink:"Show Current Folder",EditorRelatedLinkParent:"Show Enclosing Folder",EditorLinkWorkspace:"Show Workspace",EditorRelatedLinkProj:"Show Project","Filter bindings":"Filter bindings","Orion Editor":"Orion Editor","Orion Image Viewer":"Orion Image Viewer","Orion Markdown Viewer":"Orion Markdown Viewer","Orion JSON Editor":"Orion JSON Editor",
"View on Site":"View on Site","View this file or folder on a web site hosted by Orion":"View this file or folder on a web site hosted by Orion.","Show a list of all the keybindings on this page":"Show a list of all the keybindings on this page","Show Keys":"Show Keys","Hide or show the page banner and footer":"Hide or show the page banner and footer","Toggle banner and footer":"Toggle banner and footer","Choose a file by name and open an editor on it":"Choose a file by name and open an editor on it",
"Find File Named...":"Find File Named...","System Configuration Details":"System Configuration Details","System Config Tooltip":"Go to the System Configuration Details page","Background Operations":"Background Operations","Background Operations Tooltip":"Go to the Background Operations page","Operation status is unknown":"Operation status is unknown","Unknown item":"Unknown item","Can't search: no search service is available":"Can't search: no search service is available","could not find banner parent, id was ":"could not find banner parent, id was ",
Related:"Related",Options:"Options",FAQ:"FAQ","Report a Bug":"Bugs","Privacy Policy":"Privacy","Terms of Use":"Terms","Copyright Agent":"Copyright","Orion Logo":"Orion Logo","Orion is in Beta. Please try it out but BEWARE your data may be lost.":"2014-04-02_22-01-33","LOG: ":"LOG: ",View:"View","no parent":"no parent","no tree model":"no tree model","no renderer":"no renderer","could not find table row ":"could not find table row ","Resource is out of sync with the server. Do you want to save it anyway?":"Resource is out of sync with the server. Do you want to save it anyway?",
Operations:"Operations","Operations running":"Operations running","Some operations finished with warning":"Some operations finished with warning","Some operations finished with error":"Some operations finished with error","no service registry":"no service registry",Tasks:"Tasks",Close:"Close","Expand all":"Expand all","Collapse all":"Collapse all",Search:"Search","Advanced search":"Advanced search",Submit:"Submit",More:"More","Saved searches":"Saved searches","Recent searches":"Recent searches","Regular expression":"Regular expression",
"Search options":"Search options","Global search":"Global search","Orion Home":"Orion Home","Close notification":"Close notification","Operations - Press spacebar to show current operations":"Operations - Press spacebar to show current operations","Type a keyword or wild card to search in root":"Type a keyword or wild card to search in root","Toggle side panel":"Toggle side panel","Open or close the side panel":"Open or close the side panel",Projects:"Projects","Toggle Sidebar":"Toggle Sidebar","Sample HTML5 Site":"Sample HTML5 Site",
"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.":"Generate an HTML5 'Hello World' website, including JavaScript, HTML, and CSS files.","Sample Orion Plugin":"Sample Orion Plugin","Generate a sample plugin for integrating with Orion.":"Generate a sample plugin for integrating with Orion.",Browser:"Web Browser",OutlineProgress:"Getting outline for ${0} from ${1}",UnknownError:"An unknown error occurred.",UnknownWarning:"An unknown warning occurred.",Filter:"Filter (* \x3d any string, ? \x3d any character)",
"To view the browser's context menu, trigger the context menu again.":"To view the browser's context menu, trigger the context menu again.",Edit:"Edit",CentralNavTooltip:"Toggle Navigation Menu"});define("orion/nls/messages",["orion/i18n!orion/nls/messages","orion/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/util",[],function(){var g=navigator.userAgent,l=-1!==g.indexOf("MSIE")||-1!==g.indexOf("Trident")?document.documentMode:void 0,k=parseFloat(g.split("Firefox/")[1]||g.split("Minefield/")[1])||void 0,e=-1!==g.indexOf("Opera")?parseFloat(g.split("Version/")[1]):void 0,c=parseFloat(g.split("Chrome/")[1])||void 0,h=-1!==g.indexOf("Safari")&&!c,b=parseFloat(g.split("WebKit/")[1])||void 0,f=-1!==g.indexOf("Android"),d=-1!==g.indexOf("iPad"),g=-1!==g.indexOf("iPhone"),m=d||g,a=-1!==navigator.platform.indexOf("Mac"),
n=-1!==navigator.platform.indexOf("Win"),p=-1!==navigator.platform.indexOf("Linux"),t="ontouchstart"in document.createElement("input");return{formatMessage:function(a){var d=arguments;return a.replace(/\$\{([^\}]+)\}/g,function(a,b){return d[(b<<0)+1]})},createElement:function(a,d){return a.createElementNS?a.createElementNS("http://www.w3.org/1999/xhtml",d):a.createElement(d)},isIE:l,isFirefox:k,isOpera:e,isChrome:c,isSafari:h,isWebkit:b,isAndroid:f,isIPad:d,isIPhone:g,isIOS:m,isMac:a,isWindows:n,
isLinux:p,isTouch:t,platformDelimiter:n?"\r\n":"\n"}});
define("orion/webui/littlelib",["orion/util"],function(g){function l(d,b){b||(b=document);return b.querySelectorAll(d)}function k(d){var b=d.tabIndex;0===b&&g.isIE&&!{a:!0,body:!0,button:!0,frame:!0,iframe:!0,img:!0,input:!0,isindex:!0,object:!0,select:!0,textarea:!0}[d.nodeName.toLowerCase()]&&!d.attributes.tabIndex&&(b=-1);return b}function e(d){if(0<=k(d))return d;if(d.hasChildNodes())for(var b=0;b<d.childNodes.length;b++){var a=e(d.childNodes[b]);if(a)return a}return null}function c(d){if(0<=
k(d))return d;if(d.hasChildNodes())for(var b=d.childNodes.length-1;0<=b;b--){var a=c(d.childNodes[b]);if(a)return a}return null}function h(d,f){if(3===d.nodeType){var a=b.exec(d.nodeValue);a&&1<a.length&&f(d,a)}if(d.hasChildNodes())for(a=0;a<d.childNodes.length;a++)h(d.childNodes[a],f)}var b=/\$\{([^\}]+)\}/,f=null;return{$:function(d,b){b||(b=document);return b.querySelector(d)},$$:l,$$array:function(d,b){return Array.prototype.slice.call(l(d,b))},node:function(d){var b=d;"string"===typeof d&&(b=
document.getElementById(d));return b},contains:function(d,b){if(!d||!b)return!1;if(d===b)return!0;var a=d.compareDocumentPosition(b);return Boolean(a&16)},bounds:function(d){d=d.getBoundingClientRect();return{left:d.left+document.documentElement.scrollLeft,top:d.top+document.documentElement.scrollTop,width:d.width,height:d.height}},empty:function(d){for(;d.hasChildNodes();)d.removeChild(d.firstChild)},firstTabbable:e,lastTabbable:c,stop:function(d){window.document.all&&(d.keyCode=0);d.preventDefault&&
(d.preventDefault(),d.stopPropagation())},processTextNodes:function(d,b){h(d,function(a,d){a.parentNode.replaceChild(document.createTextNode(b[d[1]]||d[1]),a)})},processDOMNodes:function(d,b){h(d,function(a,d){var f=b[d[1]];if(f){var c=document.createRange(),e=d.index;c.setStart(a,e);c.setEnd(a,e+d[0].length);c.deleteContents();c.insertNode(f)}})},addAutoDismiss:function(d,b){function a(a){f.forEach(function(d){var b=!1,f=d.excludeNodes.some(function(d){return document.body.contains(d)?(b=!0,d.contains(a.target)):
!1});if(b&&!f)try{d.dismiss(a)}catch(c){"undefined"!==typeof console&&console&&console.error(c&&c.message)}});f=f.filter(function(a){return a.excludeNodes.some(function(a){return document.body.contains(a)})})}null===f&&(f=[],document.addEventListener("click",a,!0),g.isIOS&&document.addEventListener("touchend",function(a){function d(){a.target.removeEventListener("click",d)}0===a.touches.length&&a.target.addEventListener("click",d)},!1));f.push({excludeNodes:d,dismiss:b})},setFramesEnabled:function(d){for(var b=
document.getElementsByTagName("iframe"),a=0;a<b.length;a++)b[a].parentNode.style.pointerEvents=d?"":"none"},removeAutoDismiss:function(d){f=f.filter(function(b){return d!==b.dismiss})},KEY:{BKSPC:8,TAB:9,ENTER:13,ESCAPE:27,SPACE:32,PAGEUP:33,PAGEDOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,INSERT:45,DEL:46}}});
define("text",["module"],function(g){var l,k,e=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],c=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,h=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,b="undefined"!==typeof location&&location.href,f=b&&location.protocol&&location.protocol.replace(/\:/,""),d=b&&location.hostname,m=b&&(location.port||void 0),a=[],n=g.config&&g.config()||{};l={version:"2.0.5",strip:function(a){if(a){a=a.replace(c,"");var d=a.match(h);d&&(a=d[1])}else a="";return a},
jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r").replace(/[\u2028]/g,"\\u2028").replace(/[\u2029]/g,"\\u2029")},createXhr:n.createXhr||function(){var a,d,b;if("undefined"!==typeof XMLHttpRequest)return new XMLHttpRequest;if("undefined"!==typeof ActiveXObject)for(d=0;3>d;d+=1){b=e[d];try{a=new ActiveXObject(b)}catch(f){}if(a){e=[b];break}}return a},parseName:function(a){var d,
b,f=!1,c=a.indexOf(".");d=0===a.indexOf("./")||0===a.indexOf("../");-1!==c&&(!d||1<c)?(d=a.substring(0,c),b=a.substring(c+1,a.length)):d=a;a=b||d;c=a.indexOf("!");-1!==c&&(f="strip"===a.substring(c+1),a=a.substring(0,c),b?b=a:d=a);return{moduleName:d,ext:b,strip:f}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,d,b,f){var c,m;c=l.xdRegExp.exec(a);if(!c)return!0;a=c[2];c=c[3];c=c.split(":");m=c[1];c=c[0];return(!a||a===d)&&(!c||c.toLowerCase()===b.toLowerCase())&&(!m&&!c||m===f)},finishLoad:function(d,
b,f,c){f=b?l.strip(f):f;n.isBuild&&(a[d]=f);c(f)},load:function(a,c,e,h){if(h.isBuild&&!h.inlineText)e();else{n.isBuild=h.isBuild;var g=l.parseName(a);h=g.moduleName+(g.ext?"."+g.ext:"");var k=c.toUrl(h),u=n.useXhr||l.useXhr;!b||u(k,f,d,m)?l.get(k,function(d){l.finishLoad(a,g.strip,d,e)},function(a){e.error&&e.error(a)}):c([h],function(a){l.finishLoad(g.moduleName+"."+g.ext,g.strip,a,e)})}},write:function(d,b,f,c){a.hasOwnProperty(b)&&(c=l.jsEscape(a[b]),f.asModule(d+"!"+b,"define(function () { return '"+
c+"';});\n"))},writeFile:function(a,d,b,f,c){d=l.parseName(d);var m=d.ext?"."+d.ext:"",n=d.moduleName+m,e=b.toUrl(d.moduleName+m)+".js";l.load(n,b,function(d){d=function(a){return f(e,a)};d.asModule=function(a,d){return f.asModule(a,e,d)};l.write(a,n,d,c)},c)}};if("node"===n.env||!n.env&&"undefined"!==typeof process&&process.versions&&process.versions.node)k=require.nodeRequire("fs"),l.get=function(a,d){var b=k.readFileSync(a,"utf8");0===b.indexOf("\ufeff")&&(b=b.substring(1));d(b)};else if("xhr"===
n.env||!n.env&&l.createXhr())l.get=function(a,d,b,f){var c=l.createXhr(),m;c.open("GET",a,!0);if(f)for(m in f)f.hasOwnProperty(m)&&c.setRequestHeader(m.toLowerCase(),f[m]);if(n.onXhr)n.onXhr(c,a);c.onreadystatechange=function(f){4===c.readyState&&(f=c.status,399<f&&600>f?(f=Error(a+" HTTP status: "+f),f.xhr=c,b(f)):d(c.responseText))};c.send(null)};else if("rhino"===n.env||!n.env&&"undefined"!==typeof Packages&&"undefined"!==typeof java)l.get=function(a,d){var b,f,c=new java.io.File(a),m=java.lang.System.getProperty("line.separator"),
c=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(c),"utf-8")),n="";try{b=new java.lang.StringBuffer;(f=c.readLine())&&f.length()&&65279===f.charAt(0)&&(f=f.substring(1));for(null!==f&&b.append(f);null!==(f=c.readLine());)b.append(m),b.append(f);n=String(b.toString())}finally{c.close()}d(n)};return l});define("text!orion/banner/slideout.html",[],function(){return'\x3cdiv id\x3d"slideContainer" class\x3d"slideParameters slideContainer"\x3e\n\t\x3cspan id\x3d"pageCommandParameters" class\x3d"layoutLeft parameters"\x3e\x3c/span\x3e\n\t\x3cspan id\x3d"pageCommandDismiss" class\x3d"layoutRight parametersDismiss"\x3e\x3c/span\x3e\n\x3c/div\x3e'});
define("orion/commonHTMLFragments",["require","orion/webui/littlelib","text!orion/banner/slideout.html"],function(g,l,k){return{slideoutHTMLFragment:function(e){var c=document.createElement("div");c.innerHTML=k;var h=l.$("#slideContainer",c);h.id=e+h.id;h=l.$("#pageCommandParameters",c);h.id=e+h.id;h=l.$("#pageCommandDismiss",c);h.id=e+h.id;return c.innerHTML}}});
define("orion/keyBinding",["orion/util"],function(g){function l(e,c,h,b,f,d){this.type=d||"keydown";this.keyCode="string"===typeof e&&"keydown"===this.type?e.toUpperCase().charCodeAt(0):e;this.mod1=void 0!==c&&null!==c?c:!1;this.mod2=void 0!==h&&null!==h?h:!1;this.mod3=void 0!==b&&null!==b?b:!1;this.mod4=void 0!==f&&null!==f?f:!1}function k(e){this.keys=e}l.prototype={getKeys:function(){return[this]},match:function(e,c){if(void 0!==c){if(0!==c)return!1}else if(e instanceof Array){if(1<e.length)return!1;
e=e[0]}return e.type!==this.type?!1:this.keyCode===e.keyCode||this.keyCode===String.fromCharCode(g.isOpera?e.which:void 0!==e.charCode?e.charCode:e.keyCode)?this.mod1!==(g.isMac?e.metaKey:e.ctrlKey)||"keydown"===this.type&&this.mod2!==e.shiftKey||this.mod3!==e.altKey||g.isMac&&this.mod4!==e.ctrlKey?!1:!0:!1},equals:function(e){return!e||this.keyCode!==e.keyCode||this.mod1!==e.mod1||this.mod2!==e.mod2||this.mod3!==e.mod3||this.mod4!==e.mod4||this.type!==e.type?!1:!0}};k.prototype={getKeys:function(){return this.keys.slice(0)},
match:function(e,c){var h=this.keys;if(void 0!==c)return c>h.length?!1:h[c].match(e)?c===h.length-1?!0:c+1:!1;e instanceof Array||(e=[e]);if(e.length>h.length)return!1;var b;for(b=0;b<e.length;b++)if(!h[b].match(e[b]))return!1;return b===h.length?!0:b},equals:function(e){if(!e.keys||e.keys.length!==this.keys.length)return!1;for(var c=0;c<e.keys.length;c++)if(!e.keys[c].equals(this.keys[c]))return!1;return!0}};return{KeyBinding:l,KeyStroke:l,KeySequence:k}});
define("orion/webui/dropdown",["require","orion/webui/littlelib","orion/EventTarget"],function(g,l,k){function e(b){k.attach(this);this._init(b)}function c(b,f){var d=document.createElement(void 0===f?"span":f);d.tabIndex=0;d.className="dropdownMenuItem";d.role="menuitem";var c=document.createElement("span");c.appendChild(document.createTextNode(b));c.classList.add("dropdownCommandName");d.appendChild(c);c=document.createElement("li");c.appendChild(d);return c}function h(){var b=document.createElement("li");
b.classList.add("dropdownSeparator");return b}e.prototype={_init:function(b){this._dropdownNode=l.node(b.dropdown);if(!this._dropdownNode)throw"no dom node for dropdown found";this._populate=b.populate;this._selectionClass=b.selectionClass;this._parentDropdown=b.parentDropdown;this._positioningNode=b.positioningNode;if(!this._parentDropdown)for(var f=this._dropdownNode.parentNode;f&&document!==f;){if(f.classList&&f.classList.contains("dropdownMenu")){this._parentDropdown=f.dropdown;break}f=f.parentNode}this._dropdownNode.tabIndex=
0;this._triggerNode=b.triggerNode?b.triggerNode:l.$(".dropdownTrigger",this._dropdownNode.parentNode);if(!this._triggerNode)throw"no dom node for dropdown trigger found";if(!b.skipTriggerEventListeners){var d=this;this._triggerNode.addEventListener("click",function(b){d.toggle(b)&&l.stop(b)},!1);"span"===this._triggerNode.tagName.toLowerCase()&&this._triggerNode.addEventListener("keydown",function(b){if(b.keyCode===l.KEY.ENTER||b.keyCode===l.KEY.SPACE)d.toggle(),l.stop(b)},!1)}this._dropdownNode.addEventListener("keydown",
this._dropdownKeyDown.bind(this),!1)},addTriggerNode:function(b){var f=this;b.addEventListener("click",function(d){f.toggle(d)&&l.stop(d)},!1)},toggle:function(b){return this.isVisible()?this.close():this.open(b)},isVisible:function(){return this._isVisible},open:function(b){var f=!1;this.isVisible()||(this.dispatchEvent({type:"triggered",dropdown:this,event:b}),l.setFramesEnabled(!1),this._populate&&(this.empty(),this._populate(this._dropdownNode)),0<this.getItems().length&&(this._hookedAutoDismiss||
(this._boundAutoDismiss?l.removeAutoDismiss(this._boundAutoDismiss):this._boundAutoDismiss=this._autoDismiss.bind(this),f=l.$$array(".dropdownSubMenu",this._dropdownNode),l.addAutoDismiss([this._triggerNode].concat(f),this._boundAutoDismiss),this._hookedAutoDismiss=!0),this._triggerNode.classList.add("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.add(this._selectionClass),this._dropdownNode.classList.add("dropdownMenuOpen"),this._isVisible=!0,this._positionDropdown(b),this._dropdownNode.focus(),
f=!0,this._parentDropdown&&this._parentDropdown.submenuOpen(this)));return f},_autoDismiss:function(b){if(this.close(!1)&&this._dropdownNode.contains(b.target))for(b=this._parentDropdown;b;)b.close(!1),b=b._parentDropdown},_positionDropdown:function(b){this._dropdownNode.style.left="";this._dropdownNode.style.top="";if(this._positioningNode)this._dropdownNode.style.left=this._positioningNode.offsetLeft+"px";else{b=l.bounds(this._dropdownNode);var f=l.bounds(document.body);if(b.left+b.width>f.left+
f.width)if(this._triggerNode.classList.contains("dropdownMenuItem"))this._dropdownNode.style.left=-b.width+"px";else{var d=l.bounds(this._boundingNode(this._triggerNode)),c=l.bounds(this._triggerNode);this._dropdownNode.style.left=c.left-d.left-b.width+c.width+"px"}b=b.top+b.height-(f.top+f.height);0<b&&(this._dropdownNode.style.top=Math.floor(this._dropdownNode.style.top-b)+"px")}},_boundingNode:function(b){var f=window.getComputedStyle(b,null);return null===f||"absolute"===f.getPropertyValue("position")||
!b.parentNode||b===document.body?b:this._boundingNode(b.parentNode)},close:function(b){var f=!1;this.isVisible()&&(this._triggerNode.classList.remove("dropdownTriggerOpen"),this._selectionClass&&this._triggerNode.classList.remove(this._selectionClass),this._dropdownNode.classList.remove("dropdownMenuOpen"),l.setFramesEnabled(!0),b&&this._triggerNode.focus(),this._isVisible=!1,this._selectedItem&&(this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=null),f=!0);return f},
getItems:function(){var b=[],f=this;l.$$array("li:not(.dropdownSeparator) \x3e .dropdownMenuItem",this._dropdownNode,!0).forEach(function(d){d.parentNode.parentNode===f._dropdownNode&&b.push(d)});b.forEach(function(d){d._hasDropdownMouseover||(d.addEventListener("mouseover",function(b){d.dropdown?d.dropdown.open(b):(f._closeSelectedSubmenu(),l.stop(b));f._selectItem(d)}),d._hasDropdownMouseover=!0)});return b},empty:function(){var b=this;l.$$array("li",this._dropdownNode).forEach(function(f){f.parentNode===
b._dropdownNode&&f.parentNode.removeChild(f)});this._hookedAutoDismiss=!1},_dropdownKeyDown:function(b){if(b.keyCode===l.KEY.UP||b.keyCode===l.KEY.DOWN||b.keyCode===l.KEY.RIGHT||b.keyCode===l.KEY.ENTER||b.keyCode===l.KEY.LEFT){var f=this.getItems();if(f.length&&0<f.length){if(this._selectedItem){var d=f.indexOf(this._selectedItem);0>d&&(d=f.indexOf(this._selectedItem.parentNode));0<=d&&(b.keyCode===l.KEY.UP&&0<d?(d--,this._selectItem(f[d])):b.keyCode===l.KEY.DOWN&&d<f.length-1?(d++,this._selectItem(f[d])):
b.keyCode===l.KEY.ENTER||b.keyCode===l.KEY.RIGHT?this._selectedItem.classList.contains("dropdownTrigger")&&this._selectedItem.dropdown?(this._selectedItem.dropdown.open(),this._selectedItem.dropdown._selectItem()):b.keyCode===l.KEY.ENTER&&this._selectedItem.click():b.keyCode===l.KEY.LEFT&&this._selectedItem.parentNode.parentNode.classList.contains("dropdownMenuOpen")&&(this.close(!0),this._parentDropdown&&this._parentDropdown._dropdownNode.focus()))}else this._selectItem(f[0]);l.stop(b)}}else b.keyCode===
l.KEY.ESCAPE&&(this.close(!0),l.stop(b))},_selectItem:function(b){if(b=b||this.getItems()[0])this._selectedItem&&this._selectedItem.classList.remove("dropdownMenuItemSelected"),this._selectedItem=b,this._selectedItem.classList.add("dropdownMenuItemSelected");document.activeElement!==this._dropdownNode&&this._dropdownNode.focus()},submenuOpen:function(b){b!==this._selectedSubmenu&&(this._closeSelectedSubmenu(),this._selectedSubmenu=b)},_closeSelectedSubmenu:function(){for(var b=this._selectedSubmenu;b;)b.close(),
b=b._selectedSubmenu},destroy:function(){this.empty();this._boundAutoDismiss&&l.removeAutoDismiss(this._boundAutoDismiss)},appendMenuItem:function(b,f){var d=c(b,f);this._dropdownNode.appendChild(d);return d},appendSeparator:function(){var b=h();this._dropdownNode.appendChild(b);return b}};e.prototype.constructor=e;return{Dropdown:e,appendKeyBindingString:function(b,f){var d=document.createElement("span");d.classList.add("dropdownKeyBinding");d.appendChild(document.createTextNode(f));b.appendChild(d)},
createMenuItem:c,createSeparator:h}});define("text!orion/webui/dropdowntriggerbutton.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger"\x3e${ButtonText}\x3c!--span class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span--\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});define("text!orion/webui/dropdowntriggerbuttonwitharrow.html",[],function(){return'\x3cbutton class\x3d"dropdownTrigger dropdownDefaultButton"\x3e${ButtonText}\x3cspan class\x3d"dropdownArrowDown core-sprite-openarrow"\x3e\x3c/span\x3e\x3c/button\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e'});
define("text!orion/webui/submenutriggerbutton.html",[],function(){return'\x3cli class\x3d"dropdownSubMenu"\x3e\x3cspan class\x3d"dropdownTrigger dropdownMenuItem" role\x3d"menuitem" tabindex\x3d"0"\x3e\x3cspan class\x3d"dropdownCommandName"\x3e${ButtonText}\x3c/span\x3e\x3cspan class\x3d"dropdownArrowRight core-sprite-closedarrow"\x3e\x3c/span\x3e\x3c/span\x3e\x3cul class\x3d"dropdownMenu"\x3e\x3c/ul\x3e\x3c/li\x3e'});define("text!orion/webui/checkedmenuitem.html",[],function(){return'\x3cli\x3e\x3clabel class\x3d"dropdownMenuItem"\x3e\x3cinput class\x3d"checkedMenuItem" role\x3d"menuitem" type\x3d"checkbox" /\x3e${ItemText}\x3c/label\x3e\x3c/li\x3e'});
define("orion/webui/tooltip",["require","orion/webui/littlelib"],function(g,l){function k(e){this._init(e)}k.prototype={_init:function(e){this._node=l.node(e.node);if(!this._node)throw"no dom node for tooltip found";this._position=e.position||["right","above","below","left"];this._text=e.text;this._hideDelay=void 0===e.hideDelay?200:e.hideDelay;this._tailSize=e.tailSize||10;this._trigger=e.trigger||"mouseover";this._afterShowing=e.afterShowing;this._afterHiding=e.afterHiding;var c=this;if("click"===
this._trigger)this._showDelay=0,this._node.addEventListener("click",this._clickHandler=function(b){b.target===c._node&&(c.show(),l.stop(b))},!1);else if("mouseover"===this._trigger){this._showDelay=void 0===e.showDelay?500:e.showDelay;e=["mouseout","click"];this._node.addEventListener("mouseover",this._mouseoverHandler=function(b){l.contains(c._node,b.target)&&(c.show(),l.stop(b))},!1);this._leaveHandler=function(b){l.contains(c._node,b.target)&&c.hide()};for(var h=0;h<e.length;h++)this._node.addEventListener(e[h],
this._leaveHandler,!1)}},_makeTipNode:function(){if(!this._tip){this._tip=document.createElement("span");this._tip.classList.add("tooltipContainer");this._tipInner=document.createElement("div");this._tipInner.classList.add("tooltip");if(this._text){this._tipTextContent=document.createElement("div");this._tipTextContent.classList.add("textContent");this._tipInner.appendChild(this._tipTextContent);var e=document.createTextNode(this._text);this._tipTextContent.appendChild(e)}this._tip.appendChild(this._tipInner);
document.body.appendChild(this._tip);var c=this;l.addAutoDismiss([this._tip,this._node],function(){c.hide()});"mouseover"===this._trigger&&(this._tipInner.role="tooltip",this._tipInner.id="tooltip"+(new Date).getTime().toString(),this._node.setAttribute("aria-describedby",this._tipInner.id),this._tip.addEventListener("mouseover",function(e){c._timeout&&(window.clearTimeout(c._timeout),c._timeout=null);c._tip.addEventListener("mouseout",function(b){l.contains(c._tip,b.target)&&(c.hide(),l.stop(b))},
!1)},!1))}return this._tip},_positionTip:function(e,c){this._makeTipNode();"left"===e?this._tipInner.classList.add("left"):this._tipInner.classList.remove("left");var h=this._node,b;for(b=l.bounds(h);h&&!b.width&&!b.height;h=h.parentNode)b=l.bounds(h);var h=l.bounds(this._tipInner),f;switch(e){case "above":f=b.top-h.height-this._tailSize-1;b=b.left-this._tailSize;break;case "below":f=b.top+b.height+this._tailSize+1;b=b.left-this._tailSize;break;case "left":f=b.top-this._tailSize/2;b=b.left-h.width-
this._tailSize-1;break;default:f=b.top-this._tailSize/2,b=b.left+b.width+this._tailSize+1}var d=l.bounds(document.documentElement);if(f+h.height>d.height)if(c)f=d.height-h.height-1;else return!1;if(b+h.width>d.width)if(c)b=d.width-h.width-1;else return!1;if(0>b)if(c)b=4;else return!1;if(0>f)if(c)f=4;else return!1;this._tail&&this._tail.previousPosition!==e&&(this._tip.removeChild(this._tail),this._tail=null);this._tail||(this._tail=document.createElement("span"),this._tail.classList.add("tooltipTailFrom"+
e),"above"===e||"left"===e?this._tip.appendChild(this._tail):this._tip.insertBefore(this._tail,this._tipInner),"left"===e&&(this._tail.style.left=h.width+"px"),this._tail.previousPosition=e);this._tip.style.top=f+"px";this._tip.style.left=b+"px";return!0},contentContainer:function(){this._makeTipNode();return this._tipInner},show:function(){if(!this._tip||!this._tip.classList.contains("tooltipShowing"))this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),this._showDelay?this._timeout=
window.setTimeout(this._showImmediately.bind(this),this._showDelay):this._showImmediately()},_showImmediately:function(){for(var e=!1,c=0;!e&&c<this._position.length;)e=this._positionTip(this._position[c]),c++;e||this._positionTip(this._position[0],!0);this._tip.classList.add("tooltipShowing");this._afterShowing&&this._afterShowing()},hide:function(e){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);if(this._tip&&this._tip.classList.contains("tooltipShowing")){void 0===e&&(e=
this._hideDelay);var c=this;this._timeout=window.setTimeout(function(){c._tip.classList.remove("tooltipShowing");c._tip.removeAttribute("style");c._afterHiding&&c._afterHiding()},e)}},destroy:function(){this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null);this._tip&&(document.body.removeChild(this._tip),this._tail=this._tipTextContent=this._tipInner=this._tip=null);if(this._node){this._node.removeEventListener("click",this._clickHandler,!1);this._node.removeEventListener("mouseover",
this._mouseoverHandler,!1);for(var e=["mouseout","click"],c=0;c<e.length;c++)this._node.removeEventListener(e[c],this._leaveHandler,!1)}}};k.prototype.constructor=k;return{Tooltip:k}});
define("orion/commands","orion/util orion/webui/littlelib orion/webui/dropdown text!orion/webui/dropdowntriggerbutton.html text!orion/webui/dropdowntriggerbuttonwitharrow.html text!orion/webui/submenutriggerbutton.html text!orion/webui/checkedmenuitem.html orion/webui/tooltip".split(" "),function(g,l,k,e,c,h,b,f){function d(a){var d=a.invocation;if(d){var b=a.command;if(b.hrefCallback)return a=b.hrefCallback.call(d.handler||window,d),a.then?a.then(function(a){window.open(a)}):window.open(a),!0;if(d.commandRegistry)return d.commandRegistry._invoke(d),
!0;if(b.onClick||b.callback)return window.setTimeout(function(){(b.onClick||b.callback).call(d.handler||window,d)},0),!0}return!1}function m(a,b){for(var f in b)if(b[f]&&b[f].keyBinding&&b[f].command&&b[f].keyBinding.match(a)){var q=b[f],c=q.keyBinding;if((!c.domScope||l.contains(l.node(c.domScope),a.target))&&d(q)){l.stop(a);break}}}function a(){var a={};if(v){var d,b,q;b=Object.keys(u);for(d=0;d<b.length;d++)q=b[d],a[q]=u[q];var f=v();b=Object.keys(f);for(d=0;d<b.length;d++)q=b[d],a[q]=f[q]}else a=
u;return a}function n(d){m(d,a())}function p(a,d){a=a||window.event;if(function(a){if(g.isMac){if(a.metaKey&&!a.altKey)return!a.shiftKey&&!a.ctrlKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.ctrlKey)return!1}else{if(a.ctrlKey&&!a.altKey)return!a.shiftKey&&(65===a.keyCode||67===a.keyCode||86===a.keyCode||88===a.keyCode||90===a.keyCode)?!0:!1;if(a.altKey&&!a.ctrlKey)return!1}if(a["char"])return 0<a["char"].length;if(a.charCode||a.keyCode)switch(a=a.charCode||
a.keyCode,a){case 8:case 9:case 13:case 46:return!0;default:return 32<=a&&112>a||123<a}return!1}(a)){if("true"===a.target.contentEditable)return;var b=a.target.nodeName.toLowerCase();if("input"===b)switch(a.target.type.toLowerCase()){case "text":case "password":case "search":case "color":case "date":case "datetime":case "datetime-local":case "email":case "month":case "number":case "range":case "tel":case "time":case "url":case "week":return}else if("textarea"===b)return}d?d(a):n(a)}function t(){this._init()}
function r(a,d,b){d.classList.add("commandImage");var q;a.imageClass?a.addImageClassToElement?d.classList.add(a.imageClass):(q=document.createElement("span"),d.appendChild(q),q.classList.add(a.spriteClass),q.classList.add(a.imageClass)):(q=new Image,q.alt=a.name,q.name=b,q.id=b,q.src=a.image,d.appendChild(q));return q}function s(a,d,b,q,f){this.commandRegistry=f;this.handler=a;this.items=d;this.userData=b;this.command=q;q.parameters&&(this.parameters=q.parameters.makeCopy());this.id=q.id}function w(a){this._init(a)}
var v=null,u={};t.prototype={setProxy:function(a){this.proxy=a},setKeyBindings:function(a){this.bindings=a},_init:function(){var a=this;document.addEventListener("keydown",function(d){return p(d,function(d){var b=a.proxy,f=a.bindings;if(f&&b)for(var c=0;c<f.length;c++)f[c].match(d)&&(b.processKey({type:d.type,keyCode:d.keyCode,altKey:d.altKey,ctrlKey:d.ctrlKey,metaKey:d.metaKey,shiftKey:d.shiftKey}),l.stop(d))})})}};window.document.addEventListener("keydown",p,!1);s.prototype={collectsParameters:function(){return this.commandRegistry&&
this.commandRegistry.collectsParameters()},makeCopy:function(a){var d=new s(this.handler,this.items,this.userData,this.command,this.commandRegistry);d.domNode=this.domNode;d.domParent=this.domParent;a?d.parameters=a.makeCopy():this.parameters&&(d.parameters=this.parameters.makeCopy());return d}};s.prototype.constructor=s;w.prototype={_init:function(a){this.id=a.id;this.name=a.name;this.tooltip=a.tooltip;this.callback=a.callback;this.hrefCallback=a.hrefCallback;this.choiceCallback=a.choiceCallback;
this.positioningNode=a.positioningNode;this.image=a.image||"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC";this.imageClass=a.imageClass;this.addImageClassToElement=a.addImageClassToElement;this.selectionClass=a.selectionClass;this.spriteClass=a.spriteClass||"commandSprite";this.visibleWhen=a.visibleWhen;this.parameters=a.parameters;this.isEditor=a.isEditor},populateChoicesMenu:function(a,d,b,q,
f){b=this.getChoices(d,b,q);var c=b.some(function(a){return a.checked});b.forEach(function(b){if(b.name){var q=document.createElement("li");a.appendChild(q);var m=document.createElement("span");m.tabIndex=0;m.role="menuitem";m.classList.add("dropdownMenuItem");if(c){var n=document.createElement("span");n.classList.add("check");n.appendChild(document.createTextNode(b.checked?"\u25cf":""));m.appendChild(n)}n=document.createTextNode(b.name);m.appendChild(n);q.appendChild(m);m.choice=b;m.addEventListener("click",
function(a){a.target.choice&&a.target.choice.callback.call(a.target.choice,d)},!1);m.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&a.target.choice&&a.target.choice.callback.call(a.target.choice,d)},!1)}else f._generateMenuSeparator(a)})},getChoices:function(a,d,b){return this.choiceCallback?this.choiceCallback.call(d,a,b):null},makeChoiceCallback:function(a,d){return function(b){a.callback&&a.callback.call(a,d,b)}},hasImage:function(){return this.imageClass||
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC"!==this.image}};w.prototype.constructor=w;return{Command:w,CommandInvocation:s,createDropdownMenu:function(a,d,b,q,f,m,n,h,p){a=l.node(a);if(!a)throw"no parent node was specified";var g=document.createRange();g.selectNode(a);g=p?g.createContextualFragment(c):g.createContextualFragment(e);l.processTextNodes(g,{ButtonText:d});a.appendChild(g);a=a.lastChild;
var t;p?(p=a.previousSibling,t=p.lastChild):p=a.previousSibling;q?p.classList.add(q):(p.classList.add("orionButton"),p.classList.add("commandButton"));f&&(m||(p.textContent="",p.setAttribute("aria-label",d)),r({spriteClass:"commandSprite",imageClass:f},p,d),p.classList.add("orionButton"));p.dropdown=new k.Dropdown({dropdown:a,populate:b,selectionClass:n,skipTriggerEventListeners:!!t,positioningNode:h});a.dropdown=p.dropdown;return{menuButton:p,menu:a,dropdown:p.dropdown,dropdownArrow:t}},createCheckedMenuItem:function(a,
d,f,q){a=l.node(a);if(!a)throw"no parent node was specified";var c=document.createRange();c.selectNode(a);c=c.createContextualFragment(b);l.processTextNodes(c,{ItemText:d});a.appendChild(c);a=l.$(".checkedMenuItem",a.lastChild);a.checked=f;a.addEventListener("change",q,!1);return a},createCommandItem:function(a,d,b,q,c,m,n){var e;m=m||!d.name&&d.hasImage();if(d.hrefCallback)e=document.createElement("a"),e.id=q,m&&d.hasImage()?r(d,e,q):(e.className="commandLink",e.appendChild(document.createTextNode(d.name))),
n=d.hrefCallback.call(b.handler,b),n.then?n.then(function(a){e.href=a}):e.href=n?n:"#";else{e=document.createElement("button");e.className="orionButton";m?d.hasImage()?(r(d,e,q),d.name&&e.setAttribute("aria-label",d.name)):(e.classList.add("commandButton"),e.classList.add("commandMissingImageButton"),e.appendChild(document.createTextNode(d.name))):(e.classList.add("commandButton"),q=document.createTextNode(d.name),e.appendChild(q));var h=n||d.callback;h&&(d.onClick=h,e.addEventListener("click",function(a){h.call(b.handler,
b)},!1))}"ul"===a.nodeName.toLowerCase()?(n=document.createElement("li"),a.appendChild(n),a=n):e.classList.add("commandMargins");a.appendChild(e);d.tooltip&&(e.commandTooltip=new f.Tooltip({node:e,text:d.tooltip,position:["above","below","right","left"]}));c&&(u[d.id]={keyBinding:c,command:d,invocation:b});return e},createCommandMenuItem:function(a,d,b,q,c,m){var n,e,h=a.dropdown;if(d.hrefCallback)e=k.createMenuItem(d.name,"a"),n=e.firstElementChild,c=d.hrefCallback.call(b.handler,b),c.then?c.then(function(a){n.href=
a}):n.href=c?c:"#",n.addEventListener("keydown",function(a){(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)&&n.click()},!1);else{e=k.createMenuItem(d.name);n=e.firstElementChild;var p=c||d.callback;p&&(d.onClick=p,n.addEventListener("click",function(a){h.close(!0);p.call(b.handler,b)},!1),n.addEventListener("keydown",function(a){if(a.keyCode===l.KEY.ENTER||a.keyCode===l.KEY.SPACE)a.preventDefault(),n.click()},!1))}d.tooltip&&(n.commandTooltip=new f.Tooltip({node:n,text:d.tooltip,position:["above",
"below","right","left"]}));m&&k.appendKeyBindingString(n,m);a.appendChild(e);q&&(u[d.id]={keyBinding:q,command:d,invocation:b});return n},executeBinding:d,setKeyBindingProvider:function(a){v=a},localKeyBindings:u,CommandsProxy:t,getKeyBindings:a,processKey:n,NO_IMAGE:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAAtJREFUCNdjIBEAAAAwAAFletZ8AAAAAElFTkSuQmCC",_testMethodProcessKey:m}});
define("orion/explorers/navigationUtils",[],function(){function g(g,e,c,h){!l&&g&&(g.push({domNode:e}),e.tabIndex=-1,e.style.outline="none")}var l=-1!==navigator.userAgent.indexOf("iPad");return{addNavGrid:function(k,e,c){k&&(k=k.getGridNavHolder(e,!0))&&g(k,c)},generateNavGrid:g,removeNavGrid:function(g,e){if(g)for(var c=0;c<g.length;c++)if(g[c].domNode===e){g.splice(c,1);break}}}});
define("orion/PageUtil",[],function(){var g=/^http[s]?/i;return{hash:function(){var g=window.location.href.split("#")[1];return g?"#"+g:""},matchResourceParameters:function(g){g=g||window.location.toString();var k={resource:""},e=g.indexOf("#");if(-1!==e&&(g=g.substring(e+1),0!==g.length)){g=g.split(",");k.resource=decodeURIComponent(g[0]);for(e=1;e<g.length;e++){var c=/([^=]*)(=?)(.*)/.exec(g[e]),h=decodeURIComponent(c[1]||""),c=decodeURIComponent(c[3]||"");""!==h&&"resource"!==h&&(k[h]=c)}}return k},
validateURLScheme:function(l,k){var e=l;if(-1===l.indexOf("://")){var c=document.createElement("a");c.href=l;e=c.href}c=!1;if(c=k?k.some(function(c){return RegExp("^"+c+":","i").test(e)}):g.test(e))return l;console.log("Illegal URL Scheme: '"+l+"'");return""}}});
define("orion/uiUtils",["orion/webui/littlelib"],function(g){function l(e){var c="",h=-1!==navigator.platform.indexOf("Mac");h?(e.mod4&&(c+="\u2303"),e.mod3&&(c+="\u2325"),e.mod2&&(c+="\u21e7"),e.mod1&&(c+="\u2318")):(e.mod1&&(c+="Ctrl+"),e.mod2&&(c+="Shift+"),e.mod3&&(c+="Alt+"));if(e.alphaKey)return c+e.alphaKey;if("keypress"===e.type)return c+e.keyCode;for(var b in g.KEY)if(typeof("number"===g.KEY[b])&&g.KEY[b]===e.keyCode){if(h)switch(g.KEY[b]){case g.KEY.BKSPC:b="\u232b";break;case g.KEY.TAB:b=
"\u21e5";break;case g.KEY.ENTER:b="\u23ce";break;case g.KEY.ESCAPE:b="\u238b";break;case g.KEY.SPACE:b="\u2423";break;case g.KEY.PAGEUP:b="\u21de";break;case g.KEY.PAGEDOWN:b="\u21df";break;case g.KEY.END:b="\u21f2";break;case g.KEY.HOME:b="\u21f1";break;case g.KEY.DEL:b="\u2326"}switch(g.KEY[b]){case g.KEY.DOWN:b="\u2193";break;case g.KEY.UP:b="\u2191";break;case g.KEY.RIGHT:b="\u2192";break;case g.KEY.LEFT:b="\u2190"}return c+b}var f;switch(e.keyCode){case 59:f=e.mod2?":":";";break;case 61:f=e.mod2?
"+":"\x3d";break;case 188:f=e.mod2?"\x3c":",";break;case 190:f=e.mod2?"\x3e":".";break;case 191:f=e.mod2?"?":"/";break;case 192:f=e.mod2?"~":"`";break;case 219:f=e.mod2?"{":"[";break;case 220:f=e.mod2?"|":"\\";break;case 221:f=e.mod2?"}":"]";break;case 222:f=e.mod2?'"':"'"}return f?c+f:112<=e.keyCode&&123>=e.keyCode?c+"F"+(e.keyCode-111):c+String.fromCharCode(e.keyCode)}function k(e){var c=-1!==window.navigator.platform.indexOf("Mac");return c&&e.metaKey||!c&&e.ctrlKey}return{getUserKeyString:function(e){var c=
"";e=e.getKeys();for(var h=0;h<e.length;h++)0!==h&&(c+=" "),c+=l(e[h]);return c},getUserText:function(e){var c=e.id,h=e.refNode,b=e.hideRefNode,f=e.initialText,d=e.onComplete,m=e.onEditDestroy,a=e.selectTo,n=e.isInitialValid;e=e.insertAsChild;var p=!1,t=function(a){return function(e){if(!p){var t=g.node(c),k=t.value;t&&(a&&e.keyCode===g.KEY.ESCAPE?(b&&(h.style.display="inline"),p=!0,t.parentNode.removeChild(t),m&&m()):a&&e.keyCode!==g.KEY.ENTER||(0===k.length||!n&&k===f?b&&(h.style.display="inline"):
(d(k),b&&h.parentNode&&(h.style.display="inline")),p=!0,t.parentNode&&t.parentNode.removeChild(t),m&&m()))}}},k=document.createElement("input");k.id=c;k.value=f||"";e?h.appendChild(k):h.parentNode.insertBefore(k,h.nextSibling);k.classList.add("userEditBoxPrompt");b&&(h.style.display="none");k.addEventListener("keydown",t(!0),!1);k.addEventListener("blur",t(!1),!1);window.setTimeout(function(){k.focus();if(f){var d=g.node(c),b=a?f.indexOf(a):-1;0<b?d.createTextRange?(d=d.createTextRange(),d.collapse(!0),
d.moveStart("character",0),d.moveEnd("character",b),d.select()):d.setSelectionRange?d.setSelectionRange(0,b):void 0!==d.selectionStart&&(d.selectionStart=0,d.selectionEnd=b):d.select()}},0)},openInNewWindow:k,followLink:function(e,c){c&&k(c)?window.open(e):window.location=e},createButton:function(e,c){var h=document.createElement("button");h.className="orionButton commandButton commandMargins";h.addEventListener("click",function(b){c();g.stop(b)},!1);e&&h.appendChild(document.createTextNode(e));return h},
createDropdownButton:function(e,c,h){},isFormElement:function(e){switch(e.tagName.toLowerCase()){case "button":case "fieldset":case "form":case "input":case "keygen":case "label":case "legend":case "meter":case "optgroup":case "output":case "progress":case "select":case "textarea":return!0}return!1}}});
define("orion/commandRegistry","orion/commands orion/explorers/navigationUtils orion/PageUtil orion/uiUtils orion/webui/littlelib orion/webui/dropdown orion/webui/tooltip text!orion/webui/checkedmenuitem.html text!orion/webui/dropdowntriggerbutton.html text!orion/webui/submenutriggerbutton.html".split(" "),function(g,l,k,e,c,h,b,f,d,m){function a(a){this._commandList={};this._contributionsByScopeId={};this._activeBindings={};this._urlBindings={};this._pendingBindings={};this._init(a);this._parameterCollector=
null}function n(a,d){this.token=a;this.parameterName=d}function p(a,d,b){this.event=a;this.handler=d;this.capture=b||!1}function t(a,d,b,f,c,m){this.name=a;this.type=d;this.label=b;this.value=f;this.lines=c||1;this.eventListeners=Array.isArray(m)?m:m?[m]:[]}function r(a,d,b){this._storeParameters(a);this._hasOptionalParameters=d&&d.hasOptionalParameters;this._options=d;this.optionsRequested=!1;this.getParameters=b;this.clientCollect=d&&d.clientCollect}a.prototype={_init:function(a){this._selectionService=
a.selection;var d=this;g.setKeyBindingProvider(function(){return d._activeBindings})},processURL:function(a){for(var d in this._urlBindings)if(this._urlBindings[d]&&this._urlBindings[d].urlBinding&&this._urlBindings[d].command){var b=this._urlBindings[d].urlBinding.match(a);if(b){var f=this._urlBindings[d],c=f.command,m=f.invocation;if(m&&m.parameters&&c.callback){m.parameters.setValue(b.parameterName,b.parameterValue);var n=this;window.setTimeout(function(){n._invoke(m)},0);break}}}},findCommand:function(a){return this._commandList[a]},
runCommand:function(a,d,b,f){d?(a=this._commandList[a])&&(a.visibleWhen?a.visibleWhen(d):1)&&a.callback&&this._invoke(new g.CommandInvocation(b,d,null,a,this),f):(d=this._urlBindings[a])&&d.command&&d.command.callback&&this._invoke(d.invocation,f)},getSelectionService:function(){return this._selectionService},setParameterCollector:function(a){this._parameterCollector=a},openParameterCollector:function(a,d,b){this._parameterCollector&&(this._parameterCollector.close(),this._parameterCollector.open(a,
d,b))},confirm:function(a,d,b,f,c,m){var n=!1;if(this._parameterCollector&&!c){var q=this;this._parameterCollector.close();if(this._parameterCollector.open(a,function(a,c){var m=document.createElement("span");m.classList.add("parameterPrompt");m.textContent=d;a.appendChild(m);m=document.createElement("button");m.addEventListener("click",function(a){n=!0;q._parameterCollector.close()},!1);c.appendChild(m);m.appendChild(document.createTextNode(b));m.className="dismissButton";var e=document.createElement("button");
e.addEventListener("click",function(a){n=!1;q._parameterCollector.close()},!1);c.appendChild(e);e.appendChild(document.createTextNode(f));e.className="dismissButton";return m},function(){m(n)}))return}n=window.confirm(d);m(n)},closeParameterCollector:function(){this._parameterCollector&&this._parameterCollector.close()},collectsParameters:function(){return this._parameterCollector},_invoke:function(a,d){return this._collectAndInvoke(a.makeCopy(d),!1)},_collectAndInvoke:function(a,d){if(a)if(this._parameterCollector&&
a.parameters&&a.parameters.hasParameters()&&(d||a.parameters.shouldCollectParameters())){var f=!1;a.parameters.updateParameters(a);if(a.parameters.shouldCollectParameters()&&(f=this._parameterCollector.collectParameters(a),!f)){var c=new b.Tooltip({node:a.domNode,afterHiding:function(){this.destroy()},trigger:"click",position:["below","right","above","left"]}),f=c.contentContainer();f.classList.add("parameterPopup");var m=window.document.activeElement,n=this._parameterCollector.getFillFunction(a,
function(){m&&m.focus();c.destroy()})(f);c.show();window.setTimeout(function(){n.focus();n.select()},0);f=!0}f||a.command.callback.call(a.handler||window,a)}else a.command.callback.call(a.handler||window,a);else window.console.log("Client attempted to invoke command without an available (rendered) command invocation")},collectParameters:function(a){this._collectAndInvoke(a,!0)},showKeyBindings:function(a){function d(a){return function(){g.executeBinding(a)}}var b={},f,c,m=[],n;for(n in this._activeBindings)(c=
this._activeBindings[n])&&c.keyBinding&&c.command&&(c.command.name||c.command.tooltip)&&m.push(c);m.sort(function(a,d){return(a.command.name||a.command.tooltip).localeCompare(d.command.name||d.command.tooltip)});for(n=0;n<m.length;n++)c=m[n],c.keyBinding.scopeName?(b[c.keyBinding.scopeName]||(b[c.keyBinding.scopeName]=[]),b[c.keyBinding.scopeName].push(c)):(f=e.getUserKeyString(c.keyBinding),a.createItem(f,c.command.name||c.command.tooltip,d(c)));for(var q in b)b[q].length&&0<b[q].length&&(a.createHeader(q),
b[q].forEach(function(b){f=e.getUserKeyString(b.keyBinding);a.createItem(f,b.command.name||b.command.tooltip,d(b))}))},addCommand:function(a){this._commandList[a.id]=a;var d=this._pendingBindings[a.id];if(d){var b=this;d.forEach(function(d){b._addBinding(a,d.type,d.binding,d.bindingOnly)});delete this._pendingBindings[a.id]}},addCommandGroup:function(a,d,b,f,c,m,n,q,A,B){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];c&&(a=this._createEntryForPath(a,
c));a[d]?(f&&(a[d].title=f),b&&(a[d].position=b),n&&(a[d].imageClass=n),q&&(a[d].tooltip=q),A&&(a[d].selectionClass=A),!0===B?a[d].pretendDefaultActionId=!0:a[d].defaultActionId=B,a[d].emptyGroupMessage=m):(a[d]={title:f,position:b,emptyGroupMessage:m,imageClass:n,tooltip:q,selectionClass:A,defaultActionId:!0===B?null:B,pretendDefaultActionId:!0===B,children:{}},a.sortedContributions=null)},_createEntryForPath:function(a,d){d&&d.split("/").forEach(function(d){1<d.length&&(a[d]||(a[d]={position:0,
children:{}},a.sortedContributions=null),a=a[d].children)});return a},registerSelectionService:function(a,d){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});this._contributionsByScopeId[a].localSelectionService=d},registerCommandContribution:function(a,d,b,f,c,m,n){this._contributionsByScopeId[a]||(this._contributionsByScopeId[a]={});a=this._contributionsByScopeId[a];f&&(a=this._createEntryForPath(a,f));a[d]={position:b};m&&((b=this._commandList[d])?this._addBinding(b,"key",
m,c):this._addPendingBinding(d,"key",m,c));n&&((b=this._commandList[d])?this._addBinding(b,"url",n,c):this._addPendingBinding(d,"url",n,c));a.sortedContributions=null},unregisterCommandContribution:function(a,d,b){if(this._contributionsByScopeId[a]){delete this._commandList[d];delete this._activeBindings[d];delete this._urlBindings[d];delete this._pendingBindings[d];var f=this._contributionsByScopeId[a];b&&b.split("/").forEach(function(a){1<a.length&&f[a]&&(f=f[a].children)});delete f[d];f.sortedContributions=
null}},_addBinding:function(a,d,b,f){if(!a.id)throw Error("No command id: "+a);"key"===d?this._activeBindings[a.id]={command:a,keyBinding:b,bindingOnly:f}:"url"===d&&(this._urlBindings[a.id]={command:a,urlBinding:b,bindingOnly:f})},_addPendingBinding:function(a,d,b,f){this._pendingBindings[a]=this._pendingBindings[a]||[];this._pendingBindings[a].push({type:d,binding:b,bindingOnly:f})},_checkForTrailingSeparator:function(a,d,b){var f;if("tool"===d||"button"===d)if((f=0<a.childNodes.length?a.childNodes[a.childNodes.length-
1]:null)&&f.classList.contains("commandSeparator"))return b?(a.removeChild(f),!1):!0;if("menu"===d&&(a=c.$$array("li \x3e *",a),0<a.length&&a[a.length-1].classList.contains("dropdownSeparator")))if(f=a[a.length-1],b)f.parentNode.parentNode.removeChild(f.parentNode);else return!0;return!1},renderCommands:function(a,d,b,f,m,n,e){if("string"!==typeof a)throw"a scope id for rendering must be specified";d=c.node(d);if(!d)throw"no parent";var q=this._contributionsByScopeId[a];if(!b&&q){b=q.localSelectionService||
this._selectionService;var A=this;b&&b.getSelections(function(b){A.renderCommands(a,d,b,f,m,n)})}else q&&(this._render(q,d,b,f,m||"button",n,e),this._checkForTrailingSeparator(d,m,!0))},destroy:function(a){a=c.node(a);if(!a)throw"no parent";for(;a.hasChildNodes();){var d=a.firstChild;d.commandTooltip&&d.commandTooltip.destroy();d.emptyGroupTooltip&&d.emptyGroupTooltip.destroy();this.destroy(d);a.removeChild(d)}},_render:function(a,d,f,c,m,n,h){var q=a.sortedContributions;if(!q){var q=[],A=!1,B;for(B in a)if(Object.prototype.hasOwnProperty.call(a,
B)){var p=a[B];p&&"number"===typeof p.position&&(p.id=B,q.push(p),A=!0)}A&&(q.sort(function(a,d){return a.position-d.position}),a.sortedContributions=q)}var t=0,k=this;q.forEach(function(a){var q;a.imageClass||(a.imageClass=null);if(a.children&&0<Object.getOwnPropertyNames(a.children).length){var B=a.children;if("tool"===m||"button"===m)if(a.title){var A;a.defaultActionId&&((B=k._commandList[a.defaultActionId])&&(B.visibleWhen?B.visibleWhen(f):1)?(A=new g.CommandInvocation(c,f,n,B,k),A.domParent=
d):a.pretendDefaultActionId=!0);B=k._createDropdownMenu(d,a.title,null,null,a.imageClass,a.tooltip,a.selectionClass,null,A,a.pretendDefaultActionId);h&&l.generateNavGrid(h,B.menuButton);B&&(k._render(a.children,B.menu,f,c,"menu",n,h),k._checkForTrailingSeparator(B.menu,"menu",!0),0===B.menu.childNodes.length?a.emptyGroupMessage?B.menuButton.emptyGroupTooltip||(B.menuButton.emptyGroupTooltip=new b.Tooltip({node:B.menuButton,text:a.emptyGroupMessage,trigger:"click",position:["below","right","above",
"left"]})):(h&&l.removeNavGrid(h,B.menuButton),a=function(a){a&&a.parentNode&&a.parentNode.removeChild(a)},a(B.menu),a(B.menuButton),a(B.destroyButton)):B.menuButton.style.visibility="visible")}else{var p;0<d.childNodes.length&&!k._checkForTrailingSeparator(d,m)&&(p=k.generateSeparatorImage(d));k._render(B,d,f,c,m,n,h);0<d.childNodes.length&&d.childNodes[d.childNodes.length-1]!==p&&(p=k.generateSeparatorImage(d))}else if(a.title){if(a=k._createDropdownMenu(d,a.title,!0,null,null,a.imageClass))k._render(B,
a.menu,f,c,"menu",n,h),k._checkForTrailingSeparator(a.menu,"menu",!0),0===a.menu.childNodes.length&&a.destroyButton&&d.removeChild(a.destroyButton)}else 0<d.childNodes.length&&k._generateMenuSeparator(d),k._render(B,d,f,c,m,n,h),k._generateMenuSeparator(d)}else{var C=k._commandList[a.id],B=C?!0:!1;A=a=null;if(C){q=new g.CommandInvocation(c,f,n,C,k);q.domParent=d;p=!1;try{p=B&&(C.visibleWhen?C.visibleWhen(f):!0)}catch(r){throw console.log(r),r;}k._activeBindings[C.id]&&k._activeBindings[C.id].keyBinding&&
(a=k._activeBindings[C.id],a.invocation=p?q:null,a.bindingOnly&&(B=!1));k._urlBindings[C.id]&&k._urlBindings[C.id].urlBinding&&(A=k._urlBindings[C.id],A.invocation=p?q:null,A.bindingOnly&&(B=!1));B=B&&p}B&&(C.choiceCallback?("tool"===m||"button"===m?(a=d,B=!1,"ul"===d.nodeName.toLowerCase()&&(a=document.createElement("li"),d.appendChild(a))):(a=d,B=!0),k._createDropdownMenu(a,C.name,B,function(a){C.populateChoicesMenu(a,f,c,n,k)}.bind(C),C.imageClass,C.tooltip||C.title,C.selectionClass,C.positioningNode)):
(q.handler=q.handler||this,q.domParent=d,B=function(a){k._invoke(q)},"menu"===m?(A=null,a&&a.keyBinding&&(A=e.getUserKeyString(a.keyBinding)),a=g.createCommandMenuItem(d,C,q,null,B,A)):(a=m+C.id+t,a=g.createCommandItem(d,C,q,a,null,"tool"===m,B)),l.generateNavGrid(h,a),q.domNode=a,t++))}})},_createDropdownMenu:function(a,d,f,n,e,p,t,q,A,B){a=c.node(a);if(!a||!c.contains(document.body,a))return null;var C,k,r=a;if(f)p=document.createRange(),p.selectNode(a),p=p.createContextualFragment(m),c.processTextNodes(p,
{ButtonText:d}),a.appendChild(p),k=a.lastChild,e=k.lastChild,d=e.previousSibling,d.dropdown=new h.Dropdown({dropdown:e,populate:n,parentDropdown:a.dropdown}),e.dropdown=d.dropdown;else{"ul"===a.nodeName.toLowerCase()&&(r=document.createElement("li"),a.appendChild(r),k=r);a=null;e&&(a="dropdownButtonWithIcon",p=p||d);p=e?p||d:p;var l=g.createDropdownMenu(r,d,n,a,e,!1,t,q,A||B);C=l.dropdownArrow;d=l.menuButton;if(C){A&&(A.domNode=l.menuButton);var E=this;d.onclick=function(a){var d=c.bounds(C);a.clientX>=
d.left&&l.dropdown?l.dropdown.toggle(a):E._invoke(A)};l.dropdown&&(d.onkeydown=function(a){c.KEY.DOWN===a.keyCode&&(l.dropdown.toggle(a),c.stop(a))})}e=l.menu;var D;(n=A&&A.command&&(A.command.tooltip||A.command.name))?D=A.command.tooltip||A.command.name:n&&(D=p);D&&(d.commandTooltip=new b.Tooltip({node:d,text:D,position:["above","below","right","left"]}))}return{menuButton:d,menu:e,dropdown:d.dropdown,destroyButton:k,dropdownArrow:C}},_generateMenuSeparator:function(a){if(!this._checkForTrailingSeparator(a,
"menu")){var d=document.createElement("li");d.classList.add("dropdownSeparator");var b=document.createElement("span");b.classList.add("dropdownSeparator");d.appendChild(b);a.appendChild(d)}},generateSeparatorImage:function(a){var d;d="ul"===a.nodeName.toLowerCase()?document.createElement("li"):document.createElement("span");a.appendChild(d);d.classList.add("core-sprite-sep");d.classList.add("imageSprite");d.classList.add("commandSeparator");return d}};a.prototype.constructor=a;n.prototype={match:function(a){a=
k.matchResourceParameters(a);return"undefined"!==typeof a[this.token]?(this.parameterValue=a[this.token],this):null}};n.prototype.constructor=n;p.prototype.constructor=p;t.prototype={optionsRequested:function(){return this.optionsRequested}};t.prototype.constructor=t;r.prototype={_storeParameters:function(a){this.parameterTable=null;if(a){var d=this.parameterTable={};a.forEach(function(a){d[a.name]=a})}},updateParameters:function(a){"function"===typeof this.getParameters&&this._storeParameters(this.getParameters(a))},
hasParameters:function(){return null!==this.parameterTable},shouldCollectParameters:function(){return!this.clientCollect&&this.hasParameters()},parameterNamed:function(a){return this.parameterTable[a]},valueFor:function(a){return(a=this.parameterTable[a])?a.value:null},setValue:function(a,d){var b=this.parameterTable[a];b&&(b.value=d)},forEach:function(a){for(var d in this.parameterTable)this.parameterTable[d].type&&this.parameterTable[d].name&&a(this.parameterTable[d])},makeCopy:function(){var a=
[];this.forEach(function(d){d=new t(d.name,d.type,d.label,d.value,d.lines,d.eventListeners);a.push(d)});var d=new r(a,this._options,this.getParameters);d.clientCollect=this.clientCollect;return d},hasOptionalParameters:function(){return this._hasOptionalParameters}};r.prototype.constructor=r;return{CommandRegistry:a,URLBinding:n,ParametersDescription:r,CommandParameter:t,CommandEventListener:p}});
define("orion/parameterCollectors",["i18n!orion/nls/messages","require","orion/webui/littlelib"],function(g,l,k){function e(c,e){this._activeContainer=null;this._getElementsFunction=c;this._toolbarLayoutFunction=e}e.prototype={close:function(){if(this._activeElements){this._activeElements.parameterArea&&k.empty(this._activeElements.parameterArea);this._activeElements.slideContainer&&this._activeElements.slideContainer.classList.remove("slideContainerActive");this._activeElements.dismissArea&&k.empty(this._activeElements.dismissArea);
this._activeElements.commandNode&&this._activeElements.commandNode.classList.remove("activeCommand");this._toolbarLayoutFunction(this._activeElements);if(this._activeElements.onClose)this._activeElements.onClose();this._oldFocusNode&&(this._oldFocusNode.focus(),this._oldFocusNode=null)}this._activeElements=null},open:function(c,e,b){"string"===typeof c&&(c=k.node(c));if(this._activeElements&&this._activeElements.slideContainer&&this._activeElements.commandNode===c)return this._activeElements.focusNode&&
this._activeElements.focusNode.focus(),!0;this.close();this._activeElements=null;if((this._activeElements=this._getElementsFunction(c))&&this._activeElements.parameterArea&&this._activeElements.slideContainer){this._activeElements.onClose=b;var f=e(this._activeElements.parameterArea,this._activeElements.dismissArea);if(!f)return!1;this._activeElements.focusNode=f;c=k.$$array("#closebox",this._activeElements.dismissArea||this._activeElements.parameterArea);if(0===c.length){e=this._activeElements.dismissArea||
this._activeElements.parameterArea;c=document.createElement("button");c.id="closebox";c.className="imageSprite core-sprite-close dismissButton";c.title=g.Close;e.appendChild(c);var d=this;c.addEventListener("click",function(b){d.close()},!1)}this._activeElements.slideContainer.classList.add("slideContainerActive");this._toolbarLayoutFunction(this._activeElements);f&&(this._oldFocusNode=window.document.activeElement,window.setTimeout(function(){f.focus();f.select&&f.select()},0));this._activeElements.commandNode&&
this._activeElements.commandNode.classList.add("activeCommand");return!0}return!1},_collectAndCall:function(c,e){k.$$array("input",e).forEach(function(b){"checkbox"===b.type?c.parameters.setValue(b.parameterName,b.checked):"button"!==b.type&&c.parameters.setValue(b.parameterName,b.value.trim())});k.$$array("textArea",e).forEach(function(b){c.parameters.setValue(b.parameterName,b.value.trim())});c.command.callback&&c.command.callback.call(c.handler,c)},collectParameters:function(c){return c.parameters?
(c.domNode&&c.domNode.classList.add("commandMarker"),this.open(c.domNode||c.domParent,this.getFillFunction(c))):!1},getFillFunction:function(c,e){var b=this;return function(f,d){var m=null,a=function(){e&&e();b.close()},n=function(d){d.keyCode===k.KEY.ENTER&&b._collectAndCall(c,f);if(d.keyCode===k.KEY.ESCAPE||d.keyCode===k.KEY.ENTER)a(),k.stop(d)};c.parameters.forEach(function(d){var b=null;d.label&&(b=document.createElement("label"),b.classList.add("parameterInput"),b.setAttribute("for",d.name+"parameterCollector"),
b.textContent=d.label,f.appendChild(b));var e=d.name+"parameterCollector",h,b=b||f;"text"===d.type&&"number"===typeof d.lines&&1<d.lines?(h=document.createElement("textarea"),h.rows=d.lines,h.type="textarea",h.id=e,b.appendChild(h),n=function(d){d.keyCode===k.KEY.ESCAPE&&(a(),k.stop(d))}):"boolean"===d.type?(h=document.createElement("input"),h.type="checkbox",h.id=e,b.appendChild(h),d.value&&(h.checked=!0)):(h=document.createElement("input"),h.type=d.type,h.id=e,b.appendChild(h),d.value&&(h.value=
d.value));h.classList.add("parameterInput");h.setAttribute("speech","speech");h.setAttribute("x-webkit-speech","x-webkit-speech");h.parameterName=d.name;m||(m=h);0<d.eventListeners.length&&d.eventListeners.forEach(function(a){h.addEventListener(a.event,function(d){return a.handler(d,c)},a.capture)});h.addEventListener("keydown",n,!1)});var p=d;p||(p=document.createElement("span"),p.classList.add("layoutRight"),p.classList.add("parametersDismiss"),f.appendChild(p));var t=function(a,d){var b=document.createElement("button");
d.appendChild(b);a&&b.appendChild(document.createTextNode(a));b.classList.add("dismissButton");return b};c.parameters.hasOptionalParameters()&&(c.parameters.optionsRequested=!1,t(g.More,p).addEventListener("click",function(){c.parameters.optionsRequested=!0;b._collectAndCall(c,f);a()},!1));t(g.Submit,p).addEventListener("click",function(){b._collectAndCall(c,f);a()},!1);p=t(null,p);p.id="closebox";p.classList.add("imageSprite");p.classList.add("core-sprite-close");p.title=g.Close;p.addEventListener("click",
function(d){a()},!1);return m}}};e.prototype.constructor=e;return{CommandParameterCollector:e}});define("orion/regex",[],function(){return{escape:function(g){return g.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26")},parse:function(g){return(g=/^\s*\/(.+)\/([gim]{0,3})\s*$/.exec(g))?{pattern:g[1],flags:g[2]}:null}}});
define("orion/contentTypes",[],function(){function g(d,a){if("string"!==typeof d)return null;for(var b=d&&d.split(".").pop(),f=null,c=0;c<a.length;c++){var e=a[c],h;h=f;var g=e,k=b,l=0<=g.filename.indexOf(d),y;y=k.toLowerCase();y=-1!==g.extension.indexOf(y);if(l||y){if(!(y=!h))l&&(k=k.toLowerCase(),l=-1!==h.extension.indexOf(k)),y=l;y&&(h=g)}h===e&&(f=e)}return f}function l(d){return null===d||"undefined"===typeof d?[]:Array.isArray(d)?d:[d]}function k(d){return l(d).map(function(a){return String.prototype.toLowerCase.call(a)})}
function e(d){return{id:d.id,name:d.name,image:d.image,imageClass:d.imageClass,"extends":d["extends"],extension:k(d.extension),filename:l(d.filename)}}function c(d){var a=Object.create(null);d.map(e).forEach(function(d){Object.prototype.hasOwnProperty.call(a,d.id)||(a[d.id]=d)});return a}function h(m){if(m&&m.registerService){this.serviceRegistry=m;for(var a=m.getServiceReferences(f).concat(m.getServiceReferences(d)),n=[],e=0;e<a.length;e++)for(var h=l(a[e].getProperty("contentTypes")),g=0;g<h.length;g++)n.push(h[g]);
this.map=c(n);m.registerService(b,this)}else if(Array.isArray(m))this.serviceRegistry=null,this.map=c(m);else throw Error("Invalid parameter");}var b="orion.core.contentTypeRegistry",f="orion.core.contenttype",d="orion.file.contenttype";h.prototype={getContentTypes:function(){var d=this.getContentTypesMap(),a=[],b;for(b in d)Object.prototype.hasOwnProperty.call(d,b)&&a.push(d[b]);return a},getContentTypesMap:function(){return this.map},getFileContentType:function(d){return g(d.Name,this.getContentTypes())},
getFilenameContentType:function(d){return g(d,this.getContentTypes())},getContentType:function(d){return this.map[d]||null},isExtensionOf:function(d,a){d="string"===typeof d?this.getContentType(d):d;a="string"===typeof a?this.getContentType(a):a;if(!d||!a)return!1;if(d.id===a.id)return!0;for(var b=d,f={};b&&(b=this.getContentType(b["extends"]));){if(b.id===a.id)return!0;if(f[b.id])throw Error("Cycle: "+b.id);f[b.id]=!0}return!1},isSomeExtensionOf:function(d,a){for(var b=0;b<a.length;b++)if(this.isExtensionOf(d,
a[b]))return!0;return!1}};return{ContentTypeRegistry:h,getFilenameContentType:g}});
define("orion/URITemplate",[],function(){function g(a){this._text=a}function l(a){return a.replace("%25","%")}function k(a,d){if("U"===d)return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()});if("U+R"===d)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(m,l);if("U+R-,"===d)return encodeURI(a).replace(/%5B/g,"[").replace(/%5D/g,"]").replace(/,/g,"%2C");throw Error("Unknown allowed character set: "+d);}function e(a,d,b){for(var f=
[],c=0;c<a.length;c++)"undefined"!==typeof a[c]&&f.push(k(a[c],d));return f.join(b)}function c(a,d,b,f){for(var c=Object.keys(a),m=[],e=0;e<c.length;e++)"undefined"!==typeof a[c[e]]&&m.push(k(c[e],d)+b+k(a[c[e]],d));return m.join(f)}function h(a){if(0===a.length)throw Error("Invalid Expression: 0 length expression");(this._operator=f[a[0]])?a=a.substring(1):this._operator=f.NUL;for(var b=[],c=a.split(","),m=0;m<c.length;m++){var e=c[m].match(d);if(null===e)throw Error("Bad VarSpec: "+a);b.push({name:e[1],
explode:!!e[2],prefix:e[3]?parseInt(e[3],10):-1})}this._varSpecList=b}function b(a){for(var d=[],b=0,f=a.indexOf("{",b);-1!==f;){d.push(new g(a.substring(b,f)));b=a.indexOf("}",f+1);if(-1===b)throw Error("Invalid template: "+a);d.push(new h(a.substring(f+1,b)));b+=1;f=a.indexOf("{",b)}d.push(new g(a.substring(b)));this._templateComponents=d}var f={NUL:{first:"",sep:",",named:!1,ifemp:"",allow:"U"},"+":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R"},".":{first:".",sep:",",named:!1,ifemp:"",allow:"U"},
"/":{first:"/",sep:"/",named:!1,ifemp:"",allow:"U"},";":{first:";",sep:";",named:!0,ifemp:"",allow:"U"},"?":{first:"?",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"\x26":{first:"\x26",sep:"\x26",named:!0,ifemp:"\x3d",allow:"U"},"#":{first:"#",sep:",",named:!1,ifemp:"",allow:"U+R"},",":{first:"",sep:",",named:!1,ifemp:"",allow:"U+R-,"}},d=/^((?:(?:[a-zA-Z0-9_])|(?:%[0-9A-F][0-9A-F]))(?:(?:[a-zA-Z0-9_.])|(?:%[0-9A-F][0-9A-F]))*)(?:(\*)|:([0-9]+))?$/,m=/%25[0-9A-F][0-9A-F]/g;g.prototype={expand:function(a){return encodeURI(this._text)}};
h.prototype={expand:function(a){for(var d=[],b=0;b<this._varSpecList.length;b++){var f=this._varSpecList[b],m=f.name,h=a[m],g=typeof h;if("undefined"!==g&&null!==h){var l=0===d.length?this._operator.first:this._operator.sep;if("string"===g)this._operator.named&&(l+=k(m,"U+R"),l+=0===h.length?this._operator.ifemp:"\x3d"),-1!==f.prefix&&f.prefix<h.length&&(h=h.substring(0,f.prefix)),l+=k(h,this._operator.allow);else if(Array.isArray(h)){if(0===h.length)continue;f.explode?l+=e(h,this._operator.allow,
this._operator.sep):(f=e(h,this._operator.allow,","),this._operator.named&&(l+=k(m,"U+R"),l+=0===f.length?this._operator.ifemp:"\x3d"),l+=f)}else if("object"===g){if(0===Object.keys(h).length)continue;f.explode?l+=c(h,this._operator.allow,"\x3d",this._operator.sep):(f=c(h,this._operator.allow,",",","),this._operator.named&&(l+=k(m,"U+R"),l+=0===f.length?this._operator.ifemp:"\x3d"),l+=f)}else throw Error("bad param type: "+m+" : "+g);d.push(l)}}return d.join("")}};b.prototype={expand:function(a){for(var d=
[],b=0;b<this._templateComponents.length;b++)d.push(this._templateComponents[b].expand(a));return d.join("")}};return b});
define("orion/i18nUtil",["require","orion/Deferred"],function(g,l){function k(c){if(c=localStorage.getItem("orion/messageBundle/"+c))if(c=JSON.parse(c),c._expires&&c._expires>(new Date).getTime())return delete c._expires,c;return null}var e={};return{getMessageBundle:function(c){function h(a){a?g(["i18n!"+c],function(a){if(a){var d=c;a._expires=(new Date).getTime()+9E5;localStorage.setItem("orion/messageBundle/"+d,JSON.stringify(a));delete a._expires}f.resolve(a)}):b(Error(c))}function b(a){f.reject(a)}
if(e[c])return e[c];var f=new l;e[c]=f;var d=k(c);if(d)return f.resolve(d),f;try{g([c],h,b)}catch(m){g(["orion/i18n!"+c],h,b)}return f},formatMessage:function(c){var e=arguments;return c.replace(/\$\{([^\}]+)\}/g,function(b,f){return e[(f<<0)+1]})}}});
define("orion/PageLinks","require orion/Deferred orion/PageUtil orion/URITemplate orion/i18nUtil orion/objects orion/URL-shim".split(" "),function(g,l,k,e,c,h,b){function f(){return g.toUrl?(new URL(g.toUrl("orion/../"),window.location.href)).href.slice(0,-1):(new URL("/",window.location.href)).href.slice(0,-1)}function d(a){var d={};a.getPropertyKeys().forEach(function(b){"objectClass"!==b&&"service.names"!==b&&"service.id"!==b&&"__plugin__"!==b&&(d[b]=a.getProperty(b))});return d}function m(a){return c.getMessageBundle(a.nls).then(function(d){a.textContent=
a.nameKey?d[a.nameKey]:a.name;return a},function(d){a.textContent=a.nameKey||a.name;return a})}function a(a,b){var c=a.getServiceReferences(b||"orion.page.link"),n=k.matchResourceParameters(window.location.href),h={OrionHome:f(),Location:n.resource},p=[];c.forEach(function(a){a=d(a);if(a.uriTemplate&&(a.nls||a.name)){var b=(new e(a.uriTemplate)).expand(h),b=k.validateURLScheme(b);a.href=b;a.nls?p.push(m(a)):(a.textContent=a.name,p.push((new l).resolve(a)))}});return l.all(p)}function n(a){var d=this.categories=
Object.create(null);a.forEach(function(a){d[a.id]=a})}function p(a){this.allPageLinks=a;this.allPageLinks.sort(t)}function t(a,d){var b=a.textContent&&a.textContent.toLowerCase(),f=d.textContent&&d.textContent.toLowerCase();return b<f?-1:b>f?1:0}var r;h.mixin(n.prototype,{getCategoryIDs:function(){return Object.keys(this.categories)},getCategory:function(a){return this.categories[a]||null}});h.mixin(p.prototype,{createLinkElements:function(){return this.allPageLinks.map(function(a){var d=a.href;a=
a.textContent;var b=document.createElement("a");b.href=d;b.target="_self";b.classList.add("targetSelector");b.textContent=a;return b})},getAllLinks:function(){return this.allPageLinks}});return{getCategoriesInfo:function(a){var b;return!r?(b=[],a.getServiceReferences("orion.page.link.category").forEach(function(a){a=d(a);if(a.id&&(a.name||a.nameKey))a.nls?b.push(m(a)):(a.textContent=a.name,b.push((new l).resolve(a)))}),l.all(b).then(function(a){return r=new n(a)})):(new l).resolve(r)},getPageLinksInfo:function(d,
b){return a(d,b).then(function(a){return new p(a)})},getOrionHome:f}});
define("orion/edit/nls/root/messages",{Editor:"Editor",switchEditor:"Switch Editor",Fetching:"Fetching: ${0}",confirmUnsavedChanges:"There are unsaved changes.  Do you still want to navigate away?",searchFiles:"Search Files...",searchTerm:"Enter search term:",unsavedChanges:"There are unsaved changes.",unsavedAutoSaveChanges:"Please stay on the page until Auto Save is complete.",Save:"Save",Saved:"Saved",Blame:"Blame",BlameTooltip:"Show blame annotations",saveOutOfSync:"Resource is out of sync with the server. Do you want to save it anyway?",
loadOutOfSync:"Resource is out of sync with the server. Do you want to load it anyway? This will overwrite your local changes.",ReadingMetadata:"Reading metadata of ${0}",ReadingMetadataError:"Can not get metadata of ${0}",Reading:"Reading ${0}",readonly:"Read Only.",saveFile:"Save this file",gotoLine:"Go to Line...",gotoLineTooltip:"Go to specified line number",gotoLinePrompt:"Go to line:",Undo:"Undo",Redo:"Redo",Find:"Find...",noResponse:"No response from server.  Check your internet connection and try again.",
savingFile:"Saving file ${0}",running:"Running ${0}","Saving...":"Saving...",View:"View",SidePanel:"Side Panel",SidePanelTooltip:"Choose what to show in the side panel.",Actions:"Actions",Navigator:"Navigator",FolderNavigator:"Folder Navigator",Project:"Project",New:"New",File:"File",Edit:"Edit",Tools:"Tools",Add:"Add",noActions:"There are no actions for the current selection.",NoFile:"Use the ${0} to create new files and folders. Click a file to start coding.",LocalEditorSettings:"Local Editor Settings",
NoProject:"${0} is not a project. To convert it to a project use ${1}.",NoProjects:"There are no projects in your workspace. Use the ${0} menu to create projects.",disconnected:"(disconnected)",ChooseFS:"Choose Filesystem",ChooseFSTooltip:"Choose the filesystem you want to view.",FSTitle:"${0} (${1})",Deploy:"Deploy","Deploy As":"Deploy As",Import:"Import",Export:"Export",OpenWith:"Open With",OpenRelated:"Open Related",Dependency:"Dependency",UnnamedCommand:"Unnamed"});
define("orion/edit/nls/messages",["orion/i18n!orion/edit/nls/messages","orion/edit/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/extensionCommands","require orion/Deferred orion/commands orion/regex orion/contentTypes orion/URITemplate orion/i18nUtil orion/URL-shim orion/PageLinks i18n!orion/edit/nls/messages".split(" "),function(g,l,k,e,c,h,b,f,d,m){function a(a){var d={};a.getPropertyKeys().forEach(function(b){d[b]=a.getProperty(b)});return d}var n={},p=d.getOrionHome();n._cloneItemWithoutChildren=function w(a){if(null===a||"object"!==typeof a)return a;var d=a.constructor(),b;for(b in a)"children"!==b&&"Children"!==
b&&(d[b]=w(a[b]));return d};n._getOpenWithNavCommandExtensions=function(a,d){function b(a,d){for(var q=a.getServiceReferences("orion.navigate.openWith"),f=[],c=[],m=0;m<q.length;m++){var n=q[m];if(n.getProperty("editor")===d.id){var A=n.getProperty("contentType");A instanceof Array?f=f.concat(A):f.push(A||"*/*");n=n.getProperty("excludedContentTypes");n instanceof Array?c=c.concat(n):null!==n&&"undefined"!==typeof n&&c.push(n)}}0===f.length&&(f=null);0===c.length&&(c=null);return{contentTypes:f,excludedContentTypes:c}}
for(var f=function(){for(var d=a.getServiceReferences("orion.edit.editor"),b=[],q=0;q<d.length;q++){var f=d[q],c=f.getProperty("id");b.push({id:c,"default":f.getProperty("default")||!1,name:f.getProperty("name"),nameKey:f.getProperty("nameKey"),nls:f.getProperty("nls"),uriTemplate:f.getProperty("orionTemplate")||f.getProperty("uriTemplate"),validationProperties:f.getProperty("validationProperties")||[]})}return b}(),c=[],m=0;m<f.length;m++){var q=f[m],n=b(a,q);c.push({properties:{name:q.name||q.id,
nameKey:q.nameKey,id:"eclipse.openWithCommand."+q.id,contentType:n.contentTypes,excludedContentTypes:n.excludedContentTypes,uriTemplate:q.uriTemplate,nls:q.nls,forceSingleItem:!0,isEditor:q["default"]?"default":"editor",validationProperties:q.validationProperties},service:{}})}return c};n._makeValidator=function(a,d,b,f){function m(a,d,b,f,q){var c=!1,n;if("!"===d.charAt(0))return"undefined"===typeof a[d.substring(1)];if("undefined"!==typeof a[d]){if("undefined"===typeof b)n=a[d],c=!0;else if("string"===
typeof b){if(!typeof("string"===a[d]))return!1;if(f.variableName){if(b=RegExp(b).exec(a[d]))c=b[0],n="before"===f.variableMatchPosition?a[d].substring(0,b.index):"after"===f.variableMatchPosition?a[d].substring(b.index+c.length):"only"===f.variableMatchPosition?c:a[d],c=!0}else return RegExp(b).test(a[d])}else a[d]===b&&(n=a[d],c=!0);d=f.variableName;f=f.replacements;if(c&&d&&(q[d]=n,q.itemCached=a,f)){if("string"!==typeof n)return window.console.log("Cannot replace "+d+", value is not a string: "+
n),c;for(a=0;a<f.length;a++){n=!1;if(f[a].pattern){b=f[a].pattern;var e=f[a].replacement||"";q[d]=q[d].replace(RegExp(b),e).replace(RegExp(b),e)}else n=!0;n&&window.console.log("Invalid replacements specified in validation property.  "+f[a])}}return c}return!1}function n(a,d,b,f){var q=b.match,c,e;if(0<=(c=d.indexOf("["))){if(0>(e=d.indexOf("]")))return!1;var h=d.substring(0,c),p;if(!(p=a[h])||!Array.isArray(p))return!1;c=d.substring(c+1,e);c=parseInt(c,10);if(isNaN(c))return!1;0>c&&(c+=p.length);
d=d.substring(e+1);d=h+":"+String(c)+d}return 0<=d.indexOf("|")?(c=d.substring(0,d.indexOf("|")),d=d.substring(d.indexOf("|")+1),n(a,c,b,f)?!0:n(a,d,b,f)):0<=d.indexOf(":")?(c=d.substring(0,d.indexOf(":")),d=d.substring(d.indexOf(":")+1),a[c]?n(a[c],d,b,f):!1):m(a,d,q,b,f)}function q(d,b,f){if(f.info.validationProperties)for(var q=0;q<f.info.validationProperties.length;q++){var m=f.info.validationProperties[q];if("undefined"!==typeof m.source){if(!n(d,m.source,m,f))return!1}else return window.console.log("Invalid validationProperties in "+
a.id+".  No source property specified."),!1}var q=!0,e=b?c.getFilenameContentType(d.Name,b):null,e=e||{id:"application/octet-stream"};f.info.excludedContentTypes&&b&&(q=f.info.excludedContentTypes.every(function(a){a=a.replace(/([*?])/g,".$1");return-1!==e.id.search(a)?!1:!0}));q&&f.info.contentType&&b&&(q=f.info.contentType.some(function(a){a=a.replace(/([*?])/g,".$1");return-1!==e.id.search(a)?!0:!1}));return q}return{info:a,validationFunction:function(a){"function"===typeof f&&(a=f.call(this,a));
if(a){if(Array.isArray(a)){if((this.info.forceSingleItem||this.info.uriTemplate)&&1!==a.length||1>a.length)return!1}else a=[a];for(var d=0;d<a.length;d++)if(!q(a[d],b,this))return!1;return!0}return!1},generatesURI:function(){return!!this.info.uriTemplate},getURI:function(a){if(this.info.uriTemplate){var d={},b;for(b in a)Object.prototype.hasOwnProperty.call(a,b)&&(d[b]=a[b]);if(this.info.validationProperties)for(b=0;b<this.info.validationProperties.length;b++){var f=this.info.validationProperties[b];
f.source&&f.variableName&&(this.itemCached===a&&this[f.variableName]||n(a,f.source,f,this),a[f.variableName]?window.console.log("Variable name "+f.variableName+" in the extension "+this.info.id+" conflicts with an existing property in the item metadata."):d[f.variableName]=this[f.variableName])}d.OrionHome=p;return(new h(this.info.uriTemplate)).expand(d)}return null}}};var t=m.UnnamedCommand;n._createCommandOptions=function(a,d,f,c,m,e){function q(b,q){var B=n._makeValidator(a,f,c,e);b.visibleWhen=
B.validationFunction.bind(B);if(m)if(B.generatesURI.bind(B)())b.hrefCallback=function(a){a=Array.isArray(a.items)?a.items[0]:a.items;return B.getURI.bind(B)(a)};else{var A=a;b.callback=function(a){var q;if(A.forceSingleItem)a=Array.isArray(a.items)?a.items[0]:a.items,q=n._cloneItemWithoutChildren(a);else if(Array.isArray(a.items)){q=[];for(var c=0;c<a.items.length;c++)q.push(n._cloneItemWithoutChildren(a.items[c]))}else q=n._cloneItemWithoutChildren(a.items);if(f)var m=f.getService("orion.page.progress");
d.run?m?m.progress(d.run(q),"Running command: "+b.name):d.run(q):f&&(m?m.progress(f.getService(d).run(q),"Running command: "+b.name):f.getService(d).run(q))}}q.resolve(b)}var A=new l;if(a.nls){var B=function(d){var b;d?(b=a.tooltipKey&&d[a.tooltipKey],d=a.nameKey&&d[a.nameKey]||a.name||t,b=b||a.tooltip||""):(d=a.name||a.nameKey||t,b=a.tooltip||a.tooltipKey||"");q({name:d,image:a.image,id:a.id||a.name,tooltip:b,isEditor:a.isEditor,showGlobally:a.showGlobally},A)};b.getMessageBundle(a.nls).then(B,B.bind(this,
null))}else q({name:a.name,image:a.image,id:a.id||a.name,tooltip:a.tooltip,isEditor:a.isEditor,showGlobally:a.showGlobally},A);return A};n.getOpenWithCommand=function(a,d,b){var f;a=b||n.getOpenWithCommands(a);for(b=0;b<a.length;b++)if(a[b].visibleWhen(d)){var c="default"===a[b].isEditor;if(!f||c)if(f=a[b],c)break}return f};n.getOpenWithCommands=function(a){var d=[],b;for(b in a._commandList){var f=a._commandList[b];f.isEditor&&d.push(f)}return d};var r;n.createAndPlaceFileCommandsExtension=function(a,
d,b,f,c,e){return n.createFileCommands(a,null,e?"all":void 0,!!e,d).then(function(a){c&&0<a.length&&(d.addCommandGroup(b,"eclipse.openWith",1E3,m.OpenWith,c,null,null,null,"dropdownSelection"),d.addCommandGroup(b,"eclipse.fileCommandExtensions",1E3,m.OpenRelated,c));a.forEach(function(a){var q=null;c&&(q=a.isEditor?c+"/eclipse.openWith":c+"/eclipse.fileCommandExtensions");d.registerCommandContribution(b,a.id,f,q)});return{}})};n.createFileCommands=function(a,d,b,f,c){b=void 0===b?"global":b;f=void 0===
f?!0:f;var m=[];n._cachedFileCommands||n._createCachedFileCommands(a);("all"===b||"global"===b)&&n._cachedFileCommands.forEach(function(a){var d=a.properties;("all"===b||d.forceSingleItem&&d.showGlobally)&&m.push(a)});return l.when(function(){var b=a.getService("orion.core.contentTypeRegistry")||d;return r||l.when(b.getContentTypes(),function(a){return r=a})}(),function(){f&&(n._cachedOpenWithExtensions||(n._cachedOpenWithExtensions=n._getOpenWithNavCommandExtensions(a,r)),m=m.concat(n._cachedOpenWithExtensions),
c._addedOpenWithCommands=f);var d=m.map(function(d){var b=d.properties;d=d.service;var f=c.findCommand(b.id||b.name);return f?(new l).resolve(f):n._createCommandOptions(b,d,a,r,!0).then(function(a){a=new k.Command(a);c.addCommand(a);return a})});return l.all(d,function(a){return{_error:a}}).then(function(a){return a})})};n._createCachedFileCommands=function(d){var b=d.getServiceReferences("orion.navigate.command");n._cachedFileCommands=[];for(var f=0;f<b.length;f++)if("orion.navigateFromMetadata"!==
b[f].getProperty("id")){var c=d.getService(b[f]),m=a(b[f]);n._cachedFileCommands.push({properties:m,service:c})}};n.getFileCommandIds=function(){var a=[];if(n._cachedFileCommands)n._cachedFileCommands.length&&(a=n._cachedFileCommands.map(function(a){return a.properties.id}));else throw"extensionCommandUtils._cachedFileCommands is not initialized";return a};n.createOpenWithCommands=function(a,d,b){return b&&b._addedOpenWithCommands?(new l).resolve(n.getOpenWithCommands(b)):n.createFileCommands(a,d,
"none",!0,b)};return n});
define("orion/breadcrumbs",["require","orion/webui/littlelib"],function(g,l){function k(e){this._init(e)}k.prototype={_init:function(e){var c=l.node(e.container);if(!c)throw"no parent container";this._container=c;c.classList.remove("currentLocation");this._id=e.id||"eclipse.breadcrumbs";this._resource=e.resource||null;this._rootSegmentName=e.rootSegmentName;this._workspaceRootSegmentName=e.workspaceRootSegmentName;this._workspaceRootURL=e.workspaceRootURL;this._makeHref=e.makeHref;this._makeFinalHref=
e.makeFinalHref;this._maxLength=e.maxLength;this.path="";this.measure();this.render()},getNavigatorWorkspaceRootSegment:function(){if(this._workspaceRootSegmentName){var e;if(this._resource&&this._resource.Parents&&!this._resource.skip){e=document.createElement("a");var c=this._workspaceRootURL?this._workspaceRootURL:"";this._makeHref?this._makeHref(e,c):e.href=g.toUrl("edit/edit.html")+"#"+c}else e=document.createElement("span");l.empty(e);e.appendChild(document.createTextNode(this._workspaceRootSegmentName));
return e}return null},MAX_LENGTH:500,INCLUDE_FIRST_SECTION:!0,segments:[],buildSegment:function(e){var c=document.createElement("a");c.classList.add("breadcrumb");c.appendChild(document.createTextNode(e));return c},addSegmentHref:function(e,c){this._makeHref?this._makeHref(e,c.Location,c):e.href=g.toUrl("edit/edit.html")+"#"+c.ChildrenLocation},buildSegments:function(e,c){if(this._resource.Parents){var h=this._resource.Parents.slice(0),b,f;h&&(h=h.slice(0),"reverse"===c&&(h=h.reverse().slice(0)),
h.forEach(function(d){d.skip||(e?(f=e,e=null):f=d.Name,b=this.buildSegment(f),this.path+=d.Name,this.addSegmentHref(b,d),b.include=!1,this.segments.push(b))}.bind(this)))}},addDivider:function(){var e=document.createElement("span");e.appendChild(document.createTextNode(" / "));this.path+="/";e.classList.add("breadcrumbSeparator");this.append(e)},refresh:function(){(this.crumbs=l.node(this._id))?l.empty(this.crumbs):(this.crumbs=document.createElement("span"),this.crumbs.id=this._id,this._container.appendChild(this.crumbs),
this.dirty=document.createElement("span"),this.dirty.id="dirty",this.dirty.className="modifiedFileMarker",this._container.appendChild(this.dirty));this.crumbs.style.width="auto";this.crumbs.style.visibility="visible";this.crumbs.parentNode.className="currentLocation";this.crumbs.parentNode.style.width="auto"},append:function(e){this.crumbs.appendChild(e)},addTitle:function(e,c){var h=c||document.title;0===this.crumbs.childNodes.length&&(e=document.createElement("span"),e.appendChild(document.createTextNode(h)),
e.classList.add("breadcrumb"),e.classList.add("currentLocation"),this.append(e))},finalSegment:function(e,c){if(!this._resource.skip){var h;h=c?c:this._resource.Name;this._makeFinalHref?(e=this.buildSegment(h),this.addSegmentHref(e,this._resource)):(e=document.createElement("span"),e.appendChild(document.createTextNode(h)));e.classList.add("currentLocation");this.path+=this._resource.Name;this.append(e)}},firstSegment:function(e){e&&(this.append(e),this._resource&&this._resource.Parents&&!this._resource.skip?
(e.classList.add("breadcrumb"),this.addDivider()):(this._resource.skip||(e.href=""),e.classList.add("currentLocation")))},drawSegments:function(){this._resource.Parents&&this.segments.slice(0).forEach(function(e){!0===e.include&&(this.append(e),this.addDivider())}.bind(this))},measureSegments:function(){this.INCLUDE_FIRST_SECTION=!0;if(this._resource.Parents){var e=this.segments.slice(0).reverse();e.forEach(function(c){this.append(c);this.addDivider();this.crumbs.offsetWidth<this.MAX_LENGTH?c.include=
!0:this.INCLUDE_FIRST_SECTION=!1}.bind(this));this.segments=e.reverse()}},measure:function(){var e=this._container;e.style.width="auto";this.MAX_LENGTH=this._maxLength?this._maxLength:e.offsetWidth;this.refresh();this.segments=[];this.crumbs.style.visibility="hidden";var e=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;c?this.addTitle(e,c):(this.finalSegment(e,c),this._resource&&this._resource.Parents&&(this.buildSegments(c,"reverse"),this.measureSegments(),this.firstSegment(e)),
this.crumbs.offsetWidth>=this.MAX_LENGTH&&(this.INCLUDE_FIRST_SECTION=!1))},render:function(){this.refresh();var e=this.getNavigatorWorkspaceRootSegment(),c=this._rootSegmentName;c?this.addTitle(e,c):(!0===this.INCLUDE_FIRST_SECTION&&this.firstSegment(e),this._resource&&this._resource.Parents&&(this.drawSegments(),this.finalSegment(e,c)));this.crumbs.parentNode.style.width=this.crumbs.offsetWidth+20+"px"}};k.prototype.constructor=k;return{BreadCrumbs:k}});
define("orion/webui/splitter",["require","orion/EventTarget","orion/webui/littlelib"],function(g,l,k){function e(c){l.attach(this);this._init(c)}e.prototype={_init:function(c){this._tracking=null;this._animationDelay=501;this._closeReversely=c.closeReversely;this.$node=k.node(c.node);if(!this.$node)throw"no dom node for splitter found";this.$sideNode=k.node(c.sidePanel);if(!this.$sideNode)throw"no dom node for side panel found";this.$mainNode=k.node(c.mainPanel);if(!this.$mainNode)throw"no dom node for main panel found";
this._vertical=c.vertical;this._prefix="/orion/splitter/"+(this.$node.id||document.body.id||"");c.toggle&&(this._thumb=document.createElement("div"),this.$node.appendChild(this._thumb),this._thumb.classList.add("splitThumb"),this._thumb.classList.add(this._vertical?"splitVerticalThumbLayout":"splitThumbLayout"));this._closeByDefault="closed"===this.$node.getAttribute("data-initial-state");"undefined"!==typeof c.closeByDefault&&(this._closeByDefault=c.closeByDefault);this._initializeFromStoredSettings();
this._closed?(this._closed=!1,this._thumbDown(!0,!0)):this._adjustToSplitPosition();this.$node.style.visibility="visible";this.$mainNode.style.display="block";this.$sideNode.style.display="block";this.$node.addEventListener("mousedown",this._mouseDown.bind(this),!1);window.addEventListener("mouseup",this._mouseUp.bind(this),!1);window.addEventListener("resize",this._resize.bind(this),!1)},isClosed:function(){return this._closed},toggleSidePanel:function(){this._thumbDown()},openSidePanel:function(){this._closed||
this._thumbDown()},addResizeListener:function(c){this.addEventListener("resize",function(e){c(e.node)})},_initializeFromStoredSettings:function(){var c=localStorage.getItem(this._prefix+"/toggleState");this._closed="string"===typeof c?"closed"===c:this._closeByDefault;var c=k.bounds(this.$node.parentNode),e=k.bounds(this.$node),b;this._vertical?(b=localStorage.getItem(this._prefix+"/yPosition"))?(this._splitTop=parseInt(b,10),this._splitTop>c.top+c.height-e.height&&(this._splitTop=c.top+c.height/
2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitTop=0):(b=localStorage.getItem(this._prefix+"/xPosition"))?(this._splitLeft=parseInt(b,10),this._splitLeft>c.left+c.width-e.width&&(this._splitLeft=c.left+c.width/2)):this._closeByDefault&&(this._initialSplit=this._getSplitPosition(),this._splitLeft=0)},_getSplitPosition:function(){var c=k.bounds(this.$node),e=k.bounds(this.$node.parentNode);return this.vertical?c.top-e.top:c.left-e.left},_adjustToSplitPosition:function(c){var e=
k.bounds(this.$node),b=k.bounds(this.$node.parentNode);if(this._vertical){this._splitHeight=e.height;if(c||!this._splitTop)this._splitTop=e.top,localStorage.setItem(this._prefix+"/yPosition",this._splitTop);c=this._splitTop;"relative"===this.$node.parentNode.style.position&&(c=this._splitTop-b.top);this.$sideNode.style.height=c+"px";this.$sideNode.style.display="block";this.$node.style.top=c+"px"}else{this._splitWidth=e.width;if(c||!this._splitLeft)this._splitLeft=e.left,localStorage.setItem(this._prefix+
"/xPosition",this._splitLeft);c=this._splitLeft;"relative"===this.$node.parentNode.style.position&&(c=this._splitLeft-b.left);this.$sideNode.style.width=c+"px";this.$sideNode.style.display="block";this.$node.style.left=c+"px"}this._resize()},_resize:function(c,e,b){c=c||0;var f=k.bounds(this.$node.parentNode),d=k.bounds(this.$node);this._vertical?(void 0===b&&(b=d.top-f.top),b+=d.height,this.$mainNode.style.top=b+"px"):(void 0===e&&(e=d.left-f.left),e+=d.width,this.$mainNode.style.left=e+"px");var m=
this;window.setTimeout(function(){m._notifyResizeListeners(m.$mainNode);m._notifyResizeListeners(m.$sideNode)},c)},_notifyResizeListeners:function(c){this.dispatchEvent({type:"resize",node:c})},_notifyToggleListeners:function(){this.dispatchEvent({type:"toggle",closed:this._closed})},_thumbDown:function(c,e){c||this._addAnimation();var b=this._splitTop,f=this._splitLeft;if(this._closed)this._closed=!1,!this._splitLeft&&!this._splitTop&&"number"===typeof this._initialSplit&&(b=f=this._initialSplit);
else if(this._closed=!0,this._closeReversely){var d=k.bounds(this.$node.parentNode),m=k.bounds(this.$node);this._vertical?b=d.height-m.height:f=d.width-m.width}else b=f=0;this._vertical?(this.$sideNode.style.height=b+"px",this.$node.style.top=b+"px"):(this.$sideNode.style.width=f+"px",this.$node.style.left=f+"px");this._resize(this._animationDelay,f,b);c||this._removeAnimation();e||localStorage.setItem(this._prefix+"/toggleState",this._closed?"closed":null);var a=this;window.setTimeout(function(){a._notifyToggleListeners()},
this._animationDelay)},_removeAnimation:function(){var c=this;window.setTimeout(function(){c.$sideNode.classList.remove(c._vertical?"sidePanelVerticalLayoutAnimation":"sidePanelLayoutAnimation");c.$mainNode.classList.remove(c._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");c.$node.classList.remove(c._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},this._animationDelay)},_addAnimation:function(){this.$sideNode.classList.add(this._vertical?"sidePanelVerticalLayoutAnimation":
"sidePanelLayoutAnimation");this.$mainNode.classList.add(this._vertical?"mainPanelVerticalLayoutAnimation":"mainPanelLayoutAnimation");this.$node.classList.add(this._vertical?"splitVerticalLayoutAnimation":"splitLayoutAnimation")},_mouseDown:function(c){if(c.target===this._thumb)return k.stop(c),this._thumbDown();this._tracking||(this.$node.classList.add("splitTracking"),this.$mainNode.classList.add("panelTracking"),this.$sideNode.classList.add("panelTracking"),this._tracking=this._mouseMove.bind(this),
window.addEventListener("mousemove",this._tracking),k.setFramesEnabled(!1),k.stop(c))},_mouseMove:function(c){if(this._tracking){var e=k.bounds(this.$node.parentNode);if(this._vertical){this._splitTop=c.clientY;this._splitTop<e.top+5?this._splitTop=e.top+5:this._splitTop>e.top+e.height-5&&(this._splitTop=e.top+e.height-5);var b=this._splitTop,b=this._splitTop-e.top;this.$node.style.top=b+"px"}else this._splitLeft=c.clientX,this._splitLeft<e.left+5?this._splitLeft=e.left+5:this._splitLeft>e.left+e.width-
5&&(this._splitLeft=e.left+e.width-5),b=this._splitLeft-2*e.left,this.$node.style.left=b+"px";this._adjustToSplitPosition(!0);k.stop(c)}},_mouseUp:function(c){this._tracking&&(k.setFramesEnabled(!0),window.removeEventListener("mousemove",this._tracking),this._tracking=null,this.$node.classList.remove("splitTracking"),this.$mainNode.classList.remove("panelTracking"),this.$sideNode.classList.remove("panelTracking"),k.stop(c))}};e.prototype.constructor=e;return{Splitter:e}});
define("orion/keyAssist",["i18n!orion/nls/messages","orion/webui/littlelib","orion/util"],function(g,l,k){function e(c){this.commandRegistry=c.commandRegistry;this.create();this._filterString="";this._providers=[]}e.prototype={addProvider:function(c){this._providers.push(c)},create:function(){var c=this._keyAssistDiv=document.createElement("div");c.id="keyAssist";c.style.display="none";c.classList.add("keyAssistFloat");c.setAttribute("role","menu");var e=this._keyAssistInput=document.createElement("input");
e.classList.add("keyAssistInput");e.type="text";e.placeholder=g["Filter bindings"];c.appendChild(e);var b=this._keyAssistContents=document.createElement("div");b.classList.add("keyAssistContents");if(k.isIOS||k.isAndroid)b.style.overflowY="auto";c.appendChild(b);var f=this._keyAssistTable=document.createElement("table");f.tabIndex=0;f.classList.add("keyAssistList");b.appendChild(f);document.body.appendChild(c);e.addEventListener("keydown",function(d){this._keyDown(d)}.bind(this));f.addEventListener("keydown",
function(d){this._keyDown(d)}.bind(this));e.addEventListener("input",function(d){this.filterChanged()}.bind(this));b.addEventListener(k.isFirefox?"DOMMouseScroll":"mousewheel",function(d){this._scrollWheel(d)}.bind(this));document.addEventListener("keydown",function(d){d.keyCode===l.KEY.ESCAPE&&this.hide()}.bind(this));l.addAutoDismiss([c],function(){this.hide()}.bind(this))},createContents:function(){l.empty(this._keyAssistTable);this._selectedIndex=-1;this._selectedRow=null;for(var c=this._idCount=
this._keyAssistContents.scrollTop=0;c<this._providers.length;c++)this._providers[c].showKeyBindings(this);this.createHeader(g.Global);this.commandRegistry.showKeyBindings(this)},createItem:function(c,e,b){if(this._filterString){var f=this._filterString.toLowerCase(),d;f!==this._filterString?(f=this._filterString,d=function(a){return a}):d=function(a){return a.toLowerCase()};if(-1===d(e).indexOf(f)&&-1===d(c).indexOf(f)&&-1===d(this._lastHeader).indexOf(f))return}var m=this._keyAssistTable.insertRow(-1);
m.id="keyAssist-keyBinding-"+this._idCount++;m.setAttribute("role","menuitem");m._execute=b;m.classList.add("keyAssistItem");m.addEventListener("click",function(a){this._selectedRow=m;this.execute();a.preventDefault()}.bind(this));b=m.insertCell(-1);b.classList.add("keyAssistName");b.appendChild(document.createTextNode(e));b=m.insertCell(-1);b.classList.add("keyAssistAccel");b.appendChild(document.createTextNode(c))},createHeader:function(c){this._lastHeader=c;var e=this._keyAssistTable.insertRow(-1);
e.classList.add("keyAssistSection");var e=e.insertCell(-1),b=document.createElement("h2");b.appendChild(document.createTextNode(c));e.appendChild(b)},execute:function(){window.setTimeout(function(){this.hide();var c=this._selectedRow;this._selectedRow=null;c&&c._execute&&c._execute()}.bind(this),0)},filterChanged:function(){this._timeout&&window.clearTimeout(this._timeout);this._timeout=window.setTimeout(function(){this._timeout=null;var c=this._keyAssistInput.value;this._filterString!==c&&(this._filterString=
c,this.createContents())}.bind(this),100)},hide:function(){if(this.isVisible()){var c=document.activeElement,e=this._keyAssistDiv,c=e===c||0!==(e.compareDocumentPosition(c)&16);e.style.display="none";c&&1!==document.compareDocumentPosition(this._previousActiveElement)&&this._previousActiveElement.focus();this._previousActiveElement=null}},isVisible:function(){return"block"===this._keyAssistDiv.style.display},removeProvider:function(c){c=this._providers.indexOf(c);-1!==c&&this._providers.splice(c,
1)},select:function(c){var e=this._keyAssistTable.querySelectorAll(".keyAssistItem");if(0===e.length)this._selectedIndex=-1;else{var b=this._selectedIndex,b=(b+(c?1:-1))%e.length;0>b&&(b=e.length-1);-1!==this._selectedIndex&&(c=e[this._selectedIndex],c.classList.remove("selected"),this._selectedRow=null);this._selectedIndex=b;if(-1!==this._selectedIndex){this._selectedRow=c=e[this._selectedIndex];c.classList.add("selected");this._keyAssistTable.setAttribute("aria-activedescendant",c.id);this._keyAssistTable.focus();
var e=c.getBoundingClientRect(),f=this._keyAssistContents,d=f.getBoundingClientRect();c.offsetTop<f.scrollTop?0===b?f.scrollTop=0:c.scrollIntoView(!0):e.bottom>d.bottom&&c.scrollIntoView(!1)}}},show:function(){this.isVisible()||(this._previousActiveElement=document.activeElement,this.createContents(),this._keyAssistContents.style.height=Math.floor(0.75*this._keyAssistDiv.parentNode.clientHeight)+"px",this._keyAssistDiv.style.display="block",this._keyAssistInput.value=this._filterString,this._keyAssistInput.focus(),
this._keyAssistInput.select())},_keyDown:function(c){if(40===c.keyCode)this.select(!0);else if(38===c.keyCode)this.select(!1);else if(13===c.keyCode)this.execute();else return;c.preventDefault()},_scrollWheel:function(c){var e=0,e=k.isIE||k.isOpera?-c.wheelDelta:k.isFirefox?40*c.detail:-c.wheelDeltaY,b=this._keyAssistContents,f=b.scrollTop;b.scrollTop+=e;if(f!==b.scrollTop)return c.preventDefault&&c.preventDefault(),!1}};return{KeyAssistPanel:e}});
define("orion/widgets/themes/ThemePreferences",[],function(){function g(g,k){this._preferences=g;this._themeData=k;var e=k.getThemeStorageInfo();this._themeVersion=e.version;var c=g.listenForChangedSettings(e.storage,2,function(e){e.key===c&&this.apply()}.bind(this))}g.prototype={_initialize:function(g,k,e){var c,h;void 0===this._themeVersion||e.get("version")===this._themeVersion?(c=e.get(g.styleset),(h=e.get("selected"))&&(h=JSON.parse(h))):h=c=null;c||(c=k.getStyles(),e.put(g.styleset,JSON.stringify(c)));
if(!h||void 0===h[g.selectedKey])h=h||{},h[g.selectedKey]=g.defaultTheme,e.put("selected",JSON.stringify(h));e.put("version",this._themeVersion)},apply:function(){this.setTheme()},getTheme:function(g){var k=this._themeData,e=k.getThemeStorageInfo();this._preferences.getPreferences(e.storage,2).then(function(c){this._initialize(e,k,c);var h=JSON.parse(c.get("selected"));c=JSON.parse(c.get(e.styleset));var b;if(c)for(var f=0;f<c.length;f++)if(c[f].name===h[e.selectedKey]){b=c[f];break}g({style:b,styles:c})}.bind(this))},
setTheme:function(g,k){var e=this._themeData,c=e.getThemeStorageInfo();this._preferences.getPreferences(c.storage,2).then(function(h){this._initialize(c,e,h);var b=JSON.parse(h.get("selected"));g||(g=b[c.selectedKey]);b[c.selectedKey]=g;h.put("selected",JSON.stringify(b));k?h.put(c.styleset,JSON.stringify(k)):k=JSON.parse(h.get(c.styleset));for(var f=0;f<k.length;f++)if(k[f].name===b[c.selectedKey]){e.processSettings(k[f]);break}h.put("version",this._themeVersion)}.bind(this))},setFontSize:function(g){var k=
this._themeData,e=k.getThemeStorageInfo();this._preferences.getPreferences(e.storage,2).then(function(c){this._initialize(e,k,c);var h=JSON.parse(c.get("selected")),b=JSON.parse(c.get(e.styleset)),f;if(b)for(var d=0;d<b.length;d++)b[d].fontSize=g,b[d].name===h[e.selectedKey]&&(f=b[d]);c.put(e.styleset,JSON.stringify(b));k.processSettings(f)}.bind(this))}};return{ThemePreferences:g}});
define("orion/settings/nls/root/messages",{"Plugin Description":"Plugin Description",Create:"Create","Loading...":"Loading...","Label:":"Label:",Title:"Title",Plugins:"Plugins","User Profile":"User Profile",Git:"Git","Git Settings":"Git Settings",General:"General",Navigation:"Navigation",Links:"Links","Open in same tab":"Open in same tab","Open in new tab":"Open in new tab",Font:"Font",Family:"Family","Sans Serif":"Sans Serif",Serif:"Serif",Size:"Size","8pt":"8pt","9pt":"9pt","10pt":"10pt","12pt":"12pt",
Color:"Color",Background:"Background",Strings:"Strings","String Types":"String Types",blue:"blue",Weight:"Weight",Normal:"Normal",Bold:"Bold",Comments:"Comments","Comment Types":"Comment Types",green:"green",Keywords:"Keywords","Keyword Types":"Keyword Types",darkred:"darkred",Categories:"Categories",Username:"Username","Full Name":"Full Name","Email Address":"Email Address","Email Confirmed":"Email Confirmed",Account:"Account","Current Password":"Current Password","New Password":"New Password","Verify Password":"Verify Password",
Password:"Password",OpenId:"OpenId",AOL:"AOL",Yahoo:"Yahoo",Google:"Google",Unlink:"Unlink",Link:"Link",Unlinked:"Unlinked",Linked:"Linked","Linked Accounts":"Linked Accounts","Git Email Address":"Git Email Address","Git Username":"Git Username","Git Credentials Storage":"Git Credentials Storage",Update:"Update","Update Profile Settings":"Update Profile Settings","Update Git User Settings":"Update Git User Settings","Update Git Credentials":"Update Git Credentials","User profile data successfully updated.":"User profile data successfully updated.",
"Git user data successfully updated.":"Git user data successfully updated.","Git Credentials successfully updated.":"Git Credentials successfully updated.","Edit Plugin JavaScript":"Edit Plugin JavaScript","Install Plugin":"Install Plugin","Plugin Name:":"Plugin Name:","Author Name:":"Author Name:","Licence:":"Licence:","Description:":"Description:","A plugin for Eclipse Orion":"A plugin for Eclipse Orion","Plugin Link":"Plugin Link",Install:"Install","Install a plugin by specifying its URL":"Install a plugin by specifying its URL",
"Plugin URL:":"Plugin URL:",Disable:"Disable",DisableTooltip:"Disable the plugin",Enable:"Enable",EnableTooltip:"Enable the plugin","Reload all":"Reload all","Reload all installed plugins":"Reload all installed plugins","Create a new Orion Plugin":"Create a new Orion Plugin","Find More Orion Plugins":"Find More Orion Plugins","Get Plugins":"Get Plugins",Reload:"Reload","Reload the plugin":"Reload the plugin",Delete:"Delete","Delete this plugin from the configuration":"Delete this plugin from the configuration",
"Type a plugin url here ...":"Type a plugin url here ...","Installed ":"Installed ","Installing ":"Installing ","Already installed":"Already installed"," plugin":" plugin","Reloaded ":"Reloaded ","Uninstalled ":"Uninstalled ","Are you sure you want to uninstall '":"Are you sure you want to uninstall '",Services:"Services",Value:"Value","JavaScript Object":"JavaScript Object","click here, then check javascript console to drill down":"click here, then check javascript console to drill down",Item:"Item",
"Git Config":"Git Config","Clear Git Credentials":"Clear Git Credentials","Enable Storage":"Enable Storage","Please be aware that your credentials will be stored persistently in the browser.":"Please be aware that your credentials will be stored persistently in the browser.","Do you wish to enable the Key Storage?":"Do you wish to enable the Key Storage?",general:"General",validation:"Validation","Deleted git credentials for ${0}":"Deleted git credentials for ${0}",Editor:"Editor",editorSettings:"Settings",
EditorThemes:"Themes",Import:"Import","Import a theme":"Import a theme",Export:"Export","Export a theme":"Export a theme","Theme name:":"Theme name:",yourTheme:"yourTheme",fileManagement:"File Management",typing:"Typing",autoSave:"Auto Save",autoSaveTimeout:"Save interval (ms)",autoLoad:"Auto Load",saveDiffs:"Save file as diffs",trimTrailingWhiteSpace:"Trim Trailing Whitespace on Save",Restore:"Restore Defaults",Default:"Default",keys:"Keys",tabs:"Tabs",tabSize:"Tab Size",expandTab:"Insert spaces for tabs",
smoothScrolling:"Smooth Scrolling",scrollAnimation:"Scrolling Animation",scrollAnimationTimeout:"Scrolling Duration (ms)",keyBindings:"Key Bindings",rulers:"Rulers",annotationRuler:"Show Annotation Ruler",lineNumberRuler:"Show Line Number Ruler",foldingRuler:"Show Folding Ruler",overviewRuler:"Show Overview Ruler",whitespaces:"White Spaces",wrapping:"Wrapping",wordWrap:"Word Wrap",showMargin:"Show Margin",marginOffset:"Margin Column",showTabs:"Show Tabs",showSpaces:"Show Spaces",autoSaveTimeoutInvalid:"Invalid save interval.",
scrollAnimationTimeoutInvalid:"Invalid scrolling duration.",tabSizeInvalid:"Invalid tab size.",localSettingsTooltip:"Toggle whether this setting is shown in the local editor settings drop down.",editorSettingsInfo:"Use the ${0} and ${1} to toggle whether a given setting is shown in the local editor settings drop down ${2}.",autoPairParentheses:"Autopair (Parentheses)",autoPairBraces:"Autopair {Braces}",autoPairSquareBrackets:"Autopair [Square] Brackets",autoPairAngleBrackets:"Autopair \x3cAngle\x3e Brackets",
autoPairQuotations:'Autopair "Strings"',autoCompleteComments:"Autocomplete /** Block Comments */",smartIndentation:"Smart Indentation",sourceControl:"Source Control",showBlame:"Show Blame",languageTools:"Language Tools",showOccurrences:"Show Occurrences",contentAssistAutoTrigger:"Show Content Assist automatically","Editor preferences updated":"Editor preferences updated","Editor defaults restored":"Editor defaults restored",Theme:"Theme","Font Size":"Font Size","New Theme Name:":"New Theme Name:",
"Font Size:":"Font Size:","UI Theme":"UI Theme","Navigation Bar":"Navigation Bar","Navigation Text":"Navigation Text","Search Box":"Search Box","Tool Panel":"Tool Panel","Selection Bar":"Selection Bar",Location:"Location",Content:"Content","Main Panel":"Main Panel",Button:"Button","Button Text":"Button Text","Section Text":"Section Text","Side Panel":"Side Panel","Line Color":"Line Color","Line Numbers":"Line Numbers",Foreground:"Foreground","Current Line":"Current Line","HTML Attribute":"HTML Attribute",
"Overview Ruler":"Overview Ruler","HTML Tag":"HTML Tag","Annotation Ruler":"Annotation Ruler","Show Guide":"Show Guide","Check Guide":"Check Guide",Cancel:"Cancel","Revert Theme":"Revert Theme","Update Theme":"Update Theme","Theme:":"Theme:",clickDiagram:"Click diagram to style.",clickUpdate:"Click Update button to save preview.","CSS Class Name":"CSS Class Name","CSS Attribute":"CSS Attribute","CSS Value":"CSS Value","CSS Text":"CSS Text","COLOR:":"Color:","NEW COLOR:":"New Color:",Ok:"Ok","OR HEX:":"Or Hex: "});
define("orion/settings/nls/messages",["orion/i18n!orion/settings/nls/messages","orion/settings/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/editor/eventTarget",[],function(){function g(){}g.addMixin=function(l){var k=g.prototype,e;for(e in k)k.hasOwnProperty(e)&&(l[e]=k[e])};g.prototype={addEventListener:function(g,k,e){this._eventTypes||(this._eventTypes={});var c=this._eventTypes[g];c||(c=this._eventTypes[g]={level:0,listeners:[]});c.listeners.push({listener:k,useCapture:e})},dispatchEvent:function(g){var k=g.type;this._dispatchEvent("pre"+k,g);this._dispatchEvent(k,g);this._dispatchEvent("post"+k,g)},_dispatchEvent:function(g,
k){var e=this._eventTypes?this._eventTypes[g]:null;if(e){var c=e.listeners;try{if(e.level++,c)for(var h=0,b=c.length;h<b;h++)if(c[h]){var f=c[h].listener;"function"===typeof f?f.call(this,k):f.handleEvent&&"function"===typeof f.handleEvent&&f.handleEvent(k)}}finally{if(e.level--,e.compact&&0===e.level){for(h=c.length-1;0<=h;h--)c[h]||c.splice(h,1);0===c.length&&delete this._eventTypes[g];e.compact=!1}}}},isListening:function(g){return!this._eventTypes?!1:void 0!==this._eventTypes[g]},removeEventListener:function(g,
k,e){if(this._eventTypes){var c=this._eventTypes[g];if(c){for(var h=c.listeners,b=0,f=h.length;b<f;b++){var d=h[b];if(d&&d.listener===k&&d.useCapture===e){0!==c.level?(h[b]=null,c.compact=!0):h.splice(b,1);break}}0===h.length&&delete this._eventTypes[g]}}}};return{EventTarget:g}});
define("orion/editor/textTheme",["require","orion/editor/eventTarget","orion/util"],function(g,l,k){function e(c){c=c||{};this._document=c.document||document}var c={};e.getTheme=function(h){h=h||"default";var b=c[h];b||(b=c[h]=new e);return b};e.prototype={getThemeClass:function(){return this._themeClass},setThemeClass:function(c,b){var f=this,d=f._themeClass;f._themeClass=c;this._load(c,b,function(){f.onThemeChanged({type:"ThemeChanged",oldValue:d,newValue:f.getThemeClass()})})},onThemeChanged:function(c){return this.dispatchEvent(c)},
buildStyleSheet:function(c,b){function f(b,a,f){a&&(d.push("."+c+" ."+b+" {"),d.push("\t"+(f?"background-color":"color")+": "+a+";"),d.push("}"))}var d=[];d.push("");d.push("."+c+" {");b.fontFamily&&d.push("\tfont-family: "+b.fontFamily+";");b.fontSize&&d.push("\tfont-size: "+b.fontSize+";");b.fontSize&&d.push("\tcolor: "+b.text+";");d.push("}");d.push("."+c+".textview {");b.background&&d.push("\tbackground-color: "+b.background+";");d.push("}");f("ruler.annotations",b.annotationRuler,!0);f("ruler.lines",
b.annotationRuler,!0);f("ruler.folding",b.annotationRuler,!0);f("ruler.overview",b.overviewRuler,!0);f("rulerLines",b.lineNumber,!1);f("rulerLines.even",b.lineNumberEven,!1);f("rulerLines.odd",b.lineNumberOdd,!1);f("annotationLine.currentLine",b.currentLine,!0);f("entity-name-tag",b.keyword,!1);f("entity-other-attribute-name",b.attribute,!1);f("string-quoted",b.string,!1);f("meta.annotation.currentLine",b.currentLine,!0);f("keyword",b.keyword,!1);f("string",b.string,!1);f("comment",b.comment,!1);
f("comment.block.documentation",b.comment,!1);f("keyword.other.documentation.markup",b.comment,!1);return d.join("\n")},_createStyle:function(c,b,f,d){var m=this._document;c="orion-theme-"+c;var a=m.getElementById(c);if(a){if(d||a.firstChild.data===b)return;a.removeChild(a.firstChild);a.appendChild(m.createTextNode(b))}else d?(a=k.createElement(m,"link"),a.rel="stylesheet",a.type="text/css",a.href=b,a.addEventListener("load",function(){f()})):(a=k.createElement(m,"style"),a.appendChild(m.createTextNode(b))),
a.id=c,(m.getElementsByTagName("head")[0]||m.documentElement).appendChild(a);d||f()},_load:function(c,b,f){if(c)if("string"===typeof b)this._createStyle(c,b,f);else if(b=b.href,".css"!==b.substring(b.length-4)&&(b+=".css"),/^\//.test(b)||/[a-zA-Z0-9]+:\/\//i.test(b)||!g.toUrl)this._createStyle(c,b,f,!0);else{var d=this;g(["text!"+b],function(b){d._createStyle(c,b,f,!1)})}else f()}};l.EventTarget.addMixin(e.prototype);return{TextTheme:e}});
define("orion/widgets/themes/ThemeClass",[],function(){function g(g){this.attributes=[];this.element=document.createElement("div");this.style=this.element.style;this.className=g;this.classString="."+g+"{ "}g.prototype.className=null;g.prototype.classString=void 0;g.prototype.style=void 0;g.prototype.closeString=" }\n";g.prototype.toString=function(){return this.classString=this.classString+this.style.cssText+this.closeString};return{ThemeClass:g}});
define("orion/widgets/themes/container/ThemeSheetWriter",["orion/widgets/themes/ThemeClass"],function(g){function l(){}l.prototype.navbar="white";l.prototype.button="#777777";l.prototype.location="#EFEFEF";l.prototype.selection="#cedce7";l.prototype.sidepanel="#F7F7F7";l.prototype.mainpanel="white";l.prototype.navtext="#bfbfbf";l.prototype.content="#3087B3";l.prototype.search="#444";l.prototype.toolpanel="white";l.prototype.writeNavigationStyle=function(){var k="",e=[],c=new g.ThemeClass("orionPage");
c.style.backgroundColor="#fdfdfd";c.style.width="100%";c.style.height="100%";e.push(c);c=new g.ThemeClass("topRowBanner");c.style.margin="0";c.style.border="0";c.style.backgroundColor=this.navbar;c.style.height="16px";c.style.padding="10px";c.style.paddingLeft="6px";c.style.paddingRight="2px";c.style.borderBottom="none";c.style.boxShadow="0 2px 2px 0 rgba(0, 0, 0, 0.1),0 1px 0 0 rgba(0, 0, 0, 0.1)";c.style.zIndex="100";e.push(c);c=new g.ThemeClass("a");c.style.textDecoration="none";c.style.color=
this.content;e.push(c);c=new g.ThemeClass("navlink");c.style.display="inline-block";c.style.padding="2px";c.style.color=this.content;c.style.verticalAlign="bottom";e.push(c);c=new g.ThemeClass("primaryNav");c.style.color=this.navtext;c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.paddingTop="0";c.style.verticalAlign="baseline";e.push(c);c=new g.ThemeClass("primaryNav a");c.style.fontSize="8pt";c.style.color=this.navtext;c.style.marginRight="6px";c.style.marginLeft="6px";c.style.verticalAlign=
"baseline";c.style.textDecoration="none";e.push(c);c=new g.ThemeClass("primaryNav a:hover");c.style.color="#bfbfbf";c.style.cursor="hand";c.style.color="white";c.style.fontWeight="normal";e.push(c);for(var h in e)k+=e[h].toString();return k};l.prototype.writeLocationStyle=function(){var k="",e=[],c=new g.ThemeClass("titleArea");c.style.margin="0";c.style.paddingTop="5px";c.style.border="0";c.style.background=this.location;c.style.background="-webkit-gradient(linear, left top, left bottom, color-stop(0%,"+
this.location+"), color-stop(100%,"+this.location+"))";c.style.borderBottom="1px solid "+this.location;c.style.minHeight="20px";e.push(c);c=new g.ThemeClass("breadcrumb");c.style.fontSize="8pt";c.style.textDecoration="none";c.style.color="#f1f1f2;";c.style.paddingTop="2px";e.push(c);c=new g.ThemeClass("a.breadcrumb:hover");c.style.textDecoration="none";c.style.borderBottom="1px dotted";c.style.color="#F58B0F";c.style.cursor="pointer";e.push(c);c=new g.ThemeClass("breadcrumbSeparator");c.style.fontSize=
"8pt";c.style.textDecoration="none";c.style.color=this.separator;c.style.fontWeight="bold";e.push(c);c=new g.ThemeClass("currentLocation");c.style.fontWeight="bold";c.style.fontSize="8pt";c.style.color=this.breadcrumb;c.style.textDecoration="none";c.style.textWrap="normal";c.style.lineHeight="10pt";e.push(c);c=new g.ThemeClass("a.currentLocation:hover");c.style.fontWeight="bold";c.style.fontSize="10pt";c.style.color="#666666";c.style.textDecoration="none";c.style.borderBottom="0";e.push(c);c=new g.ThemeClass("navlinkonpage");
c.style.color=this.content;c.style.verticalAlign="middle";e.push(c);this.bannerProgress&&(c=new g.ThemeClass("topRowBanner .progressPane_running"),c.style.borderColor=this.bannerProgress,e.push(c));for(var h in e)k+=e[h].toString();return k};l.prototype.writeButtonStyle=function(){var k="",e=[],c=new g.ThemeClass("commandButton");c.style.color="#666";c.style.border="1px solid #dedede";c.style.backgroundColor="#ddd";c.style.textAlign="center";c.style.verticalAlign="middle";c.style.cursor="pointer";
c.style.display="inline-block";c.style.padding="4px 6px";c.style.borderRadius="3px";c.style.lineHeight="12px";c.style.fontSize="9pt";c.style.userSelect="none";e.push(c);c=new g.ThemeClass("commandButton:over");c.style.backgroundColor="#e6e6e6";c.style.border="1px solid #808080";e.push(c);c=new g.ThemeClass("commandMenu");c.style.color="#222";c.style.display="inline-block";c.style.verticalAlign="baseline";c.style.margin="0";c.style.fontSize="8pt";c.style.fontWeight="normal";c.style.border="1px solid #dedede";
c.style.backgroundColor="#efefef";c.style.cursor="pointer";c.style.borderRadius="1px";e.push(c);c=new g.ThemeClass("commandMenuItem");c.style.border="0";c.style.padding="0";c.style.margin="0";e.push(c);for(var h in e)k+=e[h].toString();return k};l.prototype.writeMainStyle=function(){var k="",e=[],c=new g.ThemeClass("searchbox");c.style.backgroundImage="url(../images/core_sprites.png)";c.style.backgroundRepeat="no-repeat";c.style.backgroundPosition="4px -297px";c.style.width="12px";c.style.height=
"12px";c.style.backgroundColor=this.search;c.style.border="1px solid "+this.search;c.style.fontSize="11px";c.style.width="15em";c.style.height="16px";c.style.borderRadius="10px";c.style.color="#999";c.style.padding="0";c.style.paddingLeft="20px";c.style.marginLeft="5px";c.style.marginTop="6px !important";c.style.font="7pt Lucida Sans Unicode,Lucida Grande,Verdana,Arial,Helvetica,Myriad,Tahoma,clean,sans-serif !important";e.push(c);c=new g.ThemeClass("searchbox:focus");c.style.color="white";c.style.outline=
"none";e.push(c);c=new g.ThemeClass("checkedRow");c.style.cssText="background-color:"+this.selection+" !important;";e.push(c);c=new g.ThemeClass("navbar-item-selected");c.style.background=this.selection;c.style.color=this.content;e.push(c);c=new g.ThemeClass("auxpane");c.style.border="0";c.style.background=this.sidepanel;e.push(c);c=new g.ThemeClass("mainpane");c.style.background=this.mainpanel;c.style.border=0;e.push(c);c=new g.ThemeClass("mainToolbar");c.style.background=this.toolpanel;e.push(c);
for(var h in e)k+=e[h].toString();return k};l.prototype.render=function(g){console.log(this.writeNavigationStyle());console.log(this.writeLocationStyle());console.log(this.writeMainStyle());console.log(this.writeButtonStyle())};l.prototype.getSheet=function(g){g.navbar.value?(this.navbar=g.navbar.value,this.button=g.button.value,this.location=g.location.value,this.selection=g.selection.value,this.sidepanel=g.sidepanel.value,this.mainpanel=g.mainpanel.value,this.navtext=g.navtext.value,this.search=
g.search.value,this.content=g.content.value,this.toolpanel=g.toolpanel.value,this.bannerProgress=g.bannerProgress.value):(this.navbar=g.navbar,this.button=g.button,this.location=g.location,this.selection=g.selection,this.sidepanel=g.sidepanel,this.mainpanel=g.mainpanel,this.navtext=g.navtext,this.search=g.search,this.content=g.content,this.toolpanel=g.toolpanel,this.bannerProgress=g.bannerProgress);return this.writeNavigationStyle()+this.writeLocationStyle()+this.writeMainStyle()+this.writeButtonStyle()};
return{ThemeSheetWriter:l}});
define("orion/widgets/themes/container/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme","orion/widgets/themes/container/ThemeSheetWriter"],function(g,l,k){function e(){}function c(){this.styles=[];var b=new e;b.name="Orion";b.navbar="white";b.button="#EFEFEF";b.location="#efefef";b.selection="FEC";b.sidepanel="#FBFBFB";b.mainpanel="white";b.toolpanel="white";b.navtext="#bfbfbf";b.content="#3087B3";b.search="#444";b.breadcrumb="#3087B3";b.separator="#333";b.bannerProgress="whitesmoke";
this.styles.push(b);b=new e;b.name="Orion2014";b.navbar="white";b.button="#EFEFEF";b.location="#EFEFEF";b.selection="FEC";b.sidepanel="#EEEEEE";b.mainpanel="#EEEEEE";b.toolpanel="#EEEEEE";b.navtext="#BFBFBF";b.content="#333333";b.search="#444444";b.breadcrumb="#333333";b.separator="#333333";b.bannerProgress="orange";this.styles.push(b);b=new e;b.name="Green Zone";b.navbar="seagreen";b.button="lavender";b.location="darkseagreen";b.selection="moccasin";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel=
"white";b.navtext="#FBFBFB";b.content="darkgreen";b.search="darkgreen";b.breadcrumb="#3087B3";b.separator="seagreen";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name="Pretty In Pink";b.navbar="plum";b.button="lavender";b.location="pink";b.selection="lavender";b.sidepanel="seashell";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumorchid";b.search="violet";b.breadcrumb="#3087B3";b.separator="plum";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name=
"Blue Monday";b.navbar="cornflowerblue";b.button="lavender";b.location="skyblue";b.selection="lavender";b.sidepanel="aliceblue";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="royalblue";b.search="royalblue";b.breadcrumb="#3087B3";b.separator="cornflowerblue";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name="Vanilla Skies";b.navbar="sandybrown";b.button="lemmonchiffon";b.location="cornsilk";b.selection="lemonchiffon";b.sidepanel="white";b.mainpanel="white";b.toolpanel=
"white";b.navtext="lemonchiffon";b.content="chocolate";b.search="moccasin";b.breadcrumb="#3087B3";b.separator="sandybrown";b.bannerProgress="#F2F2F2";this.styles.push(b);b=new e;b.name="Beetlejuice";b.navbar="indigo";b.button="slateblue";b.location="darkslateblue";b.selection="silver";b.sidepanel="lavender";b.mainpanel="white";b.toolpanel="white";b.navtext="#FBFBFB";b.content="mediumslateblue";b.search="#444";b.breadcrumb="#3087B3";b.separator="indigo";b.bannerProgress="#F2F2F2";this.styles.push(b);
b=new e;b.name="Red";b.navbar="#CD2127";b.button="#777777";b.location="#D85F56";b.selection="lightcoral";b.sidepanel="#EFDAB2";b.mainpanel="#FDFADD";b.toolpanel="#FDFADD";b.navtext="#FBFBFB";b.content="darkred";b.search="#D85F56";b.breadcrumb="darkred";b.separator="#CD2127";b.bannerProgress="#F2F2F2";this.styles.push(b)}function h(){return this.styles}e.prototype.name="Orion";e.prototype.navbar="#404648";e.prototype.button="#EFEFEF";e.prototype.location="#333";e.prototype.breadcrumb="#3087B3";e.prototype.separator=
"#333";e.prototype.selection="FEC";e.prototype.sidepanel="#FBFBFB";e.prototype.mainpanel="white";e.prototype.toolpanel="white";e.prototype.navtext="#bfbfbf";e.prototype.content="#3087B3";e.prototype.search="#444";e.prototype.bannerProgress="white";c.prototype.styles=[];c.prototype.getStyles=h;c.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"styles",defaultTheme:"Orion2014",selectedKey:"selected",version:"5.0"}};c.prototype.getViewData=function(){var b={top:10,left:10,
width:350,height:350};b.shapes=[{type:"RECTANGLE",name:g["Navigation Bar"],x:10,y:10,width:350,height:32,family:"navbar",fill:"#333",order:1},{type:"TEXT",name:g["Navigation Text"],label:"UserName",x:290,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif"},{type:"ROUNDRECTANGLE",name:g["Search Box"],x:215,y:20,width:70,height:12,family:"search",fill:"#444",order:3},{type:"RECTANGLE",name:g["Tool Panel"],x:150,y:71,width:209,height:30,family:"toolpanel",fill:"white",order:4},{type:"RECTANGLE",
name:g["Selection Bar"],x:155,y:133,width:200,height:20,family:"selection",fill:"#FEC",order:7},{type:"RECTANGLE",name:g.Location,x:10,y:42,width:350,height:29,family:"location",fill:"#efefef",order:8},{type:"TEXT",name:g["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},{type:"TEXT",name:g.Content,label:"Breadcrumb",x:15,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"TEXT",name:g.Content,label:"/",x:78,y:60,family:"content",
fill:"#3087B3",font:"8pt sans-serif",order:9},{type:"TEXT",name:g.Content,label:"Location",x:84,y:60,family:"content",fill:"#3087B3",font:"8pt sans-serif"},{type:"RECTANGLE",name:g["Main Panel"],x:150,y:101,width:209,height:258,family:"mainpanel",fill:"white",order:6},{type:"ROUNDRECTANGLE",name:g.Button,x:155,y:76,width:37,height:20,family:"button",fill:"#EFEFEF",order:11},{type:"TEXT",name:g["Button Text"],label:"Button",x:158,y:90,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"TRIANGLE",
name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:g["Section Text"],label:"Section",x:30,y:94,family:"navbar",fill:"#333",font:"8pt sans-serif"},{type:"LINE",name:g["Line Color"],x1:150,y1:101,x2:360,y2:101,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:g["Line Color"],x1:150,y1:71,x2:150,y2:360,linewidth:2,fill:"#DEDEDE"},{type:"LINE",name:g["Line Color"],
x1:20,y1:100,x2:140,y2:100,linewidth:2,fill:"#DEDEDE"},{type:"RECTANGLE",name:g["Side Panel"],x:10,y:71,width:140,height:289,family:"sidepanel",fill:"#FBFBFB",order:12},{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"},{type:"TEXT",name:g["Navigation Text"],label:"Navigator",x:60,y:30,family:"navtext",fill:"#bfbfbf",font:"8pt sans-serif",order:2},
{type:"TRIANGLE",name:"userMenu",x1:353,y1:24,x2:347,y2:24,x3:350,y3:29,family:"userMenu",fill:"#BFBFBF"},{type:"TRIANGLE",name:"userMenu",x1:20,y1:88,x2:26,y2:88,x3:23,y3:93,family:"userMenu",fill:"#BFBFBF"}];for(var f=0;3>f;f++)b.shapes.push({type:"TEXT",name:g.Content,label:"org.eclipse.orion.content",x:170,y:127+20*f,fill:"#3087B3",family:"content"});for(f=0;3>f;f++)b.shapes.push({type:"TEXT",name:g.Content,label:"Item",x:25,y:115+20*f,fill:"#3087B3",family:"content"});for(f=0;3>f;f++)b.shapes.push({type:"TRIANGLE",
name:"twisty",x1:160,y1:121+20*f,x2:165,y2:124+20*f,x3:160,y3:127+20*f,family:"navbar",fill:"#333"});b.shapes.push({type:"IMAGE",name:"logo",x:15,y:18,source:"../../images/orion-transparent.png",family:"logo"});return b};c.prototype.processSettings=function(b){var f=new k.ThemeSheetWriter;(new l.TextTheme.getTheme("orionTheme")).setThemeClass("orionTheme",f.getSheet(b))};return{ThemeData:c,getStyles:h}});
define("orion/widgets/nls/root/messages",{"no input":"no input","no output":"no output","Choose a Folder":"Choose a Folder",OK:"OK",Profile:"Profile","Sign out":"Sign out","N/A":"N/A","logged in since ":"logged in since ","Sign in":"Sign in","Authentication required!":"Authentication required!","Name:":"Name:","Plug-ins":"Plug-ins"," \x3cNo available services or timed out, check URL and try reloading\x3e":" \x3cNo available services or timed out, check URL and try reloading\x3e",Properties:"Properties",
" (Service Id: ":" (Service Id: ",Services:"Services","SFTP Transfer":"SFTP Transfer","Remote host:":"Remote host:","Port:":"SFTP Port:","Remote path:":"Remote path:","User name:":"User name:","Password:":"Password:","Start Transfer":"Start Transfer","Location:":"Location:","orion.sftpConnections":"orion.sftpConnections","Drag a file here":"Drag a file here","unzip zips":"Unzip *.zip files","or if you prefer":"(or upload a file using the buttons below)",Upload:"Upload","Browse...":"Browse...","Import a file or zip":"Import a file or zip",
"Missing required argument: searchRenderer":"Missing required argument: searchRenderer","Missing required argument: favService":"Missing required argument: favService","Find File Named":"Find File Named","Type the name of a file to open (? \x3d any character, * \x3d any string):":"Type the name of a file to open (? \x3d any character, * \x3d any string):",Search:"Search","FileName FolderName":"FileName FolderName(Optional)","Searching...":"Searching...","Searching for occurrences of":'Searching for occurrences of: "${0}"',
name:"name","orion.widgets.UserMenu":"orion.widgets.UserMenu",test:"test","Sign Out":"Sign Out","Sign Out ":"Sign Out ","\x3c/a\x3e":"\x3c/a\x3e","\x3e":"\x3e","Sign In To ":"Sign In To ","Sign In":"Sign In",Help:"Help","Report a Bug":"Report a Bug","Keyboard Shortcuts":"Keyboard Shortcuts",Settings:"Settings","View profile of ":"View profile of ",Profiles:"Profiles","Information Needed":"Information Needed",Cancel:"Cancel","If the same file exists in both the source and destination:":"If the same file exists in both the source and destination:",
"Cancel the transfer":"Cancel the transfer","Always overwrite destination":"Always overwrite destination","Overwrite if source is newer":"Overwrite if source is newer",New:"New","Building file skeleton...":"Building file skeleton...",Add:"Add","Upload...":"Upload...","For a list of available commands type '${0}'.":"For a list of available commands type '${0}'.","Main Pages":"Main Pages","Related Links":"Related Links"});
define("orion/widgets/nls/messages",["orion/i18n!orion/widgets/nls/messages","orion/widgets/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/widgets/userAssistance/UATaskPanel",["orion/webui/littlelib"],function(g){function l(k,e,c){this.elements=c;this.taskPanel=document.createElement("div");this.taskPanel.className="UAContainer";this.taskPanel.innerHTML='\x3cheader class\x3d"UAHeader"\x3eDevelop software from within the cloud\x3c/header\x3e';this.elementNode=document.createElement("div");this.switchesContainer=document.createElement("div");this.switches=document.createElement("span");this.radioButtons=[];this.elementNode.className=
"UAContainer-body";this.taskPanel.appendChild(this.elementNode);this.switchesContainer.className="UAContainer-switch-body";this.switches.className="UAContainer-switches";this.switchesContainer.innerHTML="";this.switchesContainer.appendChild(this.switches);this.taskPanel.appendChild(this.switchesContainer);!0===e?(this.container=document.createElement("div"),this.container.className="UAModal",this.container.appendChild(this.taskPanel),this.backdrop=document.createElement("div"),this.backdrop.className=
"UAModalBackground",document.body.appendChild(this.backdrop),document.body.appendChild(this.container),g.addAutoDismiss([this.container],this.destroy.bind(this))):k.appendChild(this.taskPanel);this.chosenSwitch=this.createSwitch(null,!0);this.chosenSwitch.firstChild.className="chosenCircle";this.initialize();this.elements.forEach(this.createSwitch.bind(this))}l.prototype.elementNode=null;l.prototype.switchesContainer=null;l.prototype.switches=null;l.prototype.radioButtons=null;l.prototype.chosenSwitch=
null;l.prototype.addElement=function(g){var e=document.createElement("span");e.className="UAContainer-icon";e.innerHTML='\x3cspan class\x3d"workingSpan"\x3e\x3cimg src\x3d"'+g.image+'" id\x3d"'+g.label+'ImageNode" alt\x3d"'+g.alt+'" height\x3d"64" width\x3d"64"\x3e\x3c/span\x3e\x3cspan class\x3d"UAIcon-label"\x3e\x3cspan class\x3d"UALabel" id\x3d"'+g.label+'LabelNode" \x3e'+g.label+"\x3c/span\x3e\x3c/span\x3e";e.onmouseover=function(){document.getElementById(g.label+"ImageNode").src=g.secondaryImage;
document.getElementById(g.label+"LabelNode").className="UALabel-live";e.className="UAContainer-icon-live"};e.onmouseout=function(){document.getElementById(g.label+"ImageNode").src=g.image;document.getElementById(g.label+"LabelNode").className="UALabel";e.className="UAContainer-icon"};var c=this;e.onclick=function(){c.showMedia(g)};this.elementNode.appendChild(e)};l.prototype.clearElements=function(){this.elementNode.innerHTML=""};l.prototype.showMedia=function(g){this.clearElements();this.addElement(g);
var e=document.createElement("span");e.className="UAContainer-media";e.innerHTML='\x3cdiv\x3e\x3c/div\x3e\x3cdiv\x3e\x3c/div\x3e\x3cspan class\x3d"mediaSpan"\x3e\x3cimg src\x3d"'+g.media+'" alt\x3d"'+g.alt+'" height\x3d"300" width\x3d"400"\x3e\x3c/span\x3e';this.elementNode.appendChild(e);setTimeout(function(){e.style.opacity=1},100);g=document.getElementById(g.label+"switch");this.chosenSwitch.firstChild.className="circle";this.chosenSwitch=g.parentNode;g.className="chosenCircle"};l.prototype.createSwitch=
function(g){var e;e=g?g.label+"switch":"indexSwitch";var c=document.createElement("span");c.className="workingSpan";c.innerHTML='\x3cdiv class\x3d"circle" id \x3d"'+e+'"\x3e\x3c/div\x3e';var h=this;c.onclick=g?function(){h.showMedia(g)}:function(){h.initialize();h.chosenSwitch.firstChild.className="circle";h.chosenSwitch=c;h.chosenSwitch.firstChild.className="chosenCircle"};this.switches.appendChild(c);return this.radioButtons[this.radioButtons.length]=c};l.prototype.initialize=function(){this.clearElements();
this.elements.forEach(this.addElement.bind(this))};l.prototype.destroy=function(){document.body.removeChild(this.backdrop);document.body.removeChild(this.container)};return l});
define("orion/webui/dialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/uiUtils"],function(g,l,k,e){function c(){}var h=null;c.prototype={DISABLED:"disabled",CONTAINERTEMPLATE:'\x3cdiv class\x3d"dialog" role\x3d"dialog"\x3e\x3cdiv class\x3d"dialogTitle"\x3e\x3cspan id\x3d"title" class\x3d"dialogTitleText layoutLeft"\x3e\x3c/span\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" id\x3d"closeDialog"\x3e\x3c/button\x3e\x3c/div\x3e\x3cdiv id\x3d"dialogContent" class\x3d"dialogContent layoutBlock"\x3e\x3c/div\x3e\x3cdiv id\x3d"buttons" class\x3d"dialogButtons"\x3e\x3c/div\x3e\x3c/div\x3e',_initialize:function(){var b=
document.body;this.$frameParent=b;this.$$modalExclusions=this.$$modalExclusions||[];var f=document.createRange();f.selectNode(b);f=f.createContextualFragment(this.CONTAINERTEMPLATE);b.appendChild(f);this.$frame=b.lastChild;this.title&&k.$("#title",this.$frame).appendChild(document.createTextNode(this.title));this.$close=k.$("#closeDialog",this.$frame);var d=this;this.$close.addEventListener("click",function(b){d.hide()},!1);this.$parent=k.$(".dialogContent",this.$frame);f=document.createRange();f.selectNode(this.$parent);
b=f.createContextualFragment(this.TEMPLATE);this.messages&&k.processTextNodes(b,this.messages);this.$parent.appendChild(b);this.$buttonContainer=k.$(".dialogButtons",this.$frame);this._makeButtons();this.$frame.addEventListener("keydown",function(b){b.keyCode===k.KEY.ESCAPE?d.hide():b.keyCode===k.KEY.ENTER&&"function"===typeof d._defaultCallback&&d._defaultCallback()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent);this.modal&&this._makeModal()},
_makeButtons:function(){if(this.$buttonContainer&&Array.isArray(this.buttons)){var b=this;this.buttons.forEach(function(f){var d=e.createButton(f.text,f.callback);f.id&&(d.id=f.id,b["$"+d.id]=d);f.isDefault&&(b._defaultCallback=f.callback,b._defaultButton=d);b.$buttonContainer.appendChild(d)})}},_makeModal:function(b){var f=this;this.$frame.addEventListener("blur",function(a){f.$lastFocusedElement=a.target},!0);this._modalListener=function(a){var d=!k.contains(f.$frame,a.target);if(d)for(var b=0;b<
f.$$modalExclusions.length;b++)if(k.contains(f.$$modalExclusions[b],a.target)){d=!1;break}d&&(window.setTimeout(function(){(f.$lastFocusedElement||f.$parent).focus()},0),k.stop(a))};this.$frameParent.addEventListener("focus",this._modalListener,!0);this.$frameParent.addEventListener("click",this._modalListener,!0);b=this.$frameParent.childNodes;var d=!1;this._addedBackdrop=[];for(var c=0;c<b.length;c++){for(var a=0;a<this.$$modalExclusions.length;a++)if(k.contains(this.$$modalExclusions[a],b[c])){d=
!0;break}!d&&b[c]!==f.$frame&&b[c].classList&&!b[c].classList.contains("tooltipContainer")&&(a=b[c],a.classList.contains("modalBackdrop")||(a.classList.add("modalBackdrop"),this._addedBackdrop.push(a)))}(b=k.lastTabbable(this.$buttonContainer)||k.lastTabbable(this.$parent))&&b.addEventListener("keydown",function(a){if(a.keyCode===k.KEY.TAB){var d=f._getFirstFocusField();d&&d!==a.target&&d.focus();k.stop(a)}},!1)},_addChildDialog:function(b){this.$$modalExclusions.push(b.$frame||b.$parent)},_inModalExclusion:function(b){return this.$$modalExclusions.some(function(f){return b.$frame===
f||b.$parent===f})},_bindElements:function(b){for(var f=0;f<b.childNodes.length;f++){var d=b.childNodes[f];d.id&&(this["$"+d.id]=d);this._bindElements(d)}},hide:function(b){!b&&h===this&&(h=null);"function"===typeof this._beforeHiding&&this._beforeHiding();this._modalListener&&(this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0));this.$frame.classList.remove("dialogShowing");k.setFramesEnabled(!0);"function"===
typeof this._afterHiding&&this._afterHiding();var f=this;this.keepAlive||window.setTimeout(function(){f.destroy()},0)},show:function(b){if(this.modal)if(h){if(!h._inModalExclusion(this)){this.hide(!0);return}}else h=this;"function"===typeof this._beforeShowing&&this._beforeShowing();k.setFramesEnabled(!1);var f=k.bounds(this.$frame),d=k.bounds(document.documentElement),c;b?(c=k.bounds(b),b=c.top+c.height+4,c=c.left+4,b+f.height>d.height&&(b=Math.max(0,d.height-f.height-4)),c+f.width>d.width&&(c=Math.max(0,
d.width-f.width-4))):(c=Math.max(0,(d.width-f.width)/2),b=Math.max(0,(d.height-f.height)/2));this.$lastFocusedElement=document.activeElement;this.$frame.style.top=b+"px";this.$frame.style.left=c+"px";this.$frame.classList.add("dialogShowing");"function"===typeof this._afterShowing&&this._afterShowing();this.customFocus||this._getFirstFocusField().focus()},_getFirstFocusField:function(){return k.firstTabbable(this.$parent)||this._defaultButton||k.firstTabbable(this.$buttonContainer)||this.$close},
destroy:function(){this.$frame&&(h===this&&(h=null),k.setFramesEnabled(!0),this._addedBackdrop&&0<this._addedBackdrop.length&&this._addedBackdrop.forEach(function(b){b.classList.remove("modalBackdrop")}),this.$frameParent.removeEventListener("focus",this._modalListener,!0),this.$frameParent.removeEventListener("click",this._modalListener,!0),this.$frameParent.removeChild(this.$frame),this.$parent=this.$frame=void 0)}};c.prototype.constructor=c;return{Dialog:c}});
define("orion/widgets/UserMenu","i18n!orion/widgets/nls/messages require orion/webui/littlelib orion/PageLinks orion/widgets/userAssistance/UATaskPanel orion/webui/dialog orion/webui/dropdown".split(" "),function(g,l,k,e,c,h,b){function f(d){this._displaySignOut=!0;this._init(d)}f.prototype={_init:function(d){this._dropdownNode=k.node(d.dropdownNode);if(!this._dropdownNode)throw"no dom node for dropdown found";this._dropdown=d.dropdown;this._serviceRegistry=d.serviceRegistry;this.authenticatedServices=
{};this.unauthenticatedServices={};this._noSeparator=d.noSeparator;this._dropDownItemClass=d.dropDownItemClass;this._keyAssistClass=d.keyAssistClass;void 0!==d.signOut&&(this._displaySignOut=d.signOut)},isSingleService:function(){return 1===this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},hasServices:function(){return 0<this.length(this.unauthenticatedServices)+this.length(this.authenticatedServices)},length:function(d){var b=0,a;for(a in d)d.hasOwnProperty(a)&&b++;
return b},_makeMenuItem:function(d,f){var a=b.createMenuItem(d).firstElementChild;"string"===typeof this._dropDownItemClass&&""!==this._dropDownItemClass&&a.classList.add(this._dropDownItemClass);a.addEventListener("click",f,!1);a.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&f()},!1);return a},_renderAuthenticatedService:function(d,b){var a=this,f=this.authenticatedServices[d].authService;if(f&&f.logout&&this._displaySignOut){var c=this._makeMenuItem(g["Sign Out"],
function(){f.logout().then(function(){a.addUserItem(d,f,a.authenticatedServices[d].label);localStorage.removeItem(d);localStorage.removeItem("lastLogin");for(var b=localStorage.length-1;0<=b;b--){var c=localStorage.key(b);c&&0===c.indexOf("/orion/preferences/user")&&localStorage.removeItem(c)}f.getAuthForm(window.location.href).then(function(a){window.location=a})})});this._dropdownNode.appendChild(c.parentNode)}},renderServices:function(){function d(d){a[d]||(a[d]=f.createDocumentFragment());return a[d]}
var f=document,a=[],c=this._serviceRegistry;e.getPageLinksInfo(c,"orion.page.link.user").then(function(e){this._dropdown?this._dropdown.empty():this._dropdownNode&&k.empty(this._dropdownNode);e.getAllLinks().forEach(function(a){var b,c;if(a.category&&(c=/user\.(\d+)/.exec(a.category)))b=parseInt(c[1],10);if("number"!==typeof b||isNaN(b))b=1;b=d(b);c=f.createElement("li");var n=f.createElement("a");n.role="menuitem";"string"===typeof this._dropDownItemClass?""!==this._dropDownItemClass&&n.classList.add(this._dropDownItemClass):
n.classList.add("dropdownMenuItem");n.href=a.href;n.textContent=a.textContent;c.appendChild(n);b.appendChild(c);n.addEventListener("keydown",function(a){(a.keyCode===k.KEY.ENTER||a.keyCode===k.KEY.SPACE)&&n.click()},!1)}.bind(this));this.keyAssistFunction&&(e=this._makeMenuItem(g["Keyboard Shortcuts"],this.keyAssistFunction),"string"===typeof this._keyAssistClass?""!==this._keyAssistClass&&e.classList.add(this._keyAssistClass):e.classList.add("key-assist-menuitem"),e=e.parentNode,d(0).appendChild(e));
if(e=c.getServiceReferences("orion.page.getstarted")[0])e=e.getProperty("data"),e=this._makeMenuItem("Getting Started",this.getStartedDialog.bind(this,e)).parentNode,d(0).appendChild(e);var h=this;a.sort(function(a,d){return a-d}).forEach(function(d,f){if(f<a.length-1&&!this._noSeparator){var c=b.createSeparator();d.appendChild(c)}h._dropdownNode.appendChild(d)}.bind(this));if(this.isSingleService())for(var r in this.authenticatedServices)this.authenticatedServices.hasOwnProperty(r)&&this._renderAuthenticatedService(r,
0)}.bind(this))},getStartedDialog:function(d){new c(null,!0,d)},setKeyAssist:function(d){this.keyAssistFunction=d;this.renderServices()},addUserItem:function(d,b,a,f){f?(this.unauthenticatedServices[d]&&delete this.unauthenticatedServices[d],this.authenticatedServices[d]={authService:b,label:a,data:f}):(this.authenticatedServices[d]&&delete this.authenticatedServices[d],this.unauthenticatedServices[d]=this.unauthenticatedServices[d]?{authService:b,label:a,pending:this.unauthenticatedServices[d].pending}:
{authService:b,label:a});this.renderServices()}};f.prototype.constructor=f;return{UserMenu:f}});
define("orion/crawler/nls/root/messages",{"Searching file:":"Searching file:","is not supported in this file system":"is not supported in this file system","${0} files found out of ${1}":"${0} files found out of ${1}","The search term on this location will not use indexed files.":"The search term on this location will not use indexed files.","It will take longer time. Do you want to proceed?":"It will take longer time. Do you want to proceed?","Search cancelled by user":"Search cancelled by user",
Cancel:"Cancel"});define("orion/crawler/nls/messages",["orion/i18n!orion/crawler/nls/messages","orion/crawler/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/searchUtils","i18n!orion/nls/messages require orion/regex orion/commandRegistry orion/PageUtil orion/URITemplate".split(" "),function(g,l,k,e,c,h){function b(d,b,a){var f="";a&&(f="^");if(f=k.parse("/"+f+d.searchStr+"/"))a=f.pattern,f=f.flags,-1===f.indexOf("i")&&!b.caseSensitive&&(f+="i"),d.regExp={pattern:a,flags:f},d.wildCard=!0}var f={ALL_FILE_TYPE:"*.*",doSearch:function(d,b,a,c){if(d){var e=!0;"*"===a&&(a="");""===a&&(e=c&&c.type!==f.ALL_FILE_TYPE);e&&(""!==a&&f.addRecentSearch(b,
a,c?c.regEx:!1),d=d.createSearchParams(a,!1,!1,c),d=f.generateSearchHref(d),window.location=d)}else window.alert(g["Can't search: no search service is available"])},generateSearchHelper:function(d,c){var a=d.keyword,e=a,h={};d.fileType&&d.fileType!==f.ALL_FILE_TYPE&&""===a&&(e="*."+d.fileType);if(d.regEx)h.searchStr=a,b(h,d,c);else{var g=-1<a.indexOf("*"),k=-1<a.indexOf("?");g&&(a=a.split("*").join(".*"));k&&(a=a.split("?").join("."));!g&&!k&&!d.nameSearch?(h.searchStr=d.caseSensitive?a.split("\\").join(""):
a.split("\\").join("").toLowerCase(),h.wildCard=!1):(h.searchStr=d.caseSensitive?a:a.toLowerCase(),b(h,d,c),h.wildCard=!0)}h.searchStrLength=h.searchStr.length;return{params:d,inFileQuery:h,displayedSearchTerm:e}},convertSearchParams:function(d){void 0!==d.rows&&(d.rows=parseInt(d.rows,10));void 0!==d.start&&(d.start=parseInt(d.start,10));"string"===typeof d.regEx&&(d.regEx="true"===d.regEx.toLowerCase());"string"===typeof d.caseSensitive&&(d.caseSensitive="true"===d.caseSensitive.toLowerCase());
"string"===typeof d.nameSearch&&(d.nameSearch="true"===d.nameSearch.toLowerCase())},copySearchParams:function(d,b){var a={},f;for(f in d)if(void 0!==d[f]&&null!==d[f]&&(b||"replace"!==f))a[f]=d[f];return a},generateSearchHref:function(d){var b=l.toUrl("search/search.html");d=f.copySearchParams(d,!0);var a=d.resource;d.resource=void 0;return"undefined"!==typeof d.keyword?(new h(b+"#{,resource,params*}")).expand({resource:a,params:d}):(new h(b+"#{,resource}")).expand({resource:a})},generateFindURLBinding:function(d,
b,a,f,c){d={find:b.searchStr,regEx:b.wildCard?!0:void 0,caseSensitive:d.caseSensitive?!0:void 0,replaceWith:"string"===typeof f?f:void 0,atLine:"number"===typeof a?a:void 0};return c?d:","+(new h("{,params*}")).expand({params:d})},convertFindURLBinding:function(d){"string"===typeof d.regEx&&(d.regEx="true"===d.regEx.toLowerCase());"string"===typeof d.caseSensitive&&(d.caseSensitive="true"===d.caseSensitive.toLowerCase());"string"===typeof d.atLine&&(d.atLine=parseInt(d.atLine,10))},replaceRegEx:function(d,
b,a){return d.replace(RegExp(b.pattern,b.flags),a)},replaceStringLiteral:function(d,b,a){b=k.parse("/"+b+"/gim");return f.replaceRegEx(d,b,a)},searchOnelineLiteral:function(d,b,a){var f;f=0;for(var c=!1,e=[];!(f=b.indexOf(d.searchStr,f),0>f);){e.push({startIndex:f,length:d.searchStrLength});c=!0;if(a)break;f+=d.searchStrLength}return c?e:null},findRegExp:function(d,b,a,f){if(!b)return null;a=a||"";a+=(-1===a.indexOf("g")?"g":"")+(-1===a.indexOf("m")?"m":"");var c=null;return(c=RegExp(b,a).exec(d.substring(f)))&&
{startIndex:c.index+f,length:c[0].length}},searchOnelineRegEx:function(d,b,a){for(var c=0,e=!1,h=[];;)if(c=f.findRegExp(b,d.regExp.pattern,d.regExp.flags,c)){h.push(c);e=!0;if(a)break;c=c.startIndex+c.length}else break;return e?h:null},generateNewContents:function(d,b,a,c,e,h){if(c&&b){d||(a.contents=[]);for(var g=0;g<b.length;g++){for(var k=b[g],l=!1,v=!1,u=[],y,x=0,z=0;z<c.children.length;z++)if(c.children[z].lineNumber-1===g){x=z;for(l=0;l<c.children[z].matches.length;l++)!1!==c.children[z+l].checked&&
u.push(l);v=0<u.length;y=c.children[z].matches;l=!0;break}if(l){if(v){u=f.replaceCheckedMatches(k,e,y,u,h);k=u.replacedStr;for(l=0;l<c.children[x].matches.length;l++)c.children[x+l].newMatches=u.newMatches}else for(l=0;l<c.children[x].matches.length;l++)c.children[x+l].newMatches=c.children[x+l].matches;d?a.contents[g]=k:a.contents.push(k)}else d||a.contents.push(k)}}},generateMatchContext:function(d,b,a){var f=[],c=2*d+1,e;b.length<=c?(e=0,d=b.length-1):(e=a-d,0>e?(e=0,d=e+c-1):(d=a+d,d>b.length-
1&&(d=b.length-1,e=d-c+1)));for(c=e;c<=d;c++)f.push({context:b[c],current:c===a});return f},splitFile:function(d){for(var b=0,a=0,f=0,c=0,e=[];;){-1!==b&&b<=f&&(b=d.indexOf("\r",f));-1!==a&&a<=f&&(a=d.indexOf("\n",f));if(-1===a&&-1===b){e.push(d.substring(c));break}var h=1;-1!==b&&-1!==a?b+1===a?(h=2,f=a+1):f=(b<a?b:a)+1:f=-1!==b?b+1:a+1;e.push(d.substring(c,f-h));c=f}return e},searchWithinFile:function(d,b,a,c,e,h){a=f.splitFile(a);e&&(b.contents=a);if(b){b.children=[];for(var g=c=0;g<a.length;g++){var k=
a[g];if(k&&0<k.length){var l=h?k:k.toLowerCase();if(l=d.wildCard?f.searchOnelineRegEx(d,l):f.searchOnelineLiteral(d,l)){var v,u=g+1;if(e)for(var y=0;y<l.length;y++)v=y+1,v={parent:b,checked:b.checked,type:"detail",matches:l,lineNumber:u,matchNumber:v,name:k,location:b.location+"-"+u+"-"+v},b.children.push(v);else v={parent:b,context:f.generateMatchContext(2,a,g),checked:b.checked,type:"detail",matches:l,lineNumber:u,name:k,location:b.location+"-"+u},b.children.push(v);c+=l.length}}}b.totalMatches=
c}},replaceCheckedMatches:function(d,b,a,f,c){for(var e=0,h="",g=[],k=0;k<a.length;k++){e!==a[k].startIndex&&(h+=d.substring(e,a[k].startIndex));a[k].length&&(c=a[k].length);for(var e=!1,l=0;l<f.length;l++)if(f[l]===k){e=!0;break}e?(g.push({startIndex:h.length,length:b.length}),h+=b):(g.push({startIndex:h.length,length:c}),h+=d.substring(a[k].startIndex,a[k].startIndex+c));e=a[k].startIndex+c}e<d.length&&(h+=d.substring(e));return{replacedStr:h,newMatches:g}},fullPathNameByMeta:function(d){var b=
d.length,a="";if(0<b)for(b-=1;-1<b;b--)a=a+(""===a?"":"/")+d[b].Name;return a},path2FolderName:function(d,b,a){return d.substring(0,d.length-b.length-(a?0:1))},_storeRecentSearch:function(d,b,a,f){d.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){d.put("recentSearch",b);a&&window.setTimeout(function(){a.dispatchEvent({type:"inputDataListChanged",deleting:f})}.bind(this),20)})},addRecentSearch:function(d,b,a){"string"===typeof b&&b&&d.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var e;
c=c.get("recentSearch");"string"===typeof c&&(c=JSON.parse(c));if(c){for(e in c)if(c[e].name===b)return;20<=c.length&&c.splice(19,c.length-20+1)}else c=[];c.splice(0,0,{name:b,regEx:a});f._storeRecentSearch(d,c)})},removeRecentSearch:function(d,b,a){"string"===typeof b&&b&&d.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var e;c=c.get("recentSearch");"string"===typeof c&&(c=JSON.parse(c));if(c)for(e in c)if(c[e].name===b){c.splice(e,1);f._storeRecentSearch(d,
c,a,!0);break}})},getSearches:function(d,b,a){d.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){d=d.get(b);"string"===typeof d&&(d=JSON.parse(d));d&&a&&a(d)})},getMixedSearches:function(d,b,a,c){d.getService("orion.core.preference").getPreferences("/window/favorites").then(function(d){var e=d.get("recentSearch");"string"===typeof e&&(e=JSON.parse(e));b&&(d=d.get("search"),"string"===typeof d&&(d=JSON.parse(d)),d&&d.forEach(function(d){if(a){var b=f.parseQueryStr(d.query);
e.some(function(a){return b.searchStrTitle===a.name})||e.push({name:b.searchStrTitle,label:d.name})}else e.push({name:null,label:d.name,value:d.query})}));e&&c&&c(e)})},getOpenSearchPref:function(d,b){d.getService("orion.core.preference").getPreferences("/cm/configurations").then(function(a){a=a.get("nav.config");b(a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?!0:!1:!1)})},setOpenSearchPref:function(d,b){d.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){a.put("openSearchPref",
{openInNewTab:b})})}};return f});
define("orion/crawler/searchCrawler","i18n!orion/crawler/nls/messages require orion/i18nUtil orion/searchUtils orion/contentTypes orion/Deferred".split(" "),function(g,l,k,e,c,h){function b(b,d,c,a){this.registry=b;this.fileClient=d;this.fileLocations=[];this.fileSkeleton=[];this._totalCounter=this._hitCounter=0;this._searchOnName=a&&a.searchOnName;this._buildSkeletonOnly=a&&a.buildSkeletonOnly;this._fetchChildrenCallBack=a&&a.fetchChildrenCallBack;this._searchParams=c;this.searchHelper=this._searchOnName||
this._buildSkeletonOnly?null:e.generateSearchHelper(c);this._location=a&&a.location;this._childrenLocation=a&&a.childrenLocation?a.childrenLocation:this._location;this._reportOnCancel=a&&a.reportOnCancel;this._cancelled=!1;this._statusService=this.registry.getService("orion.page.message");this._progressService=this.registry.getService("orion.page.progress");this._statusService&&this._statusService.setCancelFunction(function(){this._cancelFileContentsSearch()}.bind(this))}b.prototype.search=function(b){var d=
this.registry.getService("orion.core.contentTypeRegistry");this._onSearchComplete=b;this._cancelled=!1;this._deferredArray=[];d.getContentTypes().then(function(d){this.contentTypesCache=d;var a=this;this._visitRecursively(this._childrenLocation).then(function(){(!a._cancelled||a._reportOnCancel)&&a._reportResult();a._cancelled&&a._HandleStatus({name:"Cancel"})}.bind(a),function(d){a._reportResult();a._HandleStatus(d)}.bind(a))}.bind(this))};b.prototype.searchName=function(b,d){b&&(this._searchParams=
b,this.searchHelper=e.generateSearchHelper(b,!0));d&&(this.onSearchNameComplete=d);var c=[];this._cancelled=!1;this._deferredArray=[];this._sort(this.fileSkeleton);if(0<this.fileSkeleton.length){for(var a=0;a<this.fileSkeleton.length;a++){var n=this.fileSkeleton[a].Name.toLowerCase();if(this.searchHelper.inFileQuery.wildCard?e.searchOnelineRegEx(this.searchHelper.inFileQuery,n,!0):e.searchOnelineLiteral(this.searchHelper.inFileQuery,n,!0))if(c.push(this.fileSkeleton[a]),c.length>=this.searchHelper.params.rows)break}this.onSearchNameComplete({response:{numFound:c.length,
docs:c}})}else this.onSearchNameComplete({response:{numFound:0,docs:[]}})};b.prototype.buildSkeleton=function(b,d){this._buildingSkeleton=!0;var c=this.registry.getService("orion.core.contentTypeRegistry");this._cancelled=!1;this._deferredArray=[];var a=this;b();c.getContentTypes().then(function(b){a.contentTypesCache=b;a._visitRecursively(a._childrenLocation).then(function(){a._buildingSkeleton=!1;d();a.searchHelper&&!a._buildSkeletonOnly&&a.searchName()})})};b.prototype._sort=function(b){b.sort(function(d,
b){var a,c;if("Path asc"===this._searchParams.sort){a=d.Location&&d.Location.toLowerCase();a=e.path2FolderName(a,d.Name&&d.Name.toLowerCase(),!0);c=b.Location&&b.Location.toLowerCase();c=e.path2FolderName(c,b.Name&&b.Name.toLowerCase(),!0);if(a<c)return-1;if(a>c)return 1}return this._sortOnNameSingle(d,b)}.bind(this))};b.prototype._HandleStatus=function(b){this._statusService&&"Cancel"===b.name&&(console.log("Crawling search cancelled. Deferred array length : "+this._deferredArray.length),this._statusService.setProgressResult({Message:g["Search cancelled by user"],
Severity:"Warning"}))};b.prototype._reportResult=function(){this._sort(this.fileLocations);this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}})};b.prototype._sortOnNameSingle=function(b,d){var c=b.Name&&b.Name.toLowerCase(),a=d.Name&&d.Name.toLowerCase();return c<a?-1:c>a?1:0};b.prototype._onFileType=function(b){return this.searchHelper.params.fileType?this.searchHelper.params.fileType===e.ALL_FILE_TYPE?!0:0<=b.extension.indexOf(this.searchHelper.params.fileType):
!0};b.prototype._visitRecursively=function(b){var d=[],m=this;this._fetchChildrenCallBack&&this._fetchChildrenCallBack(b);return(m._progressService?this._progressService.progress(m.fileClient.fetchChildren(b),"Crawling search for children of "+b):m.fileClient.fetchChildren(b)).then(function(a){for(var b=0;b<a.length;b++)if(void 0!==a[b].Directory&&!1===a[b].Directory)if(m._searchOnName)d.push(m._buildSingleSkeleton(a[b]));else if(m._buildSkeletonOnly)d.push(m._buildSingleSkeleton(a[b]));else{if(!m._cancelled){var f=
c.getFilenameContentType(a[b].Name,m.contentTypesCache);if(f&&("text/plain"===f["extends"]||"text/plain"===f.id)&&m._onFileType(f))f=m._sniffSearch(a[b]),d.push(f),m._deferredArray.push(f)}}else if(a[b].Location)if(m._cancelled)break;else f=m._visitRecursively(a[b].ChildrenLocation),d.push(f),m._deferredArray.push(f);return h.all(d)})};b.prototype._hitOnceWithinFile=function(b){b=this._searchParams.caseSensitive?b:b.toLowerCase();return this.searchHelper.inFileQuery.wildCard?e.searchOnelineRegEx(this.searchHelper.inFileQuery,
b,!0):e.searchOnelineLiteral(this.searchHelper.inFileQuery,b,!0)};b.prototype._reportSingleHit=function(b){this._cancelled||(b.LastModified=b.LocalTimeStamp,this.fileLocations.push(b),this._hitCounter++,this._sort(this.fileLocations),this._onSearchComplete({response:{numFound:this.fileLocations.length,docs:this.fileLocations}},!0))};b.prototype._cancelFileContentsSearch=function(){(this._cancelled=!0)&&this._deferredArray.forEach(function(b){b.cancel()})};b.prototype._sniffSearch=function(b){this._totalCounter++;
var d=this;if(!this._cancelled)if(""===this.searchHelper.params.keyword)this._reportSingleHit(b),this._statusService&&this._statusService.setProgressResult({Message:k.formatMessage(g["${0} files found out of ${1}"],this._hitCounter,this._totalCounter)});else return(d._progressService?d._progressService.progress(d.fileClient.read(b.Location),"Reading file "+b.Location):d.fileClient.read(b.Location)).then(function(c){d._hitOnceWithinFile(c)&&d._reportSingleHit(b);d._statusService&&d._statusService.setProgressResult({Message:k.formatMessage(g["${0} files found out of ${1}"],
d._hitCounter,d._totalCounter)},g.Cancel)},function(d){d&&d.message&&"cancel"!==d.message.toLowerCase()&&console.error("Error loading file content: "+d.message)})};b.prototype._buildSingleSkeleton=function(b){this._totalCounter++;this.fileSkeleton.push(b);this.searchHelper&&!this._buildSkeletonOnly&&0===this._totalCounter%100&&this.searchName();b=new h;b.resolve(this._totalCounter);return b};b.prototype.constructor=b;return{SearchCrawler:b}});
define("orion/webui/dialogs/OpenResourceDialog","i18n!orion/widgets/nls/messages orion/crawler/searchCrawler orion/contentTypes require orion/webui/littlelib orion/util orion/webui/dialog".split(" "),function(g,l,k,e,c,h,b){function f(d){this._init(d)}f.prototype=new b.Dialog;f.prototype.TEMPLATE='\x3cdiv role\x3d"search"\x3e\x3cdiv\x3e\x3clabel id\x3d"fileNameMessage" for\x3d"fileName"\x3e${Type the name of a file to open (? \x3d any character, * \x3d any string):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput id\x3d"fileName" type\x3d"text" class\x3d"setting-control" style\x3d"width:90%;"/\x3e\x3c/div\x3e\x3cdiv id\x3d"progress" style\x3d"padding: 2px 0 0; width: 100%;"\x3e\x3cimg src\x3d"'+
e.toUrl("../../../images/progress_running.gif")+'" class\x3d"progressPane_running_dialog" id\x3d"crawlingProgress"\x3e\x3c/img\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:250px; height:auto; overflow-y:auto;" aria-live\x3d"off"\x3e\x3c/div\x3e\x3cdiv id\x3d"statusbar"\x3e\x3c/div\x3e\x3c/div\x3e';f.prototype._init=function(d){this.title=d.title||g["Find File Named"];this.modal=!0;this.messages=g;this._searcher=d.searcher;this._progress=d.progress;this._onHide=d.onHide;this._contentTypeService=
new k.ContentTypeRegistry(this._searcher.registry);if(!this._searcher)throw Error("Missing required argument: searcher");this._searchDelay=d.searchDelay||500;this._time=0;this._searcher.setCrawler(null);this._forceUseCrawler=!1;this._initialText=d.initialText;this._message=d.message;this._nameSearch=!0;void 0!==d.nameSearch&&(this._nameSearch=d.nameSearch);this._searchOnRoot=!0;this._fileService=this._searcher.getFileService();if(!this._fileService)throw Error(g["Missing required argument: fileService"]);
this._searchRenderer=d.searchRenderer;if(!this._searchRenderer||"function"!==typeof this._searchRenderer.makeRenderFunction)throw Error(g["Missing required argument: searchRenderer"]);this._initialize()};f.prototype._bindToDom=function(d){var b=this;b.$crawlingProgress.style.display="none";this._nameSearch?this.$fileName.setAttribute("placeholder",g["FileName FolderName"]):this.$fileName.setAttribute("placeholder",g.Search);this.$fileName.addEventListener("input",function(a){b._time=+new Date;b._timeoutId&&
clearTimeout(b._timeoutId);b._timeoutId=setTimeout(b.checkSearch.bind(b),0)},!1);this.$fileName.addEventListener("keydown",function(a){if(a.keyCode===c.KEY.ENTER){var d=c.$("a",b.$results);d&&(c.stop(a),(h.isMac?a.metaKey:a.ctrlKey)?window.open(d.href):(window.location.href=d.href,b.hide()))}},!1);d.addEventListener("keydown",function(a){var d,f,e;if(a.keyCode===c.KEY.DOWN||a.keyCode===c.KEY.UP)d=c.$$array("a",b.$results),f=document.activeElement,e=d.indexOf(f),a.keyCode===c.KEY.DOWN?0<=e?(f.classList.remove("treeIterationCursor"),
d=e<d.length-1?d[e+1]:d[0],d.focus(),d.classList.add("treeIterationCursor")):0<d.length&&(d=d[0],d.focus(),d.classList.add("treeIterationCursor")):0<=e?(f.classList.remove("treeIterationCursor"),f=b.$fileName,d=0<e?d[e-1]:f,d.focus(),0<e&&d.classList.add("treeIterationCursor")):0<d.length&&(d[d.length-1].focus(),d[d.length-1].classList.add("treeIterationCursor")),c.stop(a)});d.addEventListener("mouseup",function(a){a.target.focus()},!1);setTimeout(function(){if(b._forceUseCrawler||!b._fileService.getService(b._searcher.getSearchLocation()).search){var a=
b._searchOnRoot?b._searcher.getSearchRootLocation():b._searcher.getChildrenLocation(),a=new l.SearchCrawler(b._searcher.registry,b._fileService,"",{searchOnName:!0,location:a});b._searcher.setCrawler(a);a.buildSkeleton(function(){b.$crawlingProgress.style.display="inline";b.$progress.appendChild(document.createTextNode(g["Building file skeleton..."]))},function(){b.$crawlingProgress.style.display="none";b.$progress.removeChild(b.$progress.lastChild)})}},0);this._message&&(this.$fileNameMessage.removeChild(this.$fileNameMessage.firstChild),
this.$fileNameMessage.appendChild(document.createTextNode(this._message)));this._initialText&&(this.$fileName.value=this._initialText,this.doSearch())};f.prototype.checkSearch=function(){clearTimeout(this._timeoutId);var d=(new Date).getTime();d-this._time>this._searchDelay?(this._time=d,this.doSearch()):this._timeoutId=setTimeout(this.checkSearch.bind(this),50)};f.prototype._detectFolderKeyword=function(d){var b,a=d,c=null;if(this._nameSearch&&(b=/(\S+)\s*(.*)/,(d=b.exec(d))&&3===d.length))d[1]&&
(a=d[1]),d[2]&&(c=d[2]);return{keyword:a,folderKeyword:c}};f.prototype.doSearch=function(){var d=this.$fileName.value;if(d){var b=this._detectFolderKeyword(d),a=this._searcher.createSearchParams(b.keyword,this._nameSearch,this._searchOnRoot),f=this._searchRenderer.makeRenderFunction(this._contentTypeService,this.$results,!1,this.decorateResult.bind(this));this.currentSearch=f;var e=document.createElement("div");e.appendChild(document.createTextNode(this._nameSearch?g["Searching..."]:h.formatMessage(g["Searching for occurrences of"],
d)));c.empty(this.$results);this.$results.appendChild(e);this._searcher.search(a,b.folderKeyword,function(){f===this.currentSearch&&f.apply(null,arguments)}.bind(this))}};f.prototype.decorateResult=function(d){function b(d){0===d.button&&!d.ctrlKey&&!d.metaKey&&a.hide()}var a=this;d=c.$$array("a",d);for(var f=0;f<d.length;f++)d[f].addEventListener("click",b,!1)};f.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};f.prototype._afterHiding=function(){this._onHide&&this._onHide()};f.prototype.constructor=
f;return{OpenResourceDialog:f}});define("text!orion/banner/banner.html",[],function(){return'\x3cheader id\x3d"banner" role\x3d"banner"\x3e\n\t\x3c!-- Requires some js code to bind the home link, link to progress image, and binding NLS variables  --\x3e\n\n\t\x3cdiv id\x3d"staticBanner" class\x3d"layoutBlock topRowBanner"\x3e \x3c!-- primaryNav --\x3e\n\t\t\x3cdiv id\x3d"centralNavigationArea" style\x3d"position:absolute;left:0;top:0;width:39px;height:36px; z-index:1;border-right:1px solid #ddd;"\x3e\x3c/div\x3e\n\n\t\t\x3c!-- Static "Home" link. TODO delete this --\x3e\n\t\t\x3ca id\x3d"home" class\x3d"layoutLeft "\x3e\x3c/a\x3e\n\n\t\t\x3c!-- Left banner component: hamburger --\x3e\n\t\t\x3cnav id\x3d"primaryNav" class\x3d"bannerLeftArea" style\x3d"z-index:2;" role\x3d"navigation"\x3e\n\t\t\t\t\x3cbutton class\x3d"centralNavigation commandSprite core-sprite-hamburger" type\x3d"button"id\x3d"centralNavigation"\x3e\x3c/button\x3e\n\t\t\x3c/nav\x3e\n\n\t\t\x3c!-- Middle banner component: Breadcrumb bar --\x3e\n\t\t\x3cdiv class\x3d"clear navigationBreadcrumb bannerMiddleArea" \x3e\n\t\t\t\x3cdiv id\x3d"location" class\x3d"currentLocation"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\n\t\t\x3c!-- Right banner component: user identity --\x3e\n\t\t\x3cdiv class\x3d"bannerRightArea" style\x3d"z-index:2;"\x3e\n\t\t\t\x3c!-- Global commands support. --\x3e\n\t\t\t\x3cdiv id\x3d"globalActions" class\x3d"spacingLeft layoutLeft"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- Search. TODO delete this --\x3e\n\t\t\t\x3cinput type\x3d"text" id\x3d"search" autocomplete\x3d"off" class\x3d"layoutLeft spacingLeft searchbox" role\x3d"search" style\x3d"display:none;"\x3e\n\t\t\t\x3cdiv id\x3d"searchOptions" class\x3d"layoutLeft" style\x3d"padding-top:1px;display:none;"\x3e\x3c/div\x3e\n\n\t\t\t\x3c!-- User identity menu and Progress --\x3e\n\t\t\t\x3cdiv id\x3d"userMenu" class\x3d"spacingRight layoutRight" style\x3d"color:#ccc;line-height:16px;"\x3e\n\t\t\t\t\x3cdiv id\x3d"progressPane" class\x3d"progressWatch" tabindex\x3d"0" role\x3d"progressbar"\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchButton" class\x3d"watchButton"\x3e\x3c/div\x3e\n\t\t\t\t\t\x3cdiv id\x3d"watchBody" class\x3d"watchBody"\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longMinute"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\t\x3cspan class\x3d"hand longHour"\x3e\n\t\t\t\t\t\t\t\x3cspan class\x3d"darkSide"\x3e\x3c/span\x3e\n\t\t\t\t\t\t\x3c/span\x3e\n\t\t\t\t\t\x3c/div\x3e\n\t\t\t\t\x3c/div\x3e\n\t\t\t\t\n\t\t\t\t\x3cdiv style\x3d"position: absolute;right: 0px;top:0;width: 39px;height:36px; z-index:-50;border-left: 1px solid #ddd;"\x3e\x3c/div\x3e\n\t\t\t\t\x3cspan id\x3d"userTrigger" tabindex\x3d"0" role\x3d"button" class\x3d"dropdownTrigger" style\x3d"z-index:2;"\x3e\n\t\t\t\t\x3c/span\x3e\n\t\t\t\t\x3cul id\x3d"userDropdown" class\x3d"dropdownMenu" role\x3d"menu"\x3e\x3c/ul\x3e\n\t\t\t\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\x3c/div\x3e\n\n\t\x3c!-- IDE notification messages go in here --\x3e\n\t\x3cdiv id\x3d"notificationArea" class\x3d"notificationHide"\x3e\n\t\t\x3cdiv class\x3d"layoutLeft" id\x3d"notifications" aria-live\x3d"assertive" aria-atomic\x3d"true"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"layoutRight"\x3e\x3cbutton aria-label\x3d"Close" class\x3d"dismissButton layoutRight core-sprite-close imageSprite" type\x3d"button" id\x3d"closeNotifications"\x3e\x3c/span\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/header\x3e'});
define("text!orion/banner/footer.html",[],function(){return'\x3c!--\n\x3cfooter id\x3d"footerContent" class\x3d"layoutBlock footerLayout" role\x3d"contentinfo"\x3e\n\t\x3cdiv class\x3d"logoFooter commandSprite core-sprite-orion-logo"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"footerBlock"\x3e${Orion is in Beta. Please try it out but BEWARE your data may be lost.}\x3c/div\x3e\n\t\x3cdiv class\x3d"footerRightBlock"\x3e\n\t\t\x3cul\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"https://bugs.eclipse.org/bugs/enter_bug.cgi?product\x3dOrion\x26version\x3d5.0" target\x3d"_blank"\x3e${Report a Bug}\x3c/a\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/privacy.php" target\x3d"_blank"\x3e${Privacy Policy}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/termsofuse.php" target\x3d"_blank"\x3e${Terms of Use}\x3c/a\x3e\x3c/li\x3e\n\t\t\t\x3cli\x3e\x3ca href\x3d"http://www.eclipse.org/legal/copyright.php" target\x3d"_blank"\x3e${Copyright Agent}\x3c/a\x3e\x3c/li\x3e\n\t\t\x3c/ul\x3e\n\t\x3c/div\x3e\n\x3c/footer\x3e\n--\x3e'});
define("text!orion/banner/toolbar.html",[],function(){return'\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"pageActions"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"selectionTools"\x3e\x3c/ul\x3e\n\x3cul class\x3d"layoutLeft commandList pageActions" id\x3d"navActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutLeft" style\x3d"padding-left:7px;padding-right:7px;margin-top:2px;" id\x3d"filterBox" style\x3d"visibility: hidden;"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"settingsActions"\x3e\x3c/ul\x3e\n\x3cdiv class\x3d"layoutRight status" id\x3d"statusPane" role\x3d"status" aria-live\x3d"off"\x3e\x3c/div\x3e\n\x3cul class\x3d"layoutRight commandList pageActions" id\x3d"pageNavigationActions"\x3e\x3c/ul\x3e'});
define("orion/widgets/input/DropDownMenu",["orion/objects","orion/webui/littlelib"],function(g,l){function k(e,c,h){if(e=l.node(e))this._parent=e;else throw Error("Parent node of dropdown menu not found");this.options=h=h||{};this.navDropDownId=this._parent.id+"_navdropdown";this.selectionClass=h.selectionClass;e=document.createElement("div");e.classList.add("dropdownMenu");e.classList.add("dropdownMenuOpen");e.id=this.navDropDownId;e.style.display="none";this._parent.appendChild(e);this._dropdownMenu=
e;if(c=l.node(c))this._triggerNode=c;else throw"Trigger node of dropdown menu not found";"hidden"===this._triggerNode.style.visibility&&(this._triggerNode.style.visibility="visible");h.noClick||(this._triggerNode.onclick=this.click.bind(this));this._dropdownMenu.addEventListener("keydown",function(b){b.keyCode===l.KEY.ESCAPE&&this.clearPanel()}.bind(this))}g.mixin(k.prototype,{click:function(){"none"===this._dropdownMenu.style.display?this.updateContent(this.getContentNode(),function(){l.setFramesEnabled(!1);
this._dropdownMenu.style.display="";this._positionDropdown();this.selectionClass&&this._triggerNode.classList.add(this.selectionClass);this.handle=l.addAutoDismiss([this._triggerNode,this._dropdownMenu],this.clearPanel.bind(this));if(this.options.onShow)this.options.onShow()}.bind(this)):this.clearPanel()},clearPanel:function(){if(this.isVisible()&&(this._dropdownMenu.style.display="none",l.setFramesEnabled(!0),this.selectionClass&&this._triggerNode.classList.remove(this.selectionClass),this.options.onHide))this.options.onHide()},
addContent:function(e){this._dropdownMenu.innerHTML=e},getContentNode:function(){return this._dropdownMenu},updateContent:function(e,c){c()},_positionDropdown:function(){this._dropdownMenu.style.right="";var e=l.bounds(this._dropdownMenu),c=l.bounds(document.body);e.left+e.width>c.left+c.width&&(e=l.bounds(this._boundingNode(this._triggerNode)),c=l.bounds(this._triggerNode),this._dropdownMenu.style.right=e.width-(c.left-e.left+c.width)+"px")},_boundingNode:function(e){var c=window.getComputedStyle(e,
null);return null===c||"absolute"===c.getPropertyValue("position")||!e.parentNode||e===document.body?e:this._boundingNode(e.parentNode)},isDestroyed:function(){return!this._dropdownMenu.parentNode},isVisible:function(){return"none"!==this._dropdownMenu.style.display&&!this.isDestroyed()},focus:function(){this._dropdownMenu.focus()},destroy:function(){this._parent&&(l.setFramesEnabled(!0),l.empty(this._parent),this._parent=this.select=null)}});return k});define("orion/customGlobalCommands",[],function(){return{}});
define("orion/navigate/nls/root/messages",{"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.":"Click one of the tasks below to create an Orion folder.  You can upload, import, or generate files.","Toggle Left Pane":"Toggle Left Pane","Open or close the left pane":"Open or close the left pane",Navigator:"Navigator","Strings Xtrnalizr":"Strings Xtrnalizr","Externalize Strings from JavaScript files in this folder":"Externalize strings from JavaScript files in this folder.",
"Choose a Folder":"Choose a Folder","Copy of ${0}":"Copy of ${0}","Enter a new name for '${0}'":"Enter a new name for '${0}'","Choose folder...":"Choose folder...",Rename:"Rename","Rename the selected files or folders":"Rename the selected files or folders","Compare with each other":"Compare with each other","Compare the selected 2 files with each other":"Compare the selected 2 files with each other","Compare with...":"Compare with...","Compare the selected folder with a specified folder":"Compare the selected folder with a specified folder",
Delete:"Delete","Unknown item":"Unknown item","Are you sure you want to delete these ${0} items?":"Are you sure you want to delete these ${0} items?","Are you sure you want to delete '${0}'?":"Are you sure you want to delete '${0}'?","Export as zip":"Zip","Create a zip file of the folder contents and download it":"Create a zip file of the folder contents and download it","New File":"File","Create a new file":"Create a new file","Name:":"Name:","New Folder":"Folder","Folder name:":"Folder name:","Create a new folder":"Create a new folder",
"Creating folder":"Creating folder",Folder:"Folder","Create an empty folder":"Create an empty folder","Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.":"Create an empty folder on the Orion server.  You can import, upload, or create content in the editor.","Sample HTML5 Site":"Sample HTML5 Site","Generate a sample":"Generate a sample",'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.':'Generate an HTML5 "Hello World" website, including JavaScript, HTML, and CSS files.',
"Creating a folder for ${0}":"Creating a folder for ${0}","SFTP Import":"SFTP Import","Import content from SFTP":"Import content from SFTP","Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.":"Import content from an SFTP location into an Orion folder.  You will be prompted for the SFTP location and credentials.","Imported Content":"Imported Content","Upload a Zip":"Upload a Zip","Upload content from a local zip file":"Upload content from a local zip file",
"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.":"Upload content from a local zip file into an Orion folder.  You will be prompted for the local zip file.","Uploaded Content":"Uploaded Content","Creating an upload folder for ":"Creating an upload folder for ","Clone Git Repository":"Clone Git Repository","Clone a git repository":"Clone a git repository","Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.":"Go to the Orion repositories page to provide a git repository URL.  Once the repository is created, it will appear in the Navigator.",
"Link to Server":"Link to Server","Link to existing content on the server":"Link to existing content on the server","Create a folder that links to an existing folder on the server.":"Create a folder that links to an existing folder on the server.","Server path:":"Server path:","The name and server location were not specified.":"The name and server location were not specified.","Go Up":"Go Up","Move up to the parent folder":"Move up to the parent folder","Go Into":"Go Into","Move into the selected folder":"Move into the selected folder",
"Import local file...":"File System","Copy files and folders from your local file system":"Copy files and folders from your local file system","SFTP from...":"SFTP","Copy files and folders from a specified SFTP connection":"Copy files and folders from a specified SFTP connection","Importing from ${0}":"Importing from ${0}","SFTP to...":"SFTP","Copy files and folders to a specified SFTP location":"Copy files and folders to a specified SFTP location",Exporting:"Exporting to ${0}","Pasting ${0}":"Pasting ${0}",
"Copy to":"Copy to","Move to":"Move to","Copying ${0}":"Copying ${0}","Moving ${0}":"Moving ${0}","Renaming ${0}":"Renaming ${0}","Deleting ${0}":"Deleting ${0}","Creating ${0}":"Creating ${0}","Linking to ${0}":"Linking to ${0}","Move files and folders to a new location":"Move files and folders to a new location",Cut:"Cut",Copy:"Copy","Fetching children of ":"Fetching children of ",Paste:"Paste","Cannot paste into the Workspace root":"Cannot paste into the Workspace root","Open With":"Open With",
"Loading ":"Loading ",New:"New",File:"File",Actions:"Actions","Orion Content":"Orion Content"," is not supported in this file system":" is not supported in this file system","Create new content":"Create new content","Import from HTTP...":"HTTP","File URL:":"File URL:","Copy a file from a URL and optionally unzip it":"Copy a file from a URL and optionally unzip it","Unzip *.zip files:":"Unzip *.zip files:","Extracted from:":"Extracted from:","Did not drop ${0}.  Folder drop is not supported in this browser.":"Did not drop ${0}.  Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace.  Create a folder first.":"You cannot copy files directly into the workspace.  Create a folder first.","Unzip ${0}?":"Unzip ${0}?",NoFile:"Use the ${0} menu to create new files and folders. Click a file to start coding."});define("orion/navigate/nls/messages",["orion/i18n!orion/navigate/nls/messages","orion/navigate/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/fileClient",["i18n!orion/navigate/nls/messages","orion/Deferred","orion/i18nUtil"],function(g,l,k){function e(b,c,d){if(!b[c])throw c+g[" is not supported in this file system"];return b[c].apply(b,d)}function c(b,f,d,m){if(!b.readBlob)throw g["source file service does not support binary read"];if(!d.writeBlob)throw g["target file service does not support binary write"];if("/"!==f[f.length-1])return e(b,"readBlob",[f]).then(function(a){return e(d,"writeBlob",[m,a])});var a=m.substring(0,
m.length-1),n=decodeURIComponent(a.substring(a.lastIndexOf("/")+1)),a=a.substring(0,a.lastIndexOf("/")+1);return e(d,"createFolder",[a,n]).then(function(){},function(){}).then(function(){return e(b,"fetchChildren",[f]).then(function(a){for(var f=[],e=0;e<a.length;++e){var n=a[e].Location,h=n;a[e].Directory&&(h=n.substring(0,n.length-1));h=decodeURIComponent(h.substring(h.lastIndexOf("/")+1));h=m+encodeURIComponent(h);a[e].Directory&&(h+="/");f[e]=c(b,n,d,h)}return l.all(f)})})}function h(b,c){function d(a){var d=
new l;d.reject(g["No Matching FileService for location:"]+a);return d}var e=b.getServiceReferences("orion.core.file"),a=e;if(c)for(var a=[],n=0;n<e.length;++n)c(e[n])&&a.push(e[n]);for(var h=[],t=[],r=[],s=[],w={fetchChildren:function(){var a=new l;a.resolve(s);return a},createWorkspace:function(){var a=new l;a.reject(g["no file service"]);return a},loadWorkspaces:function(){var a=new l;a.reject(g["no file service"]);return a},loadWorkspace:function(a){var d=new l;window.setTimeout(function(){d.resolve({Directory:!0,
Length:0,LocalTimeStamp:0,Name:g["File Servers"],Location:"/",Children:s,ChildrenLocation:"/"})},100);return d},search:d,createProject:d,createFolder:d,createFile:d,deleteFile:d,moveFile:d,copyFile:d,read:d,write:d},e=0;e<a.length;++e)s[e]={Directory:!0,Length:0,LocalTimeStamp:0,Location:a[e].getProperty("top"),ChildrenLocation:a[e].getProperty("top"),Name:a[e].getProperty("Name")},n=a[e].getProperty("pattern")||a[e].getProperty("top").replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"^"!==n[0]&&(n=
"^"+n),h[e]=RegExp(n),t[e]=b.getService(a[e]),r[e]=a[e].getProperty("Name"),a[e].getProperty("NameKey")&&a[e].getProperty("nls")&&k.getMessageBundle(a[e].getProperty("nls")).then(function(d,b){s[d].Name=b[a[d].getProperty("NameKey")];r[d]=b[a[d].getProperty("NameKey")]}.bind(this,e));this._getServiceIndex=function(a){if("/"===a)return-1;if(!a||a.length&&0===a.length)return t[0]?0:-1;for(var d=0;d<h.length;++d)if(h[d].test(a))return d;throw g["No Matching FileService for location:"]+a;};this._getService=
function(a){a=this._getServiceIndex(a);return-1===a?w:t[a]};this._getServiceName=function(a){a=this._getServiceIndex(a);return-1===a?w.Name:r[a]};this._getServiceRootURL=function(a){a=this._getServiceIndex(a);return-1===a?w.Location:s[a].Location}}h.prototype={getService:function(b){return this._getService(b)},fileServiceName:function(b){return this._getServiceName(b)},fileServiceRootURL:function(b){return this._getServiceRootURL(b)},fetchChildren:function(b){return e(this._getService(b),"fetchChildren",
arguments)},createWorkspace:function(b){return e(this._getService(),"createWorkspace",arguments)},loadWorkspaces:function(){return e(this._getService(),"loadWorkspaces",arguments)},loadWorkspace:function(b){return e(this._getService(b),"loadWorkspace",arguments)},createProject:function(b,c,d,m){return e(this._getService(b),"createProject",arguments)},createFolder:function(b,c){return e(this._getService(b),"createFolder",arguments)},createFile:function(b,c){return e(this._getService(b),"createFile",
arguments)},deleteFile:function(b){return e(this._getService(b),"deleteFile",arguments)},moveFile:function(b,f,d){var m=this._getService(b),a=this._getService(f);if(m===a)return e(m,"moveFile",arguments);var n="/"===b[b.length-1],h=f;"/"!==h[h.length-1]&&(h+="/");if(d)h+=encodeURIComponent(d);else{var g=b;n&&(g=g.substring(0,g.length-1));h+=g.substring(g.lastIndexOf("/")+1)}n&&"/"!==h[h.length-1]&&(h+="/");return c(m,b,a,h).then(function(){return e(m,"deleteFile",[b])})},copyFile:function(b,f,d){var m=
this._getService(b),a=this._getService(f);if(m===a)return e(m,"copyFile",arguments);var n="/"===b[b.length-1],h=f;"/"!==h[h.length-1]&&(h+="/");if(d)h+=encodeURIComponent(d);else{var g=b;n&&(g=g.substring(0,g.length-1));h+=g.substring(g.lastIndexOf("/")+1)}n&&"/"!==h[h.length-1]&&(h+="/");return c(m,b,a,h)},read:function(b,c){return e(this._getService(b),"read",arguments)},readBlob:function(b){return e(this._getService(b),"readBlob",arguments)},write:function(b,c,d){return e(this._getService(b),"write",
arguments)},remoteImport:function(b,c){return e(this._getService(b),"remoteImport",arguments)},remoteExport:function(b,c){return e(this._getService(b),"remoteExport",arguments)},search:function(b){return e(this._getService(b.resource),"search",arguments)}};h.prototype.constructor=h;return{FileClient:h}});
define("orion/webui/SideMenu","orion/commands orion/objects orion/webui/littlelib orion/PageLinks orion/PageUtil orion/URITemplate orion/URL-shim orion/util".split(" "),function(g,l,k,e,c,h,b,f){function d(a,d){this.parentNode=k.node(a);this.contentNode=k.node(d);if(!this.parentNode)throw Error("Missing parentNode");this.menuitems=Object.create(null);this.categories=this.links=null;this.anchor=document.createElement("ul");this.anchor.classList.add("sideMenuList");this.parentNode.appendChild(this.anchor);
this.anchor.addEventListener("click",this._handleEvent.bind(this));this.anchor.addEventListener("touchstart",this._handleEvent.bind(this));this.anchor.addEventListener("focus",this._handleEvent.bind(this),!0);k.addAutoDismiss([this.anchor],this._expandMenu.bind(this,null))}function m(a){return!a.isRelatedLink}function a(a,d){var b=a.order,c=d.order;return b<c?-1:c<b?1:0}function n(a,d){var b=a.source.order,c=d.source.order,b="number"===typeof b?b:100,c="number"===typeof c?c:100;return b===c?a.textContent.localeCompare(d.textContent):
b<c?-1:1}var p=f.isTouch;l.mixin(d.prototype,{LOCAL_STORAGE_NAME:"sideMenuNavigation",OPEN_STATE:"open",CLOSED_STATE:"closed",DEFAULT_STATE:"open",SIDE_MENU_OPEN_WIDTH:"40px",TRANSITION_DURATION_MS:301,addMenuItem:function(a,d,b){var c=this.anchor;a=this.createListItem(a,d);b&&a.classList.add("sideMenuItemActive");c.appendChild(a);this.menuitems[d]=a},setSideMenu:function(){var a=this.getDisplayState(),d=this.parentNode;d&&(a===this.CLOSED_STATE&&(this.setPageContentLeft("0"),this._timeout&&(window.clearTimeout(this._timeout),
this._timeout=null),this._timeout=window.setTimeout(function(){d.style.display="none"},this.TRANSITION_DURATION_MS),d.classList.add("animating")),a===this.OPEN_STATE&&(this._timeout&&(window.clearTimeout(this._timeout),this._timeout=null),d.classList.remove("animating"),d.style.display="block",d.style.width=this.SIDE_MENU_OPEN_WIDTH,this.setPageContentLeft(this.SIDE_MENU_OPEN_WIDTH)))},setPageContentLeft:function(a){var d=this.contentNode;d&&(d.style.left=a)},toggleSideMenu:function(){var a=this.getDisplayState(),
d=this.contentNode;d&&d.classList.add("content-fixedHeight-animation");a=a===this.OPEN_STATE?this.CLOSED_STATE:this.OPEN_STATE;a===this.DEFAULT_STATE?localStorage.removeItem(this.LOCAL_STORAGE_NAME):localStorage.setItem(this.LOCAL_STORAGE_NAME,a);this.setSideMenu()},clearMenuItems:function(){this.menuitems=[];k.empty(this.anchor)},getMenuItems:function(){var a=this.menuitems;return Object.keys(a).map(function(d){return a[d]})},getMenuItem:function(a){return this.menuitems[a]},getDisplayState:function(){var a=
localStorage.getItem(this.LOCAL_STORAGE_NAME);a||(a=this.DEFAULT_STATE);return a},createListItem:function(a,d){var b=document.createElement("li");b.className=a;b.classList.add("sideMenuItem");b.categoryId=d;return b},setCategories:function(a){this.categories=a;this.links=Object.create(null)},setPageLinks:function(a){this.pageLinks=a;var d=this,b=a.createLinkElements();a.getAllLinks().forEach(function(a,c){var f=b[c];f.source=a;d._getLinksBin(a.category).push(f)});this._renderLinks()},setRelatedLinks:function(a,
d){this.relatedLinks=a;var b=this;Object.keys(this.links).forEach(function(a){var d=b._getLinksBin(a);b.links[a]=d.filter(m)});var c=document.createDocumentFragment();a.forEach(function(a){var d=a.relatedLink,f=b._getLinksBin(d.category);a=g.createCommandMenuItem(c,a.command,a.invocation);a.classList.remove("dropdownMenuItem");a.isRelatedLink=!0;a.source=d;f.push(a)});this._renderLinks(d)},_getLinksBin:function(a){if(a){var d=this.links;d[a]=d[a]||[];return d[a]}return[]},_sort:function(){var a=this.links;
Object.keys(a).forEach(function(d){a[d].sort(n)})},_renderCategories:function(){var d=this.categories,b=this,f=new URL(window.location.href),m=c.matchResourceParameters();m.OrionHome=e.getOrionHome();var n=!1;this.clearMenuItems();d.getCategoryIDs().map(function(a){return d.getCategory(a)}).sort(a).forEach(function(a){var d=b._getLinksBin(a.id);d.length&&(n?b.addMenuItem(a.imageClass,a.id,!1):(d=d.some(function(a){if(!a.source.uriTemplate)return!1;a=new h(a.source.uriTemplate);a=new URL(a.expand(m),
window.location);return a.protocol===f.protocol&&a.host===f.host&&a.hostname===f.hostname&&a.port===f.port&&a.pathname===f.pathname&&a.search===f.search?n=!0:!1}),b.addMenuItem(a.imageClass,a.id,d)))})},_renderLinks:function(a){a=a||[];this._sort();this._renderCategories();var d=this,b=window.location.href;Object.keys(this.menuitems).forEach(function(c){var f=d.getMenuItem(c);if(f){for(var e=d._getLinksBin(c).slice(),e=e.filter(function(d){var c=d.source;return 0<=a.indexOf(c.id)||!c.default&&!c.force&&
d.href===b?!1:!0}),e=e.filter(function(a){a=a.source;return!(1<e.length&&a.default&&!a.force)}),m=e.length-1;0<m;m--)e[m].href===e[m-1].href&&e.splice(m,1);if(e.length){f.appendChild(d._createCategoryElement(c,f,e[0]));var n=document.createElement("ul");n.className="sideMenuSubMenu";e.forEach(function(a){var d=document.createElement("li");d.className="sideMenuSubMenuItem";var b=document.createElement("a");b.href=a;b.className="sideMenuSubMenuItemLink";var c=document.createElement("span");c.innerHTML=
a.innerHTML;c.className="sideMenuSubMenuItemSpan";b.appendChild(c);d.appendChild(b);n.appendChild(d)});f.appendChild(n)}}})},_createCategoryElement:function(a,d,b){a=this.categories.getCategory(a);var c;p?(c=document.createElement("button"),c.type="button"):(c=document.createElement("a"),c.href=b.href);c.className+=a.imageClass;c.classList.add("submenu-trigger");c.tabIndex="0";d.classList.remove(a.imageClass);return c},_handleEvent:function(a){var d=a.target;a="focus"===a.type;if("A"!==d.tagName||
a)d.classList.contains("submenu-trigger")&&(p||a)&&this._expandMenu(k.$(".sideMenuSubMenu",d.parentNode))},_expandMenu:function(a){this.getMenuItems().forEach(function(d){d=k.$(".sideMenuSubMenu",d);a!==d&&d.classList.remove("expanded")});a&&a.classList.toggle("expanded")}});return d});
define("orion/globalCommands","i18n!orion/nls/messages require orion/commonHTMLFragments orion/keyBinding orion/EventTarget orion/commandRegistry orion/commands orion/parameterCollectors orion/extensionCommands orion/uiUtils orion/keyBinding orion/breadcrumbs orion/webui/littlelib orion/webui/splitter orion/webui/dropdown orion/webui/tooltip orion/contentTypes orion/URITemplate orion/keyAssist orion/PageUtil orion/widgets/themes/ThemePreferences orion/widgets/themes/container/ThemeData orion/Deferred orion/widgets/UserMenu orion/PageLinks orion/webui/dialogs/OpenResourceDialog text!orion/banner/banner.html text!orion/banner/footer.html text!orion/banner/toolbar.html orion/widgets/input/DropDownMenu orion/util orion/customGlobalCommands orion/fileClient orion/webui/SideMenu orion/objects".split(" "),function(g,
l,k,e,c,h,b,f,d,m,a,n,p,t,r,s,w,v,u,y,x,z,q,A,B,C,I,N,H,E,D,F,G,O,U){function J(a,d){if(a.getLabel)return a.getLabel();var b=new q;b.resolve(d.properties.name);return b}function $(a){p.node("progressPane").setAttribute("aria-label",g["Operations - Press spacebar to show current operations"]);(a=a.getService("orion.page.progress"))&&a.init.bind(a)("progressPane")}function P(a,d){var b=a.getServiceReferences("orion.core.auth");ba=[];var c=V.createMenuGenerator.apply(this,arguments);if(c)for(var f=0;f<
b.length;f++){var q=b[f],e=a.getService(q);J(e,q).then(function(a){e.getKey().then(function(d){ba.push(d);e.getUser().then(function(b){c.addUserItem(d,e,a,b)},function(b,f){c.addUserItem(d,e,a,f)});window.addEventListener("storage",function(b){L[d]!==localStorage.getItem(d)&&(L[d]=localStorage.getItem(d),e.getUser().then(function(b){c.addUserItem(d,e,a,b)},function(b){c.addUserItem(d,e,a)}))},!1)})})}}function R(a){return a}function W(a,c,f,e,m){function B(){if(k)return k;var d=a.getService("orion.core.contentTypeRegistry");
d||(d=new w.ContentTypeRegistry(a),d=a.getService("orion.core.contentTypeRegistry"));return d.getContentTypes().then(function(a){return k=a})}function A(a){for(var d={},b=a.getPropertyKeys(),c,f=0;f<b.length;f++)c=b[f],d[c]=a.getProperty(c);return d}function n(a,d){var b=null;a.some(function(a){return d===a.getProperty("id")?!!(b=a):!1});return b}function h(a){var d=a.command;return!d.visibleWhen||d.visibleWhen(c)?(a.invocation=new b.CommandInvocation(c,c,null,d,e),(new q).resolve(a)):"function"===
typeof m?(C||(C=m()),q.when(C,function(f){if(f&&c===ca&&(!d.visibleWhen||d.visibleWhen(f)))return a.invocation=new b.CommandInvocation(f,f,null,d,e),a})):(new q).resolve()}function g(a,d,c){return c?(new q).resolve({relatedLink:a,command:c}):d.then(function(d){return{relatedLink:a,command:new b.Command(d)}})}var p=arguments,k,C,t=a&&a.getServiceReferences("orion.page.link.related");if(t&&0!==t.length){var I=this;q.when(B(),function(){if(V.beforeGenerateRelatedLinks.apply(I,p)){var b=a.getServiceReferences("orion.navigate.command"),
c=[];t.forEach(function(f){var q=A(f);if(q.id){var m;if((q.nls&&q.nameKey||q.name)&&q.uriTemplate)m=d._createCommandOptions(q,f,a,k,!0),c.push(g(q,m,null));else if(m=n(b,q.id)){var B=A(m);f={};U.mixin(f,B,q);(q=e.findCommand(q.id))?c.push(g(f,null,q)):(m=d._createCommandOptions(B,m,a,k,!0),c.push(g(f,m,null)))}}});q.all(c,R).then(function(a){a.sort(function(a,d){return a.command.name.localeCompare(d.command.name)});return q.all(a.map(h),R).then(function(d){var b=[];d=d.filter(function(d,c){if(d)return!0;
b.push(a[c]);return!1});V.addRelatedLinkCommands.call(I,e,d,b,f);V.afterGenerateRelatedLinks.apply(I,p)})})}})}}function T(a){var d=p.node("globalActions");d&&(a.destroy(d),a.renderCommands(d.id,d,{},{},"tool"))}function Z(a){var d=window.getComputedStyle(a,null);return null===d||"absolute"===d.getPropertyValue("position")||!a.parentNode||a===document.body?a:Z(a.parentNode)}function Q(a){var d={},b=null;"string"===typeof a&&(a=p.node(a));a||(a=p.node("pageActions"));for(var c=a;c&&c.classList;){if(c.classList.contains("toolComposite")){b=
c;break}c=c.parentNode}a.classList.contains("commandMarker")&&(d.commandNode=a);b&&(d.slideContainer=p.$(".slideParameters",b),d.parameterArea=p.$(".parameters",b),d.dismissArea=p.$(".parametersDismiss",b),d.notifications=p.$("#notificationArea",b),b.parentNode&&(d.toolbarTarget=p.$(".toolbarTarget",b.parentNode),d.toolbarTarget&&(a=p.bounds(d.toolbarTarget),c=p.bounds(Z(d.toolbarTarget.parentNode)),d.toolbarTargetY=a.top-c.top,d.toolbar=b)));return d}function K(a){if(a=a.slideContainer)if(a.style.left=
"",a.style.top="",a.classList.contains("slideContainerActive")){var d=p.bounds(a),b=p.bounds(a.parentNode);a.style.left=(b.width-d.width)/2+"px";a.style.top="0"}}h=function(a){var d=document.createElement("a");d.href=a;return d.href}(l.toUrl("auth/NotifyAuthentication.html"));var L={},M=null,V={createMenuGenerator:F.createMenuGenerator||function(a,d){if(p.node("userMenu")){var b=p.node("userDropdown"),c=new r.Dropdown({dropdown:b}),b=new A.UserMenu({dropdownNode:b,dropdown:c,serviceRegistry:a}),c=
p.node("userTrigger");new s.Tooltip({node:c,text:g.Options,position:["below","left"]});c=document.getElementById("userTrigger");c.className+=" imageSprite core-sprite-silhouette";b.setKeyAssist(d);return b}},beforeGenerateRelatedLinks:F.beforeGenerateRelatedLinks||function(a,d,b,c,f){return!0},addRelatedLinkCommands:F.addRelatedLinkCommands||function(a,d,b,c){this.sideMenu&&this.sideMenu.setRelatedLinks(d,c)},afterGenerateRelatedLinks:F.afterGenerateRelatedLinks||function(a,d,b,c,f){},afterSetPageTarget:F.afterSetPageTarget||
function(a){},generateNavigationMenu:F.generateNavigationMenu||function(a,d,b,c,f,q,e){if(a=p.node("sideMenu"))d=p.node("centralNavigation"),new s.Tooltip({node:d,text:g.CentralNavTooltip,position:["right"]}),M=this.sideMenu=new O(a,p.node("pageContent")),d.addEventListener("click",M.toggleSideMenu.bind(M)),(a=p.node("sideMenuToggle"))&&a.addEventListener("click",M.toggleSideMenu.bind(M))},afterGenerateNavigationMenu:F.afterGenerateNavigationMenu||function(a,d,b,c,f,q,e){},afterGenerateBanner:F.afterGenerateBanner||
function(a,d,b,c,f,q,e){}},ba=[],ca,aa=[],S,Y=null,X=null,da=new c;return{generateBanner:function(a,d,c,m,A,n,h,r){function G(a){a.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";for(var d=p.$$array(".targetSelector"),b=0;b<d.length;b++)d[b].target=a}},{pid:"nav.config"})}(new x.ThemePreferences(m,new z.ThemeData)).apply();var s=p.node(a);if(!s)throw g["could not find banner parent, id was "]+a;var E=document.createRange();
E.selectNode(s);E=E.createContextualFragment(I);p.processTextNodes(E,g);s.firstChild?s.insertBefore(E,s.firstChild):s.appendChild(E);s=p.node("home");s.href=l.toUrl("edit/edit.html");s.setAttribute("aria-label",g["Orion Home"]);p.node("progressPane").src=b.NO_IMAGE;if(s=p.node("pageToolbar"))s.classList.add("toolbarLayout"),s.innerHTML=H+k.slideoutHTMLFragment("mainToolbar");(s=p.node("closeNotifications"))&&s.setAttribute("aria-label",g["Close notification"]);if(17>=D.isFirefox&&(s=p.node("staticBanner")))s.style.width=
"100%",s.style.MozBoxSizing="border-box";if(s=p.node("footer"))s.innerHTML=N,p.processTextNodes(s,g);c.setParameterCollector(new f.CommandParameterCollector(Q,K));document.addEventListener("keydown",function(a){a.keyCode===p.KEY.ESCAPE&&(a=d.getService("orion.page.message"))&&a.setProgressMessage("")},!1);V.generateNavigationMenu.apply(this,arguments);V.afterGenerateNavigationMenu.apply(this,arguments);s=B.getCategoriesInfo(d);E=B.getPageLinksInfo(d,"orion.page.link");q.all([s,E]).then(function(a){if(M){var d=
a[1];M.setCategories(a[0]);M.setPageLinks(d);M.setSideMenu()}});if(s=p.$(".split")){var E=p.$(".sidePanelLayout"),w=p.$(".mainPanelLayout");E&&w&&(Y={side:E,main:w},Y.splitter=new t.Splitter({node:s,sidePanel:E,mainPanel:w,toggle:!0,closeByDefault:r}),s=new b.Command({name:g["Toggle side panel"],tooltip:g["Open or close the side panel"],id:"orion.toggleSidePane",callback:function(){Y.splitter.toggleSidePanel()}}),c.addCommand(s),c.registerCommandContribution("pageActions","orion.toggleSidePane",1,
null,!0,new e.KeyBinding("l",D.isMac?!1:!0,!0,!1,D.isMac?!0:!1)))}var F=!1,v=function(a,d){if(!F){var b=d.getService("orion.page.progress"),c=new C.OpenResourceDialog({searcher:a,progress:b,searchRenderer:a.defaultRenderer,onHide:function(){F=!1}});window.setTimeout(function(){F=!0;c.show()},0)}},s=new b.Command({name:g["Find File Named..."],tooltip:g["Choose a file by name and open an editor on it"],id:"orion.openResource",callback:function(a){v(A,d)}});c.addCommand(s);c.registerCommandContribution("globalActions",
"orion.openResource",100,null,!0,new e.KeyBinding("f",!0,!0));s=new b.Command({name:g["Toggle banner and footer"],tooltip:g["Hide or show the page banner and footer"],id:"orion.toggleTrim",callback:function(){var a=p.node("banner"),d=p.node("footer"),b=p.node("sideMenu"),c=p.$(".content-fixedHeight"),f="hidden"===a.style.visibility;f?(a.style.visibility="visible",d.style.visibility="visible",c.classList.remove("content-fixedHeight-maximized"),b&&b.classList.remove("sideMenu-maximized")):(a.style.visibility=
"hidden",d.style.visibility="hidden",c.classList.add("content-fixedHeight-maximized"),b&&b.classList.add("sideMenu-maximized"));da.dispatchEvent({type:"toggleTrim",maximized:!f});return!0}});c.addCommand(s);c.registerCommandContribution("globalActions","orion.toggleTrim",100,null,!0,new e.KeyBinding("m",!0,!0));s=new b.Command({name:g["System Configuration Details"],tooltip:g["System Config Tooltip"],id:"orion.configDetailsPage",hrefCallback:function(){return l.toUrl("help/about.html")}});c.addCommand(s);
c.registerCommandContribution("globalActions","orion.configDetailsPage",100,null,!0,new e.KeyBinding(112,!0,!0));s=new b.Command({name:g["Background Operations"],tooltip:g["Background Operations Tooltip"],id:"orion.backgroundOperations",hrefCallback:function(){return l.toUrl("operations/list.html")}});c.addCommand(s);c.registerCommandContribution("globalActions","orion.backgroundOperations",100,null,!0,new e.KeyBinding("o",!0,!0));X=new u.KeyAssistPanel({commandRegistry:c});s=new b.Command({name:g["Show Keys"],
tooltip:g["Show a list of all the keybindings on this page"],id:"orion.keyAssist",callback:function(){X.isVisible()?X.hide():X.show();return!0}});c.addCommand(s);c.registerCommandContribution("globalActions","orion.keyAssist",100,null,!0,new e.KeyBinding(191,!1,!0));T(c);P(d,s.callback);$(d);window.addEventListener("hashchange",function(){c.processURL(window.location.href)},!1);window.setTimeout(function(){G(d)},0);V.afterGenerateBanner.apply(this,arguments)},getToolbarElements:Q,getMainSplitter:function(){return Y},
getKeyAssist:function(){return X},getGlobalEventTarget:function(){return da},layoutToolbarElements:K,setPageTarget:function(a){var d,b,c=a.breadcrumbRootName,f=a.serviceRegistry;a.target?(a.searchService&&a.searchService.setLocationByMetaData(a.target),a.fileService&&!a.breadcrumbTarget&&!a.staticBreadcrumb&&(b=(c?c+" ":"")+a.fileService.fileServiceName(a.target.Location),c=null),d=a.name||a.target.Name,ca=a.target,W.call(this,f,a.target,aa,a.commandService,a.makeAlternate)):(a.breadcrumbTarget||
(c=c||a.task||a.name),d=a.name,W.call(this,f,{NoTarget:""},aa,a.commandService,a.makeAlternate));(S=a.title)||(S=d?d+" - "+a.task:a.task);window.document.title=S;V.afterSetPageTarget.apply(this,arguments);if(d=a.breadCrumbContainer?p.node(a.breadCrumbContainer):p.node("location"))if(p.empty(d),a.staticBreadcrumb)new n.BreadCrumbs({container:d,rootSegmentName:c});else{var q=f&&new G.FileClient(f),f=a.breadcrumbTarget||a.target,q=q&&f&&f.Location?q.fileServiceRootURL(f.Location):null;new n.BreadCrumbs({container:d,
resource:f,rootSegmentName:c,workspaceRootSegmentName:b,workspaceRootURL:q,makeFinalHref:a.makeBreadcrumFinalLink,makeHref:a.makeBreadcrumbLink})}},setDirtyIndicator:function(a){S&&("*"===S.charAt(0)&&!a&&(S=S.substring(1)),a&&"*"!==S.charAt(0)&&(S="*"+S),window.document.title=S);var d=p.node("dirty");d&&(d.textContent=a?"*":"")},setPageCommandExclusions:function(a){aa=a},notifyAuthenticationSite:h}});
define("orion/urlUtils",["orion/PageUtil","orion/URL-shim"],function(g){return{detectValidURL:function(l){for(var k=/\[([^\]]*)\]\(([^\)]+)\)/g,e=k.exec(l),c=[],h=0;e;){if(3===e.length&&0<e[2].length){var b=new URL(e[2]);":"!==b.protocol&&g.validateURLScheme(b.href)&&(e.index>h&&c.push({segmentStr:l.substring(h,e.index)}),c.push({segmentStr:0<e[1].length?e[1]:e[2],urlStr:e[2]}),h=e.index+e[0].length)}e=k.exec(l)}if(0===h)return null;h<l.length-1&&c.push({segmentStr:l.substring(h)});return c},processURLSegments:function(g,
k){k.forEach(function(e){if(e.urlStr){var c=document.createElement("a");c.href=e.urlStr;c.appendChild(document.createTextNode(e.segmentStr))}else c=document.createElement("span"),c.textContent=e.segmentStr;g.appendChild(c)})}}});
define("orion/status",["i18n!orion/nls/messages","orion/webui/littlelib","orion/globalCommands","orion/urlUtils"],function(g,l,k,e){function c(b,c,d,e,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.message",this);this._operationsClient=c;this.notificationContainerDomId=a;this.domId=d;this.progressDomId=e||d;this._hookedClose=!1;this._timer=null;this._clickToDisMiss=!0;this._cancelMsg=null}var h;c.prototype={_init:function(){var b=l.node("closeNotifications");if(b&&
!this._hookedClose){b.style.cursor="pointer";this._hookedClose=!0;var c=l.node(this.notificationContainerDomId);l.addAutoDismiss([c],function(){this._clickToDisMiss&&this.close()}.bind(this));b.addEventListener("click",function(){this.close()}.bind(this));c.addEventListener("click",function(d){d&&d.target&&"a"===d.target.nodeName.toLowerCase()&&(d=l.$$("a",c))&&d.length&&1===d.length&&this.close()}.bind(this))}},close:function(){window.clearTimeout(this._timer);var b=l.node("closeNotifications");
this._cancelMsg&&this._cancelFunc&&b?(b.innerHTML="",b.classList.remove("cancelButton"),b.classList.add("dismissButton"),b.classList.add("core-sprite-close"),b.classList.add("imageSprite"),this._cancelFunc(),this._cancelMsg=null):this.setProgressMessage("")},_getNotifierElements:function(){this._notifierElements||(this._notifierElements=k.getToolbarElements(this.notificationContainerDomId));return this._notifierElements},setMessage:function(b,c,d){this._init();this.currentMessage=b;var e=l.node(this.domId);
if("boolean"===typeof d){var a=e.getAttribute("aria-live");e.setAttribute("aria-live",d?"polite":"off");window.setTimeout(function(){b===this.currentMessage&&(l.empty(e),e.appendChild(document.createTextNode(b)),window.setTimeout(function(){e.setAttribute("aria-live",a)},100))}.bind(this),100)}else l.empty(e),e.appendChild(document.createTextNode(b));"number"===typeof c&&window.setTimeout(function(){b===this.currentMessage&&(l.empty(e),e.appendChild(document.createTextNode("")))}.bind(this),c)},setErrorMessage:function(b){this._clickToDisMiss=
!0;this.currentMessage=b;this._init();var c=b.responseText||b.message||b;if("string"===typeof c)try{c=JSON.parse(c)}catch(d){}b=c.Message||c;var e="red";if(c.Severity)switch(c.Severity){case "Warning":e="#FFCC00";break;case "Error":e="red";break;case "Info":case "Ok":e="green"}c=document.createElement("span");c.style.color=e;c.appendChild(document.createTextNode(b));b=l.node(this.domId);l.empty(b);b.appendChild(c)},setProgressMessage:function(b){this._clickToDisMiss=!1;this._init();this.currentMessage=
b;var c=document.createElement("span");c.classList.add("progressIcon");var d=l.node(this.progressDomId);l.empty(d);d.appendChild(c);d.appendChild(document.createTextNode(b));c=l.node(this.notificationContainerDomId);c.classList.remove("notificationHide");if(b&&0<b.length)c.classList.add("progressNormal"),c.classList.add("notificationShow");else{if(this._progressMonitors&&0<this._progressMonitors.length)return this._renderOngoingMonitors();c.classList.remove("notificationShow");c.classList.add("notificationHide")}},
setCancelFunction:function(b){this._cancelFunc=b},setProgressResult:function(b,c){this._clickToDisMiss=!1;this._cancelMsg=c;this.currentMessage=b;var d=b.responseText||b;if("string"===typeof d)try{d=JSON.parse(d)}catch(m){}this._init();var a=d.Message||d.toString(),n=g.UnknownError,h="core-sprite-information",k="progressNormal",r=document.createElement("span");r.classList.add("imageSprite");r.classList.add("progressIcon");var s=[];if(d.Severity)switch(d.Severity){case "Warning":n=g.UnknownWarning;
h="core-sprite-warning";k="progressWarning";s.push("progressInfo");s.push("progressError");s.push("progressNormal");this._clickToDisMiss=!0;break;case "Error":h="core-sprite-error";k="progressError";s.push("progressWarning");s.push("progressInfo");s.push("progressNormal");this._clickToDisMiss=!0;break;default:k="progressNormal",s.push("progressWarning"),s.push("progressError"),s.push("progressNormal")}s.push("notificationHide");r.classList.add(h);var w=l.node(this.progressDomId),h=l.node(this.notificationContainerDomId);
l.empty(w);w.appendChild(r);a===Object.prototype.toString()&&(a=n);d.HTML?(d=document.createElement("span"),d.innerHTML=a,w.appendChild(d)):((n=e.detectValidURL(a))?(a=document.createDocumentFragment(),e.processURLSegments(a,n),Array.prototype.forEach.call(l.$$("a",a),function(a){a.target="_blank"})):("Warning"!==d.Severity&&"Error"!==d.Severity&&!c&&(this._timer&&window.clearTimeout(this._timer),this._timer=window.setTimeout(function(){this.setProgressMessage("");this._timer=null}.bind(this),5E3)),
a=document.createTextNode(a)),w.appendChild(a));if(k&&this.progressDomId!==this.domId){h.classList.add(k);for(k=0;k<s.length;k++)h.classList.remove(s[k])}h.classList.add("notificationShow");if(s=l.node("closeNotifications"))this._cancelMsg?(s.classList.add("cancelButton"),s.classList.remove("dismissButton"),s.classList.remove("core-sprite-close"),s.classList.remove("imageSprite"),s.innerHTML=this._cancelMsg):(s.innerHTML="",s.classList.remove("cancelButton"),s.classList.add("dismissButton"),s.classList.add("core-sprite-close"),
s.classList.add("imageSprite"))},showWhile:function(b,c){var d=this;if(c){d.setProgressMessage(c);var e=function(){c===d.currentMessage&&d.setProgressMessage("")};b.then(e,e)}return b},_lastProgressId:0,_progressMonitors:{length:0},createProgressMonitor:function(b,c){return new h(this,++this._lastProgressId,b,c)},_renderOngoingMonitors:function(){if(0<this._progressMonitors.length){var b="",c=!0,d;for(d in this._progressMonitors)this._progressMonitors[d].status&&(c||(b+=", "),b+=this._progressMonitors[d].status,
c=!1);this.setProgressMessage(b)}else this.setProgressMessage("")},_beginProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._progressMonitors.length++;this._renderOngoingMonitors()},_workedProgressMonitor:function(b){this._progressMonitors[b.progressId]=b;this._renderOngoingMonitors()},_doneProgressMonitor:function(b){delete this._progressMonitors[b.progressId];this._progressMonitors.length--;b.status?this.setProgressResult(b.status):this._renderOngoingMonitors()}};c.prototype.constructor=
c;h=function(b,c,d,e){this.statusService=b;this.progressId=c;if(d){this.deferred=d;this.begin(e);var a=this;d.then(function(d,b){a.done.bind(a)()},function(d,b){a.done.bind(a)()})}};h.prototype.begin=function(b){this.status=b;this.statusService._beginProgressMonitor(this)};h.prototype.done=function(b){this.status=b;this.statusService._doneProgressMonitor(this)};h.prototype.worked=function(b){this.status=b;this.statusService._workedProgressMonitor(this)};h.prototype.constructor=h;return{StatusReportingService:c,
ProgressMonitor:h}});
define("orion/operations/nls/root/messages",{More:"More","No Matching OperationService for location:":"No Matching OperationService for location:","No operations services registered.":"No operations services registered.","could not find toolbar ":"could not find toolbar ","Remove Completed":"Remove Completed","Remove all completed operations":"Remove all completed operations",Remove:"Remove","Remove operations from the operations list.":"Remove operations from the operations list.",Cancel:"Cancel",
"Cancel operations from the operations list.":"Cancel operations from the operations list.","Operation resulted in a warning.":"Operation resulted in a warning.","Operation resulted in an error.":"Operation resulted in an error.","Operation is running.":"Operation is running.","Operation is canceled.":"Operation is canceled.","Operation failed.":"Operation failed.",Name:"Name",Actions:"Actions",Status:"Status",Scheduled:"Scheduled"});
define("orion/operations/nls/messages",["orion/i18n!orion/operations/nls/messages","orion/operations/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/webui/popupdialog",["i18n!orion/widgets/nls/messages","require","orion/webui/littlelib","orion/webui/tooltip"],function(g,l,k,e){function c(){}c.prototype={_initialize:function(c,b,f,d,m){this._tooltip=new e.Tooltip({node:c,hideDelay:m||0,afterShowing:this._afterShowingFunction(b).bind(this),afterHiding:f,trigger:d?d:"click"});this.$parent=this._tooltip.contentContainer();this.$parent.role="dialog";c=document.createRange();c.selectNode(this.$parent);c=c.createContextualFragment(this.TEMPLATE);
this.messages&&k.processTextNodes(c,g);this.$parent.appendChild(c);var a=this._tooltip;this.$parent.addEventListener("keydown",function(d){d.keyCode===k.KEY.ESCAPE&&a.hide()},!1);this._bindElements(this.$parent);"function"===typeof this._bindToDom&&this._bindToDom(this.$parent)},_bindElements:function(c){for(var b=0;b<c.childNodes.length;b++){var f=c.childNodes[b];f.id&&(this["$"+f.id]=f);this._bindElements(f)}},_afterShowingFunction:function(c){return function(){c&&c.bind(this)();if(!this.customFocus){var b=
k.firstTabbable(this.$parent);b&&b.focus()}}},hide:function(){this._tooltip.hide()},show:function(){this._tooltip.show()}};c.prototype.constructor=c;return{PopupDialog:c}});
define("orion/operationsCommands",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/commands"],function(g,l,k,e){var c={};(function(){var h=!1;c.updateNavTools=function(b,c,d,e,a,n){var p=k.node(e);if(p)c.destroy(p);else throw g["could not find toolbar "]+e;c.renderCommands(e,p,n,d,"button");if(a&&(e=k.node(a)))c.destroy(e),c.renderCommands(a,e,null,d,"button");h||(h=!0,b.getService("orion.page.selection").addEventListener("selectionChanged",function(b){var e=k.node(a);
e&&(c.destroy(e),c.renderCommands(a,e,b.selections,d,"button"))}))};c.createOperationsCommands=function(b,c,d){function m(a){return!a.operation||!a.operation.type?!1:"loadstart"===a.operation.type||"progress"===a.operation.type}var a=new e.Command({name:g["Remove Completed"],tooltip:g["Remove all completed operations"],id:"eclipse.removeCompletedOperations",callback:function(a){d.removeCompletedOperations().then(function(a){c.loadOperations.bind(c)()})},visibleWhen:function(a){return!0}});b.addCommand(a);
a=new e.Command({name:g.Remove,tooltip:g["Remove operations from the operations list."],imageClass:"core-sprite-delete",id:"eclipse.removeOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var b=0;b<a.length;b++){var e=a[b];d.removeOperation.bind(d)(e.Location).then(function(){c.loadOperations.bind(c)()},function(){c.loadOperations.bind(c)()})}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return!m(a);for(var d in a)if(m(a[d]))return!1;return!0}});b.addCommand(a);
a=new e.Command({name:g.Cancel,tooltip:g["Cancel operations from the operations list."],imageClass:"core-sprite-stop",id:"eclipse.cancelOperation",callback:function(a){a=Array.isArray(a.items)?a.items:[a.items];for(var d=0;d<a.length;d++){var b=a[d];b.deferred&&b.deferred.cancel()}},visibleWhen:function(a){if(!Array.isArray(a)||0===a.length)return m(a)&&(a.operation&&a.operation.cancelable?!0:!1);for(var d in a)if(!m(a[d])||!a[d].operation||!a[d].operation.cancelable)return!1;return!0}});b.addCommand(a)}})();
return c});
define("orion/webui/dialogs/OperationsDialog",["i18n!orion/operations/nls/messages","require","orion/webui/littlelib","orion/webui/popupdialog","orion/operationsCommands"],function(g,l,k,e,c){function h(b){this._options=b}h.prototype=new e.PopupDialog;h.prototype.TEMPLATE='\x3ctable style\x3d"width: 360px;"\x3e\x3ctr\x3e\x3ctd\x3e\x3ch2\x3eRecent operations\x3c/h2\x3e\x3c/td\x3e\x3ctd style\x3d"text-align: right;"\x3e\x3ca id\x3d"allOperationsLink" class\x3d"navlinkonpage"\x3eAll Operations\x3c/a\x3e\x3c/td\x3e\x3c/tr\x3e\x3c/table\x3e\x3cdiv id\x3d"operationsExist"\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"myOperationsListEmpty"\x3eNo operations running on this page.\x3c/div\x3e\x3ctable id\x3d"myOperationsList" style\x3d"display: none;"\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv style\x3d"padding-left: 7px" id\x3d"operationsDontExist"\x3eNo operations running.\x3c/div\x3e';h.prototype._init=
function(b){this._myOperations=[];this._operationsDeferreds=[];this._commandService=b.commandRegistry;c.createOperationsCommands(this._commandService);this._commandService.registerCommandContribution("operationsDialogItems","eclipse.cancelOperation",1);this._initialize(b.triggerNode)};h.prototype._bindToDom=function(b){this.$allOperationsLink.href=l.toUrl("operations/list.html");this._setOperationsVisibility()};h.prototype.setOperations=function(b,c){this._myOperations||this._init(this._options);
this._myOperations=[];this._operationsDeferreds=[];if(b)for(var d in b)this._myOperations.push(b[d]),this._operationsDeferreds.push(c[d]);this._renderOperations()};h.prototype.parseProgressResult=function(b){if(!b)return{};b=b.responseText||b;try{b=JSON.parse(b)}catch(c){}var d={Message:b.Message||b,Severity:b.Severity};b.DetailedMessage&&b.DetailedMessage!==d.Message&&(d.DetailedMessage=b.DetailedMessage);return d};h.prototype._renderOperations=function(){this._renderOperationsTable(this.$myOperationsList,
this._myOperations,this._operationsDeferreds)};h.prototype._renderOperationsTable=function(b,c,d){k.empty(b);for(var e=0;e<c.length;e++){var a=c[e],n=document.createElement("tr"),h=document.createElement("td");h.style.paddingLeft="5px";h.style.paddingRight="5px";h.textContent=a.Name;n.appendChild(h);var t=document.createElement("div");h.appendChild(t);h=document.createElement("span");h.style.paddingRight="5px";h.classList.add("imageSprite");switch(a.type){case "Warning":h.classList.add("core-sprite-warning");
h.setAttribute("aria-label",g["Operation resulted in a warning."]);break;case "error":h.classList.add("core-sprite-error");h.setAttribute("aria-label",g["Operation resulted in an error."]);break;case "loadstart":case "progress":h.classList.add("core-sprite-start");h.setAttribute("aria-label",g["Operation is running."]);break;case "abort":h.classList.add("core-sprite-stop");h.setAttribute("aria-label",g["Operation is canceled."]);break;case "load":case "loadend":h.classList.add("core-sprite-ok"),h.setAttribute("aria-label",
"Operation ok.")}t.appendChild(h);h=document.createElement("span");h.classList.add("operationStatus");h.textContent=a.Name;t.appendChild(h);if(a.error){var l=a.error.Message||a.error;a.error.DetailedMessage&&""!==a.error.DetailedMessage&&(l+=": "+a.error.DetailedMessage);h.textContent=l;h.classList.remove("operationStatus");h.classList.add("operationError")}this._commandService.renderCommands("operationsDialogItems",t,{operation:a,deferred:d[e]},this,"tool");b.appendChild(n)}this._setOperationsVisibility()};
h.prototype._setOperationsVisibility=function(){this.$myOperationsList.style.display=0<this._myOperations.length?"":"none";this.$myOperationsListEmpty.style.display=0<this._myOperations.length?"none":"";this.$operationsDontExist.style.display=0<this._myOperations.length?"none":"";this.$operationsExist.style.display=0<this._myOperations.length?"":"none"};h.prototype.constructor=h;return{OperationsDialog:h}});
define("orion/progress",["i18n!orion/nls/messages","require","orion/Deferred","orion/webui/littlelib","orion/webui/dialogs/OperationsDialog"],function(g,l,k,e,c){function h(b,d){if(!this._progressPane){this._progressPane=e.node(b);this._operationsDialog=new c.OperationsDialog({triggerNode:this._progressPane,commandRegistry:d});var m=this;this._progressPane.addEventListener("keydown",function(a){(" "===a.charOrCode||a.keyCode===e.KEY.ENTER)&&m._operationsDialog.show()});this._progressPane.addEventListener("click",
function(a){m._operationsDialog.show()});this._operationsDialog.setOperations(null,null)}}function b(b,d,c,a){this._serviceRegistry=b;this._serviceRegistration=b.registerService("orion.page.progress",this);this._commandRegistry=c;this._operationsClient=d;this._operations={};this._operationDeferrds={};this._operationsIndex=0;this._lastIconClass=this._lastOperation=null;this._progressMonitorClass=a}h.prototype={_switchIconTo:function(b){this._lastIconClass&&this._progressPane.classList.remove(this._lastIconClass);
this._lastIconClass=b;this._progressPane.classList.add(this._lastIconClass)},generateOperationsInfo:function(b,d){var c={},a;for(a in b)b[a].progressMonitor||(c[a]=b[a]);if(this._isEmpty(c))this._switchIconTo("progressPane_empty"),this._progressPane.title=g.Operations,this._progressPane.alt=g.Operations,this._progressPane.hasAttribute("aria-valuetext")&&this._progressPane.removeAttribute("aria-valuetext");else{var e="";for(a in c){var h=c[a];if(h.type&&("loadstart"===h.type||"progress"===h.type)){e=
"running";break}}""===e&&null!=this._lastOperation&&this._lastOperation.type&&"error"===this._lastOperation.type&&"error"==e;switch(e){case "running":this._progressPane.title=g["Operations running"];this._progressPane.alt=g["Operations running"];this._progressPane.setAttribute("aria-valuetext",g["Operations running"]);this._switchIconTo("running");break;case "warning":this._progressPane.title=g["Some operations finished with warning"];this._progressPane.alt=g["Some operations finished with warning"];
this._progressPane.setAttribute("aria-valuetext",g["Some operations finished with warning"]);this._switchIconTo("warning");break;case "error":this._progressPane.title=g["Some operations finished with error"];this._progressPane.alt=g["Some operations finished with error"];this._progressPane.setAttribute("aria-valuetext",g["Some operations finished with error"]);this._switchIconTo("error");break;default:this._progressPane.title=g.Operations,this._progressPane.alt=g.Operations,this._progressPane.hasAttribute("aria-valuetext")&&
this._progressPane.removeAttribute("aria-valuetext"),this._switchIconTo("progressPane_empty")}}this._operationsDialog.setOperations(c,d)},_isEmpty:function(b){for(var d in b)return!1;return!0}};h.prototype.constructor=h;b.prototype={init:function(b){this._progressMonitorClass||(this._progressMonitorTool=new h(b,this._commandRegistry))},progress:function(b,d,c){var a=this,e=this._operationsIndex++;!c&&this._progressMonitorClass&&(c=new this._progressMonitorClass,c.begin(d));b.then(function(h){a._operations[e]&&
(h=a._operations[e],d&&(h.Name=d),a._lastOperation=h,h.type="loadend",c&&(h.progressMonitor=c),a.writeOperation.bind(a)(e,h,b),h.Location||a._removeOperationFromTheList.bind(a)(e))},function(h){if(a._operations[e]){var g=a._operations[e];d&&(g.Name=d);c&&(g.progressMonitor=c);a._lastOperation=g;g.type=h.canceled?"abort":"error";g.error=h;a.writeOperation.bind(a)(e,g,b);g.Location||a._removeOperationFromTheList.bind(a)(e)}},function(h){d&&(h.Name=d);c&&(h.progressMonitor=c);a.writeOperation.bind(a)(e,
h,b)});return b},removeOperation:function(b){for(var d in this._operations)if(this._operations[d].Location&&this._operations[d].Location===b){this._removeOperationFromTheList(d);break}this._operationsClient.removeOperation.bind(this._operationsClient)(b)},_removeOperationFromTheList:function(b){var d=this._operations[b].progressMonitor;delete this._operations[b];delete this._operationDeferrds[b];d?d.done():this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},
removeCompletedOperations:function(){for(var b in this._operations){var d=this._operations[b];d.type&&"loadstart"!==d.type&&"progress"!==d.type&&((d=this._operations[b].progressMonitor)&&d.done(),delete this._operations[b],delete this._operationDeferrds[b])}this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)},setProgressResult:function(b){this._serviceRegistry.getService("orion.page.message").setProgressResult(b)},showWhile:function(b,d,c){d&&this._serviceRegistry.getService("orion.page.message").setProgressMessage(d);
var a=this;b.then(function(d){a._serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(d){c?a._serviceRegistry.getService("orion.page.message").setProgressMessage(""):a.setProgressResult.bind(a)(d);return d});return this.progress(b,d)},writeOperation:function(b,d,c){this._operations[b]=d;this._operationDeferrds[b]=c;d.Location&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/operations").then(function(a){a.put(d.Location,{Name:d.Name,expires:d.expires})});
d.progressMonitor?d.progressMonitor.progress(d.Name):this._progressMonitorTool.generateOperationsInfo(this._operations,this._operationDeferrds)}};b.prototype.constructor=b;return{ProgressService:b}});define("orion/dialogs",[],function(){function g(g){this._serviceRegistry=g;this._serviceRegistration=g.registerService("orion.page.dialog",this)}g.prototype={confirm:function(g,k){k(window.confirm(g))},openFiles:function(g){}};g.prototype.constructor=g;return{DialogService:g}});
define("orion/selection",["orion/EventTarget","orion/Deferred"],function(g,l){function k(e,c){c||(c="orion.page.selection");this._serviceRegistry=e;g.attach(this);this._serviceRegistration=e.registerService(c,this);this._selections=null}k.prototype={getSelection:function(e){var c=this._getSingleSelection();"function"===typeof e&&e(c);return c},getSelections:function(e){var c=Array.isArray(this._selections)?this._selections.slice():[];"function"===typeof e&&e(c);return c},_getSingleSelection:function(){return this._selections&&
0<this._selections.length?this._selections[0]:null},setSelections:function(e){var c=this._selections;Array.isArray(e)?this._selections=0<e.length?e.slice():null:this._selections=e?[e]:null;c!==this._selections&&this.dispatchEvent({type:"selectionChanged",selection:this._getSingleSelection(),selections:this._selections})}};k.prototype.constructor=k;return{Selection:k}});
define("orion/operationsClient",["i18n!orion/operations/nls/messages","orion/Deferred"],function(g,l){function k(b,c,d){return b[c].apply(b,d)}function e(b){this._location=b}function c(){var b=new l;b.reject(g["No Matching OperationService for location:"]+this._location);return b}function h(b){this._services=[];this._patterns=[];this._operationListeners=[];this._currentLongpollingIds=[];this._preferenceService=b.getService("orion.core.preference");for(var c=b.getServiceReferences("orion.core.operation"),
d=0;d<c.length;d++){var m=b.getService(c[d]);this._services[d]=m;m=c[d].getProperty("pattern")||".*";"^"!==m[0]&&(m="^"+m);this._patterns[d]=RegExp(m)}this._getService=function(a){if(!a)return this._services[0];for(var d=0;d<this._patterns.length;++d)if(this._patterns[d].test(a))return this._services[d];this._operations.remove(a);return new e(a)}}e.prototype={getOperation:c,getOperations:c,removeCompletedOperations:c,removeOperation:c,cancelOperation:c};e.prototype.constructor=e;h.prototype={getOperations:function(){var b=
new l;if(this._operations)return b.resolve(this._operations),b;var c=this;this._preferenceService.getPreferences("/operations").then(function(d){c._operations=d;b.resolve(c._operations)});return b},getOperation:function(b){return k(this._getService(b),"getOperation",arguments)},removeCompletedOperations:function(){for(var b=[],c=this,d=0;d<this._services.length;d++){var e=this._patterns[d],a=new l;b[d]=a.promise;k(this._services[d],"removeCompletedOperations").then(function(a){return function(d){Array.isArray(d)&&
c.getOperations.bind(c)().then(function(b){for(var c=b.keys(),f=0;f<c.length;f++){var h=c[f];e.test(h)&&0>d.indexOf(h)&&b.remove(h)}a.resolve()})}}(a),function(a){return function(d){a.reject(d)}}(a))}return l.all(b)},removeOperation:function(b){var c=this;return k(this._getService(b),"removeOperation",arguments).then(function(d){c.getOperations.bind(c)().then(function(d){d.remove(b)})},function(d){return d},function(d){return d})}};h.prototype.constructor=h;return{OperationsClient:h}});
define("orion/search/nls/root/messages",{"Find:":"Find:","Find With":"Find With","ReplaceWith:":"ReplaceWith:","Replace With":"Replace With","Show all":"Show all","Wrap search":"Wrap search","Incremental search":"Incremental search","Whole Word":"Whole Word","Regular expression":"Regular expression","Find after replace":"Find after replace",Options:"Options","Find next match":"Find next match","Find previous match":"Find previous match",Next:"Next",Previous:"Previous",Replace:"Replace","Replace All":"Replace All",
"Search ${0}":"Search ${0}","Type a keyword or wild card to search in ":"Type a keyword or wild card to search in ","Search failed.":"Search failed.","No matches found for ${0}":"No matches found for ${0}","Searching...":"Searching...","Resource has been changed by others.":"Resource has been changed by others.","Failed to write file.":"Failed to write file.",Results:"Results","Files ${0} of ${1} matching ${2}":"Files ${0} of ${1} matching ${2}","Replace ${0} with ${1} for files ${2} of ${3}":"Replace ${0} with ${1} for files ${2} of ${3}",
Location:"Location","Click to compare":"Click to compare",'Search again in this folder with "${0}"':'Search again in this folder with "${0}"',"Files replaced":"Files replaced",Status:"Status","${0} out of ${1}  matches replaced.":"${0} out of ${1}  matches replaced.","Replace all matches with...":"Replace all matches with...","Apply Changes":"Apply Changes","Replace all selected matches":"Replace all selected matches","Hide Compare":"Hide Compare","Hide compare view of changes":"Hide compare view of changes",
"Show Compare":"Show Compare","Show compare view of changes":"Show compare view of changes","Show All":"Show All","Show all the results in one page":"Show all the results in one page","\x3c Previous Page":"\x3c Previous Page","Show previous page of search result":"Show previous page of search result","Next Page \x3e":"Next Page \x3e","Show next page of search result":"Show next page of search result","Next result":"Next result","Previous result":"Previous result","Expand all results":"Expand all results",
"Collapse all results":"Collapse all results","Writing files...":"Writing files...","Preparing preview...":"Preparing preview...","Replaced File (${0})":"Replaced File (${0})","Original File (${0})":"Original File (${0})","Sort by Name":"Sort by Name","Compare changes":"Compare changes","Search Results":"Search Results","Replace All Matches":"Replace All Matches","No matches":"No matches",Rename:"Rename","My Saved Searches":"My Saved Searches","Save frequently used searches by choosing ${0} shown above.":"Save frequently used searches by choosing ${0} shown above.",
"Save frequently used searches by clicking on the ${0} button above.":"Save frequently used searches by clicking on the ${0} button above.","Files that contain:":"Files that contain:",Search:"Search","All types":"All types","File type":"File type","All ${0} files":"All ${0} files","${0} is already saved":"${0} is already saved","Type a search term":"Type a search term","Type a replace term":"Type a replace term","Case sensitive":"Case sensitive","Sort by":"Sort by","File name":"File name","Path name":"Path name",
Save:"Save","Type a name for the search":"Type a name for the search","Save the current search":"Save the current search","Type filter text":"Type filter text","Scope Search":"Scope Search","Open in Search page for this directory":"Open the Search page for this folder.","${0}. Try your search again.":"${0}. Try your search again.","Click or use delete key to delete the search term":"Click or use delete key to delete the search term","${0} matches":"${0} matches","Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",
"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.":"Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e.",root:"root",Scope:"Scope"});
define("orion/search/nls/messages",["orion/i18n!orion/search/nls/messages","orion/search/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/webui/treetable",["i18n!orion/nls/messages","orion/webui/littlelib"],function(g,l){function k(e){this._init(e)}k.prototype={_init:function(e){var c=e.parent,h=this,c=l.node(c);if(!c)throw g["no parent"];if(!e.model)throw g["no tree model"];if(!e.renderer)throw g["no renderer"];this._parent=c;this._treeModel=e.model;this._onComplete=e.onComplete;this._renderer=e.renderer;this._showRoot=void 0===e.showRoot?!1:e.showRoot;this._indent=void 0===e.indent?16:e.indent;this._onCollapse=e.onCollapse;
this._labelColumnIndex=void 0===e.labelColumnIndex?0:e.labelColumnIndex;this._id=void 0===e.id?"treetable":e.id;this._tableStyle=e.tableStyle;this._tableElement=e.tableElement||"table";this._tableBodyElement=e.tableBodyElement||"tbody";this._tableRowElement=e.tableRowElement||"tr";this._root=this._treeModel.getRoot(function(b){h._showRoot?(b._depth=0,h._generate([b],0)):h._treeModel.getChildren(b,function(b){h.destroyed||h._generate(b,0)})})},destroy:function(){this.destroyed=!0},_generate:function(e,
c){l.empty(this._parent);var h=document.createElement("div");this._renderer.wrapperCallback&&this._renderer.wrapperCallback(h);var b=document.createElement(this._tableElement);this._renderer.tableCallback&&this._renderer.tableCallback(b);b.id=this._id;this._tableStyle&&b.classList.add(this._tableStyle);this._renderer.initTable(b,this);this._bodyElement=document.createElement(this._tableBodyElement);this._renderer.bodyCallback&&this._renderer.bodyCallback(this._bodyElement);this._bodyElement.id=this._id+
"tbody";0===e.length?this._renderer.emptyCallback&&this._renderer.emptyCallback(this._bodyElement):this._generateChildren(e,c);b.appendChild(this._bodyElement);h.appendChild(b);this._parent.appendChild(h);this._rowsChanged();this._onComplete&&this._onComplete(this)},_generateChildren:function(e,c,h){for(var b=0;b<e.length;b++){var f=document.createElement(this._tableRowElement);f.id=this._treeModel.getId(e[b]);f._depth=c;f._item=e[b];this._renderer.render(e[b],f);f.childNodes[this._labelColumnIndex].style.paddingLeft=
this._indent*c+"px";this._renderer.rowCallback&&this._renderer.rowCallback(f,e[b]);h?(this._bodyElement.insertBefore(f,h.nextSibling),h&&(h=f)):this._bodyElement.appendChild(f)}},_rowsChanged:function(){this._renderer.rowsChanged&&this._renderer.rowsChanged()},getSelected:function(){return this._renderer.getSelected()},refresh:function(e,c,h){var b=this._treeModel.getId(e),f;if(b===this._id)this._removeChildRows(b),this._generateChildren(c,0),this._rowsChanged();else{var d=l.node(b);d?(d._item=e,
d&&(h||d._expanded)?(this._removeChildRows(b),c?(d._expanded=!0,this._renderer.updateExpandVisuals(d,!0),this._generateChildren(c,d._depth+1,d),this._rowsChanged()):(f=this,this._renderer.updateExpandVisuals(d,"progress"),c=this._treeModel.getChildren(d._item,function(b){f.destroyed||(f._renderer.updateExpandVisuals(d,!0),d._expanded||(d._expanded=!0,f._generateChildren(b,d._depth+1,d),f._rowsChanged()))}))):this._renderer.updateExpandVisuals(d,!1)):console.log(g["could not find table row "]+b)}},
getItem:function(e){var c=l.node(e);return c&&c._item?c._item:e},toggle:function(e){var c=l.node(e);c&&(c._expanded?this.collapse(e):this.expand(e))},isExpanded:function(e){e="string"===typeof e?e:this._treeModel.getId(e);return(e=l.node(e))?e._expanded:!1},expand:function(e,c,h){e="string"===typeof e?e:this._treeModel.getId(e);var b=l.node(e);if(b){var f=this;b._expanded?c&&c.apply(f,h):(this._renderer.updateExpandVisuals(b,"progress"),this._treeModel.getChildren(b._item,function(d){f.destroyed||
(f._renderer.updateExpandVisuals(b,!0),b._expanded||(b._expanded=!0,f._generateChildren(d,b._depth+1,b),f._rowsChanged()),c&&c.apply(f,h))}))}},_removeChildRows:function(e){for(var c=e===this._id,h=!1,b=-1,f=[],d=l.$$array(".treeTableRow",this._parent),m=0;m<d.length;m++){var a=d[m];if(h)break;c?a._depth>b?f.push(a):h=!0:a.id===e&&(c=!0,b=a._depth)}for(e=0;e<f.length;e++)c=f[e],c.parentNode.removeChild(c)},collapse:function(e){e="string"===typeof e?e:this._treeModel.getId(e);var c=l.node(e);if(c){if(!c._expanded)return;
c._expanded=!1;this._renderer.updateExpandVisuals(c,!1);this._removeChildRows(e);this._rowsChanged()}this._onCollapse&&this._onCollapse(c._item)},getIndent:function(){return this._indent}};k.prototype.constructor=k;return{TableTree:k}});
define("orion/treeModelIterator",[],function(){var g={};g.TreeModelIterator=function(){function g(k,e){this.firstLevelChildren=k;this.reset();this._init(e)}g.prototype={_init:function(g){g&&(this.isExpanded=g.isExpanded,this.isExpandable=g.isExpandable,this.forceExpandFunc=g.forceExpandFunc,this.getChildrenFunc=g.getChildrenFunc)},topLevel:function(g){return g.parent?g.parent===this.root:!0},_getChildren:function(g){return"function"===typeof this.getChildrenFunc?this.getChildrenFunc(g):g?g.children:
null},_expanded:function(g){if(!g)return!0;var e=this._getChildren(g),e=e&&0<e.length;this.isExpanded&&e&&(e=this.isExpanded(g));return e},_expandable:function(g){return!g?!0:this.isExpandable?this.isExpandable(g):!1},_diveIn:function(g){return this._expanded(g)?(g=this._getChildren(g),this.setCursor(g[0]),this.cursor()):null},_drillToLast:function(g){return this._expanded(g)?(g=this._getChildren(g),this._drillToLast(g[g.length-1])):g},_forward:function(g){if(!this._cursor)return null;var e=this._diveIn(this._cursor);
if(!e){if(g&&this._expandable(this._cursor)&&this.forceExpandFunc){var c=this;return this.forceExpandFunc(this._cursor,"first",function(e){e&&c.setCursor(e)})}(e=this._findSibling(this._cursor,!0))&&this.setCursor(e)}return e},_backward:function(g){if(!this._cursor)return null;var e=this._findSibling(this._cursor,!1);e&&e!==this._cursor.parent&&(e=this._drillToLast(e));if(g&&e&&this._expandable(e)&&this.forceExpandFunc&&e!==this._cursor.parent){var c=this;return this.forceExpandFunc(e,"last",function(e){e&&
c.setCursor(e)})}e&&this.setCursor(e);return e},_findSibling:function(g,e){for(var c=this.topLevel(g),h=this._getChildren(g.parent),h=c?this.firstLevelChildren:h,b=0;b<h.length;b++)if(h[b]===g)return 0===b&&!e?c?null:g.parent:b===h.length-1&&e?c?null:this._findSibling(g.parent,e):e?h[b+1]:h[b-1];return null},_inParentChain:function(g,e){for(var c=g.parent;c;){if(c===e)return!0;c=c.parent}return!1},_getTopLevelParent:function(g){if(this.topLevel(g))return g;for(g=g.parent;g;){if(this.topLevel(g))return g;
g=g.parent}return null},_onCollapse:function(g){return this._expanded(g.parent)?g:this._onCollapse(g.parent)},_scan:function(g,e,c){this.setCursor(e);var h=[];for(h.push(e);;){if(this.iterate(g))h.push(this.cursor());else break;if(c===this.cursor())return h}return null},setCursor:function(g){this._prevCursor=this._cursor;this._cursor=g},setTree:function(g){this.firstLevelChildren=g;0<this.firstLevelChildren.length&&(this.root=this.firstLevelChildren[0].parent)},scan:function(g,e){var c=this.cursor(),
h=this._scan(!0,g,e);h||(h=this._scan(!1,g,e));this.setCursor(c);return h},iterate:function(g,e){return g?this._forward(e):this._backward(e)},iterateOnTop:function(g,e){var c=this._findSibling(this._getTopLevelParent(this.cursor()),g);c?this.setCursor(c):e&&0<this.firstLevelChildren.length&&this.setCursor(g?this.firstLevelChildren[0]:this.firstLevelChildren[this.firstLevelChildren.length-1])},collapse:function(g){return!this._cursor?null:this._inParentChain(this._cursor,g)?(this.setCursor(g),this._cursor):
null},reset:function(){this.root=this._prevCursor=this._cursor=null;0<this.firstLevelChildren.length&&(this._cursor=this.firstLevelChildren[0],this.root=this.firstLevelChildren[0].parent)},cursorMoved:function(){return this._cursor!==this._prevCursor},cursor:function(){return this._cursor},prevCursor:function(){return this._prevCursor}};return g}();return g});
define("orion/explorers/explorerNavHandler",["orion/webui/littlelib","orion/treeModelIterator","orion/uiUtils"],function(g,l,k){var e={},c=-1!==navigator.userAgent.indexOf("iPad"),h=-1!==window.navigator.platform.indexOf("Mac");e.ExplorerNavHandler=function(){function b(b,d,c){this.explorer=b;this.model=this.explorer.model;this._navDict=d;this._listeners=[];this._selections=[];this._currentColumn=0;b=this._getEventListeningDiv();b.tabIndex=0;b.classList.add("selectionModelContainer");var a=this;this._modelIterator=
new l.TreeModelIterator([],{isExpanded:this.isExpanded.bind(this),getChildrenFunc:c.getChildrenFunc,isExpandable:this.explorer.renderer.isExpandable?function(d){return a.explorer.renderer.isExpandable(d)}:function(d){return a.isExpandable(d)},forceExpandFunc:this.explorer.forceExpandFunc?function(d,b,c){return a.explorer.forceExpandFunc(d,b,c)}:void 0});this._init(c);(!c||!1!==c.setFocus)&&b.focus();c=function(d){if(k.isFormElement(d.target)||a.explorer.preventDefaultFunc&&a.explorer.preventDefaultFunc(d,
a._modelIterator.cursor()))return!0;if(d.keyCode===g.KEY.DOWN)return a.onDownArrow(d);if(d.keyCode===g.KEY.UP)return a.onUpArrow(d);if(d.keyCode===g.KEY.RIGHT)return a.onRightArrow(d);if(d.keyCode===g.KEY.LEFT)return a.onLeftArrow(d);if(d.keyCode===g.KEY.SPACE)return a.onSpace(d);if(d.keyCode===g.KEY.ENTER)return a.onEnter(d)};b.addEventListener("keydown",c,!1);this._listeners.push({type:"keydown",listener:c});c=function(d){if(a.explorer.onFocus)a.explorer.onFocus(!1);else a.toggleCursor(null,!1)};
b.addEventListener("blur",c,!1);this._listeners.push({type:"blur",listener:c});c=function(d){if(a.explorer.onFocus)a.explorer.onFocus(!0);else a.toggleCursor(null,!0)};b.addEventListener("focus",c,!1);this._listeners.push({type:"focus",listener:c});this._parentDiv=b}b.prototype={destroy:function(){this._parentDiv.classList.remove("selectionModelContainer");this.removeListeners()},_init:function(b){this._linearGridMove=!1;b&&(this._selectionPolicy=b.selectionPolicy,this.gridClickSelectionPolicy=b.gridClickSelectionPolicy||
"none",this.preventDefaultFunc=b.preventDefaultFunc,this.postDefaultFunc=b.postDefaultFunc)},_ctrlKeyOn:function(b){return h?b.metaKey:b.ctrlKey},removeListeners:function(){if(this._listeners)for(var b=0;b<this._listeners.length;b++)this._parentDiv.removeEventListener(this._listeners[b].type,this._listeners[b].listener,!1)},focus:function(){var b=this._getEventListeningDiv();b&&b.focus()},_getEventListeningDiv:function(b){return this.explorer.keyEventListeningDiv&&"function"===typeof this.explorer.keyEventListeningDiv?
this.explorer.keyEventListeningDiv(b):g.node(this.explorer._parentId)},isExpandable:function(b){return!b?!1:g.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)))?!0:!1},isExpanded:function(b){return!b?!1:this.explorer.myTree.isExpanded(this.model.getId(b))},refreshSelection:function(b,d){var c=this;this.explorer.selection&&this.explorer.selection.getSelections(function(a){c._clearSelection(d);for(var e=0;e<a.length;e++)c._selections.push(a[e]);0<c._selections.length?c.cursorOn(c._selections[0],
!0,!1,b):c.cursorOn(null,!1,!1,b);c._shiftSelectionAnchor&&0<=c._inSelection(c._shiftSelectionAnchor)||(c._shiftSelectionAnchor=null)})},refreshModel:function(b,d,c,a){this._currentColumn=0;this.topIterationNodes=[];this.model=d;this._navDict=b;this.model.getTopIterationNodes?this.topIterationNodes=this.model.getTopIterationNodes():c&&(this.topIterationNodes=c);this._modelIterator.setTree(this.topIterationNodes);!a&&this.explorer.selection&&(this.toggleCursor(this._modelIterator.cursor(),!1),this._modelIterator.reset());
this.refreshSelection(!0)},getTopLevelNodes:function(){return this._modelIterator.firstLevelChildren},_inSelection:function(b){b=this.model.getId(b);for(var d=0;d<this._selections.length;d++)if(b===this.model.getId(this._selections[d]))return d;return-1},_clearSelection:function(b){if(b)for(b=0;b<this._selections.length;b++)this._checkRow(this._selections[b],!0);this._selections=[]},getSelectionPolicy:function(){return this._selectionPolicy},setSelectionPolicy:function(b){this._selectionPolicy!==
b&&(("readonlySelection"===this._selectionPolicy||"readonlySelection"===b)&&this._toggleSelectionClass("disabledRow","readonlySelection"===b),this._selectionPolicy=b,"cursorOnly"===this._selectionPolicy&&this._clearSelection(!0))},setSelection:function(b,d,c){"readonlySelection"!==this._selectionPolicy&&("cursorOnly"===this._selectionPolicy?d&&this.explorer.renderer._useCheckboxSelection&&this._checkRow(b,!0):this._isRowSelectable(b)&&(!d||"singleSelection"===this._selectionPolicy?(this._clearSelection(!0),
this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b):(d=this._inSelection(b),0<=d?(this._checkRow(b,!0),this._selections.splice(d,1)):(this._checkRow(b,!1),this._selections.push(b),this._lastSelection=b)),c&&(this._shiftSelectionAnchor=this._lastSelection),this.explorer.selection&&(this.explorer.renderer.storeSelections(),this.explorer.selection.setSelections(this._selections))))},moveColumn:function(b,d){b||(b=this.currentModel());var c=this._getGridChildren(b);if(c&&1<c.length||
0===d&&c){0!==d&&this.toggleCursor(b,!1);var a=this._currentColumn,e=!0,a=a+d;0>a?(this._linearGridMove&&0!==d&&(this._modelIterator.iterate(!1)?b=this.currentModel():e=!1),a=e?c.length-1:this._currentColumn):a>=c.length&&(this._linearGridMove&&0!==d&&(this._modelIterator.iterate(!0)?b=this.currentModel():e=!1),a=e?0:this._currentColumn);this._currentColumn=a;0!==d&&this.toggleCursor(b,!0);return!0}return!1},_getGridChildren:function(b){return this._navDict?this._navDict.getGridNavHolder(b):null},
getCurrentGrid:function(b){b||(b=this.currentModel());return(b=this._getGridChildren(b))&&0<b.length?b[this._currentColumn]:null},getAriaContainerElement:function(b){for(var d=this._parentDiv,c;b&&b!==d&&"grid"!==(c=b.getAttribute("role"))&&"tree"!==c&&"treegrid"!==c;)b=b.parentNode;return b===d?null:b},toggleCursor:function(b,d){var c=this.getRowDiv(b),a=this.getCurrentGrid(b);a?(c&&(d?c.classList.add("treeIterationCursorRow"):c.classList.remove("treeIterationCursorRow")),a.domNode&&(c=this.getAriaContainerElement(a.domNode),
d?(a.domNode.classList.add("treeIterationCursor"),c&&c.setAttribute("aria-activedescendant",a.domNode.id)):a.domNode.classList.remove("treeIterationCursor"))):c&&(d?c.classList.add("treeIterationCursorRow_Dotted"):c.classList.remove("treeIterationCursorRow_Dotted"))},currentModel:function(){return this._modelIterator.cursor()},cursorOn:function(b,d,c,a){var e,h;if(b||d){if(h===this._modelIterator.cursor())return;e=this._modelIterator.cursor();h=b;this._modelIterator.setCursor(h)}else e=this._modelIterator.prevCursor(),
h=this._modelIterator.cursor();if(e!==h||d)if(this.toggleCursor(e,!1),!d||h){this.moveColumn(null,0);this.toggleCursor(h,!0);if((b=this.getRowDiv())&&!a){a=b.parentNode;for(d=document.documentElement;a&&a!==d;){var g=window.getComputedStyle(a,null);if(!g)break;g=g.getPropertyValue("overflow-y");if("auto"===g||"scroll"===g)break;a=a.parentNode}a&&(d=!0,b.offsetTop<=a.scrollTop?(d=!1,void 0===c&&(c=!1)):b.offsetTop+b.offsetHeight>=a.scrollTop+a.clientHeight&&(d=!1,void 0===c&&(c=!0)),d||b.scrollIntoView(!c))}if(this.explorer.onCursorChanged)this.explorer.onCursorChanged(e,
h)}},getSelection:function(){return this._selections},getSelectionIds:function(){for(var b=[],d=0;d<this._selections.length;d++)b.push(this.model.getId(this._selections[d]));return b},getRowDiv:function(b){b=b?b:this._modelIterator.cursor();if(!b)return null;b=this.model.getId(b);var d=this._navDict.getValue(b);return d&&d.rowDomNode?d.rowDomNode:g.node(b)},iterate:function(b,d,c,a){var e=null;if(this.topIterationNodes&&0!==this.topIterationNodes.length)if(a){a=this.currentModel();for((e=this._modelIterator.iterate(b,
d))&&this._setCursorOnItem(b,c);e&&e.isNotSelectable;)(e=this._modelIterator.iterate(b,d))&&this._setCursorOnItem(b,c);e||(this.cursorOn(a,!0,!1,!0),this._setCursorOnItem(b,c))}else this._modelIterator.iterate(b,d)&&this._setCursorOnItem(b,c)},_toggleSelectionClass:function(b,d){this._selections.forEach(function(c){(c=this.getRowDiv(c))&&(d?c.classList.add(b):c.classList.remove(b))}.bind(this))},_setCursorOnItem:function(b,d){this.cursorOn(null,!1,b);if(d){var c=this._inSelection(this._modelIterator.prevCursor()),
a=this._inSelection(this._modelIterator.cursor());0<=c&&0<=a?this.setSelection(this._modelIterator.prevCursor(),!0):this.setSelection(this.currentModel(),!0)}},_checkRow:function(b,d){if(this.explorer.renderer._useCheckboxSelection&&"singleSelection"!==this._selectionPolicy){var c=this.getRowDiv(b);if(c){var a=g.node(this.explorer.renderer.getCheckBoxId(c.id)),e=d?!a.checked:!0;if(e!==a.checked)this.explorer.renderer.onCheck(c,a,e,!0)}}else this._select(b,d)},_select:function(b,d){b||(b=this._modelIterator.cursor());
var c=this.getRowDiv(b);c&&(0>this._inSelection(b)?c.classList.add("checkedRow"):c.classList.remove("checkedRow"))},_onModelGrid:function(b,d){var c=this._getGridChildren(b);if(c)for(var a=0;a<c.length;a++)if(d.target===c[a].domNode)return!0;return!1},onClick:function(b,d){if("readonlySelection"===this._selectionPolicy||this.isDisabled(this.getRowDiv(b)))g.stop(d);else{var e=g.node(this.explorer.renderer.expandCollapseImageId(this.model.getId(b)));if(d.target!==e&&!("none"===this.gridClickSelectionPolicy&&
this._onModelGrid(b,d)))if(this.cursorOn(b,!0,!1,!0),c)this.setSelection(b,!0);else if(this._ctrlKeyOn(d))this.setSelection(b,!0,!0);else if(d.shiftKey&&this._shiftSelectionAnchor){if(e=this._modelIterator.scan(this._shiftSelectionAnchor,b)){this._clearSelection(!0);for(var a=0;a<e.length;a++)this.setSelection(e[a],!0)}}else this.setSelection(b,!1,!0)}},onCollapse:function(b){this._modelIterator.collapse(b)&&this.cursorOn()},onUpArrow:function(b){this.iterate(!1,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&
!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},onDownArrow:function(b){this.iterate(!0,!1,b.shiftKey,!0);!this._ctrlKeyOn(b)&&!b.shiftKey&&this.setSelection(this.currentModel(),!1,!0);b.preventDefault();return!1},_shouldMoveColumn:function(b){var d=this.currentModel(),c=this._getGridChildren(d);return c&&1<c.length?this.isExpandable(d)?this._ctrlKeyOn(b):!0:!1},onLeftArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,-1),b.preventDefault(),
!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&this.isExpanded(d))return this.explorer.myTree.collapse(d),b.preventDefault(),!0;this._modelIterator.topLevel(d)?this.explorer.scopeUp&&"function"===typeof this.explorer.scopeUp&&this.explorer.scopeUp():(this.cursorOn(d.parent),this.setSelection(d.parent,!1,!0))},onRightArrow:function(b){if(this._shouldMoveColumn(b))return this.moveColumn(null,1),b.preventDefault(),!0;var d=this._modelIterator.cursor();if(!d)return!1;if(this.isExpandable(d)&&
!this.isExpanded(d))return this.explorer.myTree.expand(d),this.explorer.postUserExpand&&this.explorer.postUserExpand(this.model.getId(d)),b.preventDefault(),!1},_isRowSelectable:function(b){return this.explorer.isRowSelectable?this.explorer.isRowSelectable(b):!0},onSpace:function(b){this.setSelection(this.currentModel(),!0,!0);b.preventDefault()},onEnter:function(b){var d=this.getCurrentGrid(this._modelIterator.cursor());if(d)if(d.widget)if("function"===typeof d.onClick)d.onClick();else"function"===
typeof d.widget.focus&&d.widget.focus();else{var c=document.createEvent("MouseEvents");c.initMouseEvent("click",!0,!0,window,0,0,0,0,0,this._ctrlKeyOn(b),!1,!1,!1,0,null);d.domNode.dispatchEvent(c)}else if(d=this._modelIterator.cursor())if(this.explorer.renderer.getRowActionElement&&(c=this.explorer.renderer.getRowActionElement(this.model.getId(d)),c.href&&(this._ctrlKeyOn(b)?window.open(c.href):window.location.href=c.href)),this.explorer.renderer.performRowAction)return this.explorer.renderer.performRowAction(b,
d),b.preventDefault(),!1},setIsNotSelectable:function(b,d){b.isNotSelectable=d},disableItem:function(b){var d=this.getRowDiv(b);this.isExpandable(b)&&this.isExpanded(b)&&(this._modelIterator.collapse(b),this.explorer.myTree.toggle(d.id));d.classList.remove("checkedRow");d.classList.add("disabledNavRow");this.setIsNotSelectable(b,!0)},isDisabled:function(b){return b.classList.contains("disabledNavRow")},enableItem:function(b){var d=this.getRowDiv(b);d&&(d.classList.remove("disabledNavRow"),this.setIsNotSelectable(b,
!1))}};return b}();e.ExplorerNavDict=function(){function b(b){this._dict={};this._model=b}b.prototype={addRow:function(b,d){var c=this._model.getId(b);this._dict[c]={model:b,rowDomNode:d}},getValue:function(b){return this._dict[b]},getGridNavHolder:function(b,d){if(!b)return null;var c=this._model.getId(b);return this._dict[c]?(!this._dict[c].gridChildren&&d&&(this._dict[c].gridChildren=[]),this._dict[c].gridChildren):null},initGridNavHolder:function(b){if(!b)return null;b=this._model.getId(b);this._dict[b]&&
(this._dict[b].gridChildren=null)}};return b}();return e});
define("orion/explorers/explorer","i18n!orion/nls/messages require orion/webui/littlelib orion/webui/treetable orion/explorers/explorerNavHandler orion/commands".split(" "),function(g,l,k,e,c,h){var b={};b.Explorer=function(){function b(d,c,a,f){this.registry=d;this.renderer=a;this.selection=c;this.commandService=f;this.renderer&&(this.renderer.explorer=this);this.myTree=null}b.prototype={destroy:function(){this._navHandler&&this._navHandler.destroy();this.model&&this.model.destroy();this.myTree&&
this.myTree.destroy();this.destroyed=!0},changedItem:function(b,c){this.myTree&&this.myTree.refresh.bind(this.myTree)(b,c,!0)},updateCommands:function(b){this.myTree&&this.myTree._renderer.updateCommands.bind(this.myTree._renderer)(b)},makeNewItemPlaceHolder:function(b,c,a,f){b=this.getRow(b);if(a)return b=b.childNodes[a],b.appendChild(document.createElement("br")),f=document.createElement("span"),f.id=c+"placeHolderRow",b.appendChild(f),{tempNode:f,refNode:f};if(b){var e=document.createElement("tr");
e.id=c+"placeHolderRow";a=document.createElement("td");a.id=c+"placeHolderCol";e.appendChild(a);f?(b.parentNode.insertBefore(e,b.nextSibling),b=parseInt(b.firstChild.style.paddingLeft),a.style.paddingLeft=this.myTree.getIndent()+b+"px"):b.appendChild(e);f=k.node(c+"placeHolderRow");b=k.node(c+"placeHolderCol");if(f&&b)return{tempNode:f,refNode:b}}return null},getRow:function(b){if(b=this.model.getId(b))return k.node(b)},collapseAll:function(){for(var b=this._navHandler.getTopLevelNodes(),c=0;c<b.length;c++)this.myTree.collapse(b[c])},
expandAll:function(b){if(b)this._expandRecursively(b);else if(this._navHandler){b=this._navHandler.getTopLevelNodes();for(var c=0;c<b.length;c++)this._expandRecursively(b[c])}},_expandRecursively:function(b){if(this._navHandler&&this._navHandler.isExpandable(b)){var c=this;this.myTree.expand(b,function(){c.model.getChildren(b,function(a){if(!(void 0===a||null===a))for(var b=a.length,d=0;d<b;d++)c._expandRecursively(a[d])})})}},createTree:function(b,f,a){b="string"===typeof b?b:b.id||b;this.selection&&
this.selection.setSelections([]);this.getNavHandler()&&this.getNavHandler()._clearSelection();var h=b+"innerTree",g=k.node(h);g&&k.empty(g);f&&(f.rootId=h);this.model=f;this._parentId=b;this._treeOptions=a;if(!a||a&&!a.noSelection)this.selectionPolicy=a?a.selectionPolicy:"",this._navDict=new c.ExplorerNavDict(this.model);this.myTree=new e.TableTree({id:h,model:f,parent:b,onComplete:a?a.onComplete:void 0,labelColumnIndex:this.renderer.getLabelColumnIndex(),renderer:this.renderer,showRoot:a?!!a.showRoot:
!1,indent:a?a.indent:void 0,onCollapse:a?a.onCollapse:void 0,navHandlerFactory:a?a.navHandlerFactory:void 0,tableElement:a?a.tableElement:void 0,tableBodyElement:a?a.tableBodyElement:void 0,tableRowElement:a?a.tableRowElement:void 0});this.renderer._initializeUIState();"cursorOnly"===this.selectionPolicy&&this.initNavHandler()},getNavHandler:function(){return this._navHandler},getNavDict:function(){return this._navDict},refreshSelection:function(){if(this.selection){var b=this.getNavHandler(),c=[];
if(b&&this.getNavDict())for(var a=b.getSelection(),f=0;f<a.length;f++){var e=b.getRowDiv(a[f]);e&&e.parentNode&&(e=this.getNavDict().getValue(this.model.getId(a[f])),e.model&&c.push(e.model))}this.selection.setSelections(c)}},getRootPath:function(){return this.model&&this.model.root?this.model.root.Location:null},initNavHandler:function(){var b=this._treeOptions;if(!b||b&&!b.noSelection){this.getNavHandler()||(this._navHandler=b&&b.navHandlerFactory&&"function"===typeof b.navHandlerFactory.createNavHandler?
b.navHandlerFactory.createNavHandler(this,this._navDict,b):new c.ExplorerNavHandler(this,this._navDict,{getChildrenFunc:b?b.getChildrenFunc:null,setFocus:b&&b.setFocus,selectionPolicy:b?b.selectionPolicy:null}));var f=this;this.model.getRoot(function(a){a instanceof Array?f.getNavHandler().refreshModel(f.getNavDict(),f.model,a):a.children&&a.children instanceof Array&&f.getNavHandler().refreshModel(f.getNavDict(),f.model,a.children);b&&b.setFocus&&f.getNavHandler().cursorOn(null,!1,!1,!0)})}},_lastHash:null,
checkbox:!1};return b}();b.createExplorerCommands=function(b,d){function c(a){return"function"===typeof a.getItemCount&&0<a.getItemCount()?d?d(a):!0:!1}var a=new h.Command({tooltip:g["Expand all"],imageClass:"core-sprite-expandAll",id:"orion.explorer.expandAll",groupId:"orion.explorerGroup",visibleWhen:function(a){return c(a)},callback:function(a){a.items.expandAll()}}),e=new h.Command({tooltip:g["Collapse all"],imageClass:"core-sprite-collapseAll",id:"orion.explorer.collapseAll",groupId:"orion.explorerGroup",
visibleWhen:function(a){return c(a)},callback:function(a){a.items.collapseAll()}});b.addCommand(a);b.addCommand(e)};b.ExplorerModel=function(){function b(d,c,a){this.rootPath=d;this.fetchItems=c;this.idPrefix=a||""}b.prototype={destroy:function(){this.destroyed=!0},getRoot:function(b){var c=this;this.fetchItems(this.rootPath).then(function(a){c.root=a;b(a)})},getChildren:function(b,c){b.Children?c(b.Children):b.ChildrenLocation?this.fetchItems(b.ChildrenLocation).then(function(a){b.Children=a;c(a)}):
c([])},getId:function(b){if(b.Location===this.root.Location)return this.rootId;b=b.Location.replace(/[\\\/]/g,"");for(var c=this.idPrefix,a=0;a<b.length;a++)c=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?c+b.charCodeAt(a):c+b[a];return c}};return b}();b.ExplorerFlatModel=function(){function c(b,f,a){this.rootPath=b;this.fetchItems=f;this.root=a}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(b){if(this.root)b(this.root);else{var c=this;this.fetchItems(this.rootPath).then(function(a){c.root=a;
b(a)})}};c.prototype.getChildren=function(b,c){b===this.root?c(this.root):c([])};return c}();b.ExplorerRenderer=function(){function b(d,c){this.explorer=c;this._init(d);this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._progressImageClass="core-sprite-progress";this._twistieSpriteClass="modelDecorationSprite"}b.prototype={_init:function(b){b&&(this._useCheckboxSelection=void 0===b.checkbox?!1:b.checkbox,this.selectionPolicy=b.singleSelection?"singleSelection":
"",this._cachePrefix=b.cachePrefix,this.getCheckedFunc=b.getCheckedFunc,this.onCheckedFunc=b.onCheckedFunc,this._highlightSelection=!0,this._treeTableClass=b.treeTableClass||"treetable",!1===b.highlightSelection&&(this._highlightSelection=!1),this.actionScopeId||(this.actionScopeId=b.actionScopeId),this.commandService||(this.commandService=b.commandService))},getLabelColumnIndex:function(){return this.explorer.checkbox?1:0},initTable:function(b,c){this.tableTree=c;this.tableNode=b;k.empty(b);this._treeTableClass&&
b.classList.add(this._treeTableClass);this.renderTableHeader(b)},getActionsColumn:function(b,c,a,f,e){a=a||"tool";var h=document.createElement("td");h.id=c.id+"actionswrapper";f&&h.classList.add(f);this.actionScopeId&&this.commandService?this.commandService.renderCommands(this.actionScopeId,h,b,this.explorer,a,null,e&&this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(b,!0):null):window.console.log("Warning, no command service or action scope was specified.  No commands rendered.");
return h},initCheckboxColumn:function(b){if(this._useCheckboxSelection)return document.createElement("th")},getCheckboxColumn:function(b,c){if(this._useCheckboxSelection){var a=document.createElement("td"),f=document.createElement("span");f.id=this.getCheckBoxId(c.id);f.classList.add("core-sprite-check");f.classList.add("selectionCheckmarkSprite");f.rowId=c.id;this.getCheckedFunc&&(f.checked=this.getCheckedFunc(b),f.checked?(this._highlightSelection&&c.classList.add("checkedRow"),f.classList.add("core-sprite-check_on")):
(this._highlightSelection&&c.classList.remove("checkedRow"),f.classList.remove("core-sprite-check_on")));a.appendChild(f);var e=this;f.addEventListener("click",function(a){e.onCheck(c,a.target,a.target.checked?!1:!0,!0)},!1);return a}},getCheckBoxId:function(b){return b+"selectedState"},onCheck:function(b,c,a,f,e){(c.checked=a)?c.classList.add("core-sprite-check_on"):c.classList.remove("core-sprite-check_on");if(this.onCheckedFunc)this.onCheckedFunc(c.rowId,a,f);this.explorer.getNavHandler()&&e&&
this.explorer.getNavHandler().setSelection(this.explorer.getNavDict().getValue(b.id).model,!0)},storeSelections:function(){if(this.explorer.getNavHandler()){var b=this.explorer.getNavHandler().getSelectionIds(),c=this._getUIStatePreferencePath();c&&window.sessionStorage&&(window.sessionStorage[c+"selection"]=JSON.stringify(b))}},_restoreSelections:function(b){var c=this.explorer.getNavDict(),a=this.explorer.getNavHandler();if(a&&c&&"cursorOnly"!==a.getSelectionPolicy()&&(b=window.sessionStorage[b+
"selection"],"string"===typeof b&&(b=0<b.length?JSON.parse(b):null),b)){for(var f=[],a=0;a<b.length;a++){var e=c.getValue(b[a]);if(e&&e.rowDomNode&&e.model&&(f.push(e.model),this._highlightSelection&&e.rowDomNode.classList.add("checkedRow"),e=k.node(this.getCheckBoxId(e.rowDomNode.id))))e.checked=!0,e.classList.add("core-sprite-check_on")}this.explorer.selection&&(this.explorer.selection.setSelections(f),this.explorer.getNavHandler()&&this.explorer.getNavHandler().refreshSelection())}},_storeExpansions:function(b){window.sessionStorage[b+
"expanded"]=JSON.stringify(this._expanded)},_restoreExpansions:function(b){var c=!1,a=window.sessionStorage[b+"expanded"];"string"===typeof a&&(a=0<a.length?JSON.parse(a):null);var f;if(a)for(f=0;f<a.length;f++)if(k.node(a[f])){this._expanded.push(a[f]);var e=this;this.tableTree.expand(a[f],function(){e._restoreSelections(b)});c=!0}return!c},_getUIStatePreferencePath:function(){if(this.explorer){var b=this.explorer.getRootPath();if(this._cachePrefix&&b)return b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,""),
"/"+this._cachePrefix+"/"+b+"/uiState"}return null},expandCollapseImageId:function(b){return b+"__expand"},updateExpandVisuals:function(b,c){var a=k.node(this.expandCollapseImageId(b.id));a&&(a.classList.remove(this._expandImageClass),a.classList.remove(this._collapseImageClass),a.classList.remove(this._progressImageClass),a.classList.add("progress"===c?this._progressImageClass:c?this._expandImageClass:this._collapseImageClass))},getExpandImage:function(b,c,a,f){var e=document.createElement("span");
e.id=this.expandCollapseImageId(b.id);c.appendChild(e);e.classList.add(this._twistieSpriteClass);e.classList.add(this._collapseImageClass);if(a){var h=document.createElement("span");c.appendChild(h);h.classList.add(f||"imageSprite");h.classList.add(a)}var g=this;e.onclick=function(a){if(!g.explorer.getNavHandler().isDisabled(b)){g.tableTree.toggle(b.id);if(g.tableTree.isExpanded(b.id))g._expanded.push(b.id),g.explorer.postUserExpand&&g.explorer.postUserExpand(b.id);else for(var c in g._expanded)if(g._expanded[c]===
b.id){g._expanded.splice(c,1);break}(a=g._getUIStatePreferencePath())&&window.sessionStorage&&g._storeExpansions(a)}};return e},render:function(b,c){c.classList.add("navRow");this.renderRow(b,c)},rowsChanged:function(){"cursorOnly"!==this.explorer.selectionPolicy&&(this.explorer.refreshSelection(),this.explorer.initNavHandler());(k.$(".sectionTreeTable",this.tableNode.parentNode)||k.$(".treetable",this.tableNode.parentNode))&&k.$$array(".treeTableRow",this.tableNode).forEach(function(b,c){var a=!(c%
2)?"darkSectionTreeTableRow":"lightSectionTreeTableRow",f="darkSectionTreeTableRow"===a?"lightSectionTreeTableRow":"darkSectionTreeTableRow";b.classList.add(a);b.classList.remove(f)})},updateCommands:function(){if(this.commandService)for(var b=k.$$array(".treeTableRow"),c=0;c<b.length;c++){var a=b[c],f=k.node(a.id+"actionswrapper");this.commandService.destroy(f);this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,f,a._item,this.explorer,"tool")}},_initializeUIState:function(){this._expanded=
[];var b=this._getUIStatePreferencePath();b&&window.sessionStorage&&this._restoreExpansions(b)&&this._restoreSelections(b)}};return b}();b.SelectionRenderer=function(){function c(b,f){this._init(b);this.explorer=f}c.prototype=new b.ExplorerRenderer;c.prototype.renderTableHeader=function(b){var c=document.createElement("thead"),a=document.createElement("tr");c.classList.add("navTableHeading");this._useCheckboxSelection&&a.appendChild(this.initCheckboxColumn(b));for(var f=0,e=this.getCellHeaderElement(f);e;)0<
e.innerHTML.length&&e.classList.add("navColumn"),a.appendChild(e),e=this.getCellHeaderElement(++f);c.appendChild(a);0<f&&b.appendChild(c)};c.prototype.renderRow=function(b,c){c.verticalAlign="baseline";c.classList.add("treeTableRow");"cursorOnly"!==this.explorer.selectionPolicy&&c.classList.add("selectableNavRow");var a=this.explorer.getNavDict();if(a){a.addRow(b,c);var f=this;c.addEventListener("click",function(a){if(f.explorer.getNavHandler())f.explorer.getNavHandler().onClick(b,a)},!1)}if(a=this.getCheckboxColumn(b,
c))a.classList.add("checkColumn"),c.appendChild(a);for(var a=0,e=this.getCellElement(a,b,c);e;)c.appendChild(e),0===a?this.getPrimColumnStyle?e.classList.add(this.getPrimColumnStyle(b)):e.classList.add("navColumn"):this.getSecondaryColumnStyle?e.classList.add(this.getSecondaryColumnStyle()):e.classList.add("secondaryColumn"),e=this.getCellElement(++a,b,c)};c.prototype.getCellHeaderElement=function(b){};c.prototype.getCellElement=function(b,c,a){};return c}();b.SimpleFlatModel=function(){function c(b,
f,a){this.items=b;this.getKey=a;this.idPrefix=f;this.root={children:b}}c.prototype=new b.ExplorerModel;c.prototype.getRoot=function(b){b(this.root)};c.prototype.getId=function(b){b=this.getKey(b).replace(/[\\\/]/g,"");for(var c="",a=0;a<b.length;a++)c=b[a].match(/[^\.\:\-\_0-9A-Za-z]/g)?c+b.charCodeAt(a):c+b[a];return this.idPrefix+c};c.prototype.getChildren=function(b,c){b===this.root?c(this.items):c([])};return c}();return b});
define("orion/explorers/navigatorRenderer","i18n!orion/navigate/nls/messages orion/Deferred orion/explorers/explorer orion/explorers/navigationUtils orion/extensionCommands orion/objects orion/URITemplate orion/webui/littlelib".split(" "),function(g,l,k,e,c,h,b,f){function d(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1}function m(a,f,e,m,g,k,y,x,z){f=h.clone(f);var q;if(f.Directory)q=document.createElement("a"),
q.className="navlinkonpage",q.href=!a?n:(new b(a+"#{,resource,params*}")).expand({resource:f.ChildrenLocation}),f.Name&&q.appendChild(document.createTextNode(f.Name));else{g||(g=c.getOpenWithCommands(e));q=document.createElement("a");q.className="navlink targetSelector";k&&"object"===typeof k&&Object.keys(k).forEach(function(a){q[a]=k[a]});var A=null,B=null;if(A=x?x.holderDom:q)B=document.createElement("span"),B.className="core-sprite-file modelDecorationSprite thumbnail",A.appendChild(B);f.Name&&
q.appendChild(document.createTextNode(f.Name));var C=f.Location;y&&"object"===typeof y&&(f.params={},h.mixin(f.params,y));(a=c.getOpenWithCommand(e,f,g))&&(C=a.hrefCallback({items:f}));l.when(m.getFileContentType(f),function(a){if(A){var b=A,c=B;if(a){var e,h=a.imageClass,m=a.image;h?(e=document.createElement("span"),e.className+=h,e.classList.add("thumbnail")):m&&(e=document.createElement("img"),e.src=m,e.classList.add("thumbnail"));e&&b.replaceChild(e,c)}}q.href=C;z&&"function"===typeof z.updateFileNode&&
z.updateFileNode(f,q,d(a))})}q.addEventListener("click",function(){p=f}.bind(this),!1);return q}function a(a,b,d,c){this.explorer=b;this.commandService=d;this.contentTypeService=c;this.openWithCommands=null;this.actionScopeId=a.actionScopeId;this._init(a);this.target="_self"}var n=new b("#{,resource,params*}"),p;a.prototype=new k.SelectionRenderer;a.prototype.wrapperCallback=function(a){a.setAttribute("role","tree")};a.prototype.tableCallback=function(a){a.setAttribute("aria-label",g.Navigator);a.setAttribute("role",
"presentation")};a.prototype.rowCallback=function(a,b){a.setAttribute("role","treeitem")};a.prototype.emptyCallback=function(a){var b=document.createElement("tr"),d=document.createElement("td");d.colSpan=this.oneColumn?1:3;var c=document.createElement("div");c.classList.add("noFile");c.textContent=g.NoFile;var e=document.createElement("span");e.appendChild(document.createTextNode(g.File));f.processDOMNodes(c,[e]);d.appendChild(c);b.appendChild(d);a.appendChild(b)};a.prototype.getCellHeaderElement=
function(a){if(this.oneColumn&&0!==a)return null;switch(a){case 0:case 1:case 2:document.createElement("th").style.height="8px"}};a.prototype.setTarget=function(a){this.target=a};a.prototype.getFolderImage=function(a){if(!this.showFolderImage)return null;a=document.createElement("span");a.className="core-sprite-folder modelDecorationSprite";return a};a.prototype.createFolderNode=function(a){var b;this.showFolderLinks?(b=m(this.folderLink||"",a,this.commandService,this.contentTypeService),(a=this.getFolderImage(a))&&
b.insertBefore(a,b.firstChild)):(b=document.createElement("span"),b.textContent=a.Name);return b};a.prototype.updateFileNode=function(a,b,d){};a.prototype.showFolderLinks=!0;a.prototype.getCellElement=function(a,b,d){switch(a){case 0:a=document.createElement("td");var f=document.createElement("span");f.id=d.id+"MainCol";f.setAttribute("role","presentation");a.appendChild(f);a.setAttribute("role","presentation");f.className="mainNavColumn";var h;b.Directory?(this.getExpandImage(d,f),h=this.createFolderNode(b),
f.appendChild(h),this.explorer._makeDropTarget(b,h),this.explorer._makeDropTarget(b,d)):(this.openWithCommands||(this.openWithCommands=c.getOpenWithCommands(this.commandService)),h=m("",b,this.commandService,this.contentTypeService,this.openWithCommands,{target:this.target},null,null,this),f.appendChild(h));h&&(h.id=d.id+"NameLink",1===h.nodeType&&(e.addNavGrid(this.explorer.getNavDict(),b,h),h.setAttribute("role","link"),h.setAttribute("tabindex","-1")));this.actionScopeId&&this.commandService.renderCommands(this.actionScopeId,
f,b,this.explorer,"tool",null,!0);return a;case 1:if(this.oneColumn)return null;d=document.createElement("td");b.LocalTimeStamp&&(d.textContent=(new Date(b.LocalTimeStamp)).toLocaleString());return d;case 2:if(this.oneColumn)return null;d=document.createElement("td");!b.Directory&&"number"===typeof b.Length&&(b=parseInt(b.Length,10)/1024,d.textContent=Math.ceil(b).toLocaleString()+" KB");d.style.textAlign="right";return d}};a.prototype.constructor=a;return{NavigatorRenderer:a,isImage:d,getClickedItem:function(){return p},
createLink:m}});
define("orion/searchClient","i18n!orion/search/nls/messages require orion/webui/littlelib orion/i18nUtil orion/searchUtils orion/crawler/searchCrawler orion/explorers/navigatorRenderer orion/extensionCommands orion/Deferred".split(" "),function(g,l,k,e,c,h,b,f,d){function m(a,b){this.serviceRegistry=a;this.commandRegistry=b;this.openWithCommands=null}function a(a){this.registry=a.serviceRegistry;this._commandService=a.commandService;this._fileService=a.fileService;this.defaultRenderer=new m(this.registry,
this._commandService);this._fileService||console.error("No file service on search client")}m.prototype.makeRenderFunction=function(a,h,m,r,s){var w=this.serviceRegistry,v=this.commandRegistry;this.openWithCommands=this.openWithCommands||f.createOpenWithCommands(w,a,v);var u=this;return function(f,x,w,q){d.when(u.openWithCommands,function(d){if(w)k.empty(h),d=document.createElement("div"),d.appendChild(document.createTextNode(g["Search failed."])),h.appendChild(d),"function"===typeof r&&r(h);else{var B=
function(){function a(b,d){var c=d.folderName?d.folderName:d.path,q=document.createElement("span");q.id=c.replace(/[^a-zA-Z0-9_\.:\-]/g,"");q.appendChild(document.createTextNode(" - "+c+" "));b.appendChild(q)}var b={};return function(d,c){var q=c.name;if(b.hasOwnProperty(q)){a(d,c);var f=b[q];"function"===typeof f&&(b[q]=null,f())}else b[q]=function(){a(d,c)}}}(),C=!1;k.empty(h);if(f&&0<f.length){var I=document.createElement("table");I.setAttribute("role","presentation");for(var N=0;N<f.length;N++){var H=
f[N],E;C||(C=!0,m&&(E=I.insertRow(0).insertCell(0),E.textContent=m));E=I.insertRow(-1).insertCell(0);E.colspan=2;s&&s(E);var D={Name:H.name,Directory:H.directory,Location:H.path||H.location},F=null;"number"===typeof H.LineNumber&&(F={},F.line=H.LineNumber);if(q&&q.keyword&&!q.nameSearch){var G=c.generateSearchHelper(q),F=F||{};F.find=G.inFileQuery.searchStr;F.regEx=G.inFileQuery.wildCard?!0:void 0}D=b.createLink(l.toUrl("edit/edit.html"),D,v,a,d,{"aria-describedby":(H.folderName?H.folderName:H.path).replace(/[^a-zA-Z0-9_\.:\-]/g,
""),style:{verticalAlign:"middle"}},F);H.LineNumber&&D.appendChild(document.createTextNode(" (Line "+H.LineNumber+")"));E.appendChild(D);B(E,H)}h.appendChild(I);"function"===typeof r&&r(h)}!C&&x&&(d=e.formatMessage(g["No matches found for ${0}"],x),k.empty(h),h.appendChild(document.createTextNode(d)),"function"===typeof r&&r(h))}})}};a.prototype={search:function(a,b,d){var f=function(a){for(var d=[],f=0;f<a.response.docs.length;f++){var e=a.response.docs[f],h=e.Location,m=c.path2FolderName(e.Path?
e.Path:e.Location,e.Name),q=m?m:h;(b?0<=q.indexOf(b):1)&&d.push({name:e.Name,path:h,folderName:m,directory:e.Directory,lineNumber:e.LineNumber})}return d};if(this._crawler&&a.nameSearch)this._crawler.searchName(a,function(b){d(f(b),a.keyword,null,a)});else try{this.registry.getService("orion.page.progress").progress(this._fileService.search(a),"Searching "+a.keyword).then(function(b){var c=a.keyword,c=c.substring(c.indexOf("}")+1),c=c.substring(c.indexOf(":")+1);d(f(b),c,null,a)},function(a){d(null,
null,a,null)})}catch(e){"string"===typeof e&&-1<e.indexOf("search")&&this._crawler?this._crawler.searchName(a,function(b){d(f(b),null,null,a)}):"string"===typeof e&&-1<e.indexOf("search")&&!a.nameSearch?(new h.SearchCrawler(this.registry,this._fileService,a,{childrenLocation:this.getChildrenLocation()})).search(function(b){d(f(b),null,null,a)}):this.registry.getService("orion.page.message").setErrorMessage(e)}},getFileService:function(){return this._fileService},setCrawler:function(a){this._crawler=
a},handleError:function(a,b){console.error(a);k.empty(b);b.appendChild(document.createTextNode(a));return a},setLocationByMetaData:function(a,b){var d="",c=null;this._searchRootLocation=this._fileService.fileServiceRootURL(a.Location);b&&a&&a.Parents&&0<a.Parents.length?c="last"===b.index?a.Parents[a.Parents.length-1]:a.Parents[0]:a&&a.Directory&&a.Location&&a.Parents&&(c=a);c?(this.setLocationbyURL(c.Location),d=c.Name,this._childrenLocation=c.ChildrenLocation):a&&(this.setLocationbyURL(this._searchRootLocation),
d=this._fileService.fileServiceName(a.Location),this._childrenLocation=a.ChildrenLocation);c=k.node("search");d||(d="");if(c&&c.placeholder){c.value="";var f=e.formatMessage(g["Search ${0}"],d);c.placeholder=30<f.length?f.substring(0,27)+"...":e.formatMessage(g["Search ${0}"],d)}c&&c.title&&(c.title=g["Type a keyword or wild card to search in "]+d)},setLocationbyURL:function(a){this._searchLocation=a},setRootLocationbyURL:function(a){this._searchRootLocation=a},setChildrenLocationbyURL:function(a){this._childrenLocation=
a},getSearchLocation:function(){return this._searchLocation?this._searchLocation:this._fileService.fileServiceRootURL()},getSearchRootLocation:function(){return this._searchRootLocation?this._searchRootLocation:this._fileService.fileServiceRootURL()},getChildrenLocation:function(){return this._childrenLocation?this._childrenLocation:this._fileService.fileServiceRootURL()},createSearchParams:function(a,b,d,c){d=d?this.getSearchRootLocation():this.getSearchLocation();return b?{resource:d,sort:"NameLower asc",
rows:100,start:0,nameSearch:!0,keyword:a}:{resource:d,sort:c&&c.sort?c.sort:"Path asc",rows:c&&c.rows?c.rows:40,start:0,caseSensitive:c?c.caseSensitive:void 0,regEx:c?c.regEx:void 0,fileType:c?c.fileType:void 0,keyword:a,replace:c?c.replace:void 0}}};a.prototype.constructor=a;return{Searcher:a}});
define("orion/widgets/themes/editor/ThemeData",["i18n!orion/settings/nls/messages","orion/editor/textTheme"],function(g,l){function k(){}function e(){this.styles=[];var c=new k;c.name="Eclipse";c.annotationRuler="white";c.background="white";c.comment="green";c.keyword="#7f0055";c.text="darkSlateGray";c.string="blue";c.overviewRuler="white";c.lineNumberOdd="#444";c.lineNumberEven="#444";c.lineNumber="#444";c.currentLine="#EAF2FE";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=
b;this.styles.push(c);c=new k;c.name="Prospecto";c.annotationRuler="white";c.background="white";c.comment="#3C802C";c.keyword="#CC4C07";c.text="#333";c.string="#446FBD";c.overviewRuler="white";c.lineNumberOdd="silver";c.lineNumberEven="silver";c.lineNumber="silver";c.currentLine="#EAF2FE";c.tag="#CC4C07";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=b;this.styles.push(c);c=new k;c.name="Blue";c.annotationRuler="lavender";c.background="aliceBlue";c.comment="indigo";c.keyword="cornFlowerBlue";c.text=
"navy";c.string="cornFlowerBlue";c.overviewRuler="lavender";c.lineNumberOdd="darkSlateGray";c.lineNumberEven="darkSlateGray";c.lineNumber="darkSlateGray";c.currentLine="white";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=b;this.styles.push(c);c=new k;c.name="Ambience";c.annotationRuler="#3D3D3D";c.background="#202020";c.comment="mediumslateblue";c.keyword="cornFlowerBlue";c.text="darkseagreen";c.string="lightcoral";c.overviewRuler="white";c.lineNumberOdd="black";c.lineNumberEven=
"black";c.lineNumber="black";c.currentLine="lightcyan";c.tag="cornFlowerBlue";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=b;this.styles.push(c);c=new k;c.name="Tierra";c.annotationRuler="moccasin";c.background="lemonchiffon";c.comment="darkseagreen";c.keyword="darkred";c.text="#555555";c.string="orangered";c.overviewRuler="moccasin";c.lineNumberOdd="chocolate";c.lineNumberEven="chocolate";c.lineNumber="chocolate";c.currentLine="#baa289";c.tag="darkred";c.attribute="cadetBlue";c.fontFamily=h;
c.fontSize=b;this.styles.push(c);c=new k;c.name="Nimbus";c.annotationRuler="#444";c.background="dimgray";c.comment="darkseagreen";c.keyword="darkorange";c.text="white";c.string="cornflowerblue";c.overviewRuler="#444";c.lineNumberOdd="#aaa";c.lineNumberEven="#aaa";c.lineNumber="#aaa";c.currentLine="#aabfbb";c.tag="darkorange";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=b;this.styles.push(c);c=new k;c.name="Adelante";c.annotationRuler="#E2D2B2";c.background="#F1E7C8";c.comment="#5D774E";c.keyword=
"#AF473B";c.text="dimgray";c.string="#DE5D3B";c.overviewRuler="#E2D2B2";c.lineNumberOdd="#AF473B";c.lineNumberEven="#AF473B";c.lineNumber="#AF473B";c.currentLine="#9e937b";c.tag="#AF473B";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=b;this.styles.push(c);c=new k;c.name="Raspberry Pi";c.annotationRuler="seashell";c.background="seashell";c.comment="#66B32F";c.keyword="#E73E36";c.text="dimgray";c.string="darkorange";c.overviewRuler="seashell";c.lineNumberOdd="#E73E36";c.lineNumberEven="#E73E36";
c.lineNumber="#E73E36";c.currentLine="#F5B1AE";c.tag="#E73E36";c.attribute="cadetBlue";c.fontFamily=h;c.fontSize=b;this.styles.push(c)}function c(){return this.styles}var h='"Consolas", "Monaco", "Vera Mono", "monospace"',b="10pt";e.prototype.styles=[];e.prototype.getStyles=c;e.prototype.fontSettable=!0;e.prototype.getThemeStorageInfo=function(){return{storage:"/themes",styleset:"editorstyles",defaultTheme:"Prospecto",selectedKey:"editorSelected",version:"5.0"}};e.prototype.parseToXML=function(b){try{var d=
null;if(window.DOMParser){var d=(new DOMParser).parseFromString(b,"text/xml"),c=d.getElementsByTagName("parsererror");return!c||!c.length||!c[0].childNodes.length?d:null}d=new ActiveXObject("Microsoft.XMLDOM");d.async=!1;d.loadXML(b);return d}catch(a){}};e.prototype.selectFontSize=function(b){console.log("fontsize: "+b)};e.prototype.importTheme=function(b){console.log("import theme");console.log(b);var d=b.parameters.valueFor("name"),d=this.parseToXML(d),c=new k;c.name=d.getElementsByTagName("colorTheme")[0].attributes[1].value;
c.annotationRuler=d.getElementsByTagName("background")[0].attributes[0].value;c.background=d.getElementsByTagName("background")[0].attributes[0].value;c.comment=d.getElementsByTagName("singleLineComment")[0].attributes[0].value;c.keyword=d.getElementsByTagName("keyword")[0].attributes[0].value;c.text=d.getElementsByTagName("foreground")[0].attributes[0].value;c.string=d.getElementsByTagName("string")[0].attributes[0].value;c.overviewRuler=d.getElementsByTagName("background")[0].attributes[0].value;
c.lineNumberOdd=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.lineNumberEven=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.lineNumber=d.getElementsByTagName("lineNumber")[0].attributes[0].value;c.currentLine=d.getElementsByTagName("selectionBackground")[0].attributes[0].value;b.items.addTheme(c)};e.prototype.processSettings=function(b,d){var c=l.TextTheme.getTheme();c.setThemeClass("editorTheme",c.buildStyleSheet("editorTheme",b))};e.prototype.getViewData=function(){var b=
{top:10,left:10,width:400,height:350},d=b.left,c=b.top;b.shapes=[{type:"TEXT",name:g["Line Numbers"],label:"1",x:d+20,y:c+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"},{type:"RECTANGLE",name:g.Background,x:d+46,y:c,width:290,height:b.height,family:"background",fill:"white"},{type:"TEXT",name:g.Strings,label:"'text/javascript'",x:d+134,y:c+20,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"\x3d",x:d+124,y:c+20,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Current Line"],x:d+46,y:c+87,width:290,height:18,family:"currentLine",fill:"#eaf2fd"},{type:"TEXT",name:g["HTML Attribute"],label:"type",x:d+98,y:c+20,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Overview Ruler"],x:d+336,y:c,width:14,height:b.height,family:"overviewRuler",fill:"white"},{type:"TEXT",name:g.Comments,label:"/* comment */",x:d+75,y:c+40,fill:"darkSeaGreen",family:"comment",font:"9pt sans-serif"},
{type:"TEXT",name:g["HTML Tag"],label:"\x3cscript",x:d+55,y:c+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3e",x:d+213,y:c+20,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Strings,label:"'Result'",x:d+164,y:c+80,fill:"cornflowerBlue",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"multiply(a,b){",x:d+120,y:c+60,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",
name:g.Keywords,label:"function",x:d+75,y:c+60,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"var",x:d+95,y:c+80,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"output \x3d ",x:d+115,y:c+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:";",x:d+205,y:c+80,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"var",x:d+
95,y:c+100,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"result \x3d a*b;",x:d+115,y:c+100,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Keywords,label:"return",x:d+95,y:c+120,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"output + result;",x:d+135,y:c+120,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"}",x:d+75,y:c+140,
fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3c/script\x3e",x:d+55,y:c+160,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3cstyle",x:d+55,y:c+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Attribute"],label:"type",x:d+95,y:c+200,fill:"darkGray",family:"attribute",font:"9pt sans-serif"},{type:"TEXT",name:g.Foreground,label:"\x3d",x:d+121,y:c+200,fill:"darkSlateGray",
family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g.Strings,label:"'text/css'",x:d+131,y:c+200,fill:"darkorange",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g["HTML Tag"],label:"\x3e",x:d+180,y:c+200,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:".some-class",x:d+75,y:c+220,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:"{",x:d+145,y:c+220,fill:"darkSlateGray",family:"text",
font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Attribute"],label:"color:",x:d+95,y:c+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Value"],label:"#123456",x:d+130,y:c+240,fill:"darkSlateGray",family:"string",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Text"],label:";",x:d+180,y:c+240,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},{type:"TEXT",name:g["CSS Class Name"],label:"}",x:d+75,y:c+260,fill:"darkSlateGray",family:"text",font:"9pt sans-serif"},
{type:"TEXT",name:g["HTML Tag"],label:"\x3c/style\x3e",x:d+55,y:c+280,fill:"darkorange",family:"keyword",font:"9pt sans-serif"},{type:"RECTANGLE",name:g["Annotation Ruler"],x:d,y:c,width:46,height:b.height,family:"annotationRuler",fill:"white"}];for(var a=0;16>a;a++)b.shapes.push({type:"TEXT",name:g["Line Numbers"],label:a+1,x:d+20,y:c+20*a+20,fill:"darkSlateGray",family:"lineNumber",font:"9pt sans-serif"});return b};return{ThemeData:e,getStyles:c}});
define("orion/section","orion/webui/littlelib orion/selection orion/commandRegistry orion/commonHTMLFragments orion/objects orion/selection".split(" "),function(g,l,k,e,c,h){function b(b,c){var a=this;this._expandImageClass="core-sprite-openarrow";this._collapseImageClass="core-sprite-closedarrow";this._twistieSpriteClass="modelDecorationSprite";if(!c.id)throw Error("Missing required argument: id");this.id=c.id;if(!c.title)throw Error("Missing required argument: title");var f=c.useAuxStyle?["sectionWrapper",
"sectionWrapperAux","toolComposite"]:["sectionWrapper","toolComposite"];this.domNode=document.createElement("div");b.appendChild(this.domNode);for(var h=0;h<f.length;h++)this.domNode.classList.add(f[h]);this.domNode.id=c.id;c.canHide&&(this.twistie=document.createElement("span"),this.twistie.classList.add("modelDecorationSprite"),this.twistie.classList.add("layoutLeft"),this.twistie.classList.add("sectionTitleTwistie"),this.domNode.style.cursor="pointer",this.domNode.appendChild(this.twistie),this.domNode.tabIndex=
0,this.domNode.addEventListener("click",function(b){(b.target===a.titleNode||b.target===a.twistie||b.target===a.domNode)&&a._changeExpandedState()},!1),this.domNode.addEventListener("keydown",function(b){b.keyCode===g.KEY.ENTER&&(b.target===a.domNode||b.target===a.titleNode||b.target===a.twistie)&&a._changeExpandedState()},!1));if(c.iconClass){var k=document.createElement("span");k.classList.add("sectionIcon");this.domNode.appendChild(k);f=Array.isArray(c.iconClass)?c.iconClass:[c.iconClass];f.forEach(function(a){k.classList.add(a)})}c.headerClass&&
(f=Array.isArray(c.headerClass)?c.headerClass:[c.headerClass],f.forEach(function(a){this.domNode.classList.add(a)}.bind(this)));this.titleNode=document.createElement("div");this.titleNode.id=c.id+"Title";this.titleNode.classList.add("sectionAnchor");this.titleNode.classList.add("sectionTitle");this.titleNode.classList.add("layoutLeft");this.domNode.appendChild(this.titleNode);this.titleNode.textContent=c.title;"function"===typeof c.getItemCount&&(f=document.createElement("div"),f.classList.add("layoutLeft"),
f.classList.add("sectionItemCount"),this.domNode.appendChild(f),f.textContent=c.getItemCount(this));this._progressNode=document.createElement("div");this._progressNode.id=c.id+"Progress";this._progressNode.classList.add("sectionProgress");this._progressNode.classList.add("sectionTitle");this._progressNode.classList.add("layoutLeft");this._progressNode.style.visibility="hidden";this._progressNode.textContent="...";this.domNode.appendChild(this._progressNode);f=document.createElement("div");f.id=c.id+
"FilterSearchBox";this.domNode.appendChild(f);this._toolActionsNode=document.createElement("div");this._toolActionsNode.id=c.id+"ToolActionsArea";this._toolActionsNode.classList.add("layoutRight");this._toolActionsNode.classList.add("sectionActions");this.domNode.appendChild(this._toolActionsNode);this.actionsNode=document.createElement("ul");this.actionsNode.id=c.id+"ActionArea";this.actionsNode.classList.add("layoutRight");this.actionsNode.classList.add("commandList");this.actionsNode.classList.add("sectionActions");
this.domNode.appendChild(this.actionsNode);this.selectionNode=document.createElement("ul");this.selectionNode.id=c.id+"SelectionArea";this.selectionNode.classList.add("layoutRight");this.selectionNode.classList.add("commandList");this.selectionNode.classList.add("sectionActions");this.domNode.appendChild(this.selectionNode);c.slideout&&(f=e.slideoutHTMLFragment(c.id),h=document.createRange(),h.selectNode(this.domNode),f=h.createContextualFragment(f),this.domNode.appendChild(f));this._contentParent=
document.createElement("div");this._contentParent.id=this.id+"Content";this._contentParent.role="region";this._contentParent.classList.add("sectionTable");this._contentParent.setAttribute("aria-labelledby",this.titleNode.id);b.appendChild(this._contentParent);c.content&&this.setContent(c.content);"function"===typeof c.onExpandCollapse&&(this._onExpandCollapse=c.onExpandCollapse);this._preferenceService=c.preferenceService;this._collapse();if(this._preferenceService){var l=this;this._preferenceService.getPreferences("/window/views").then(function(a){a=
a.get(l.id);void 0===a?c.hidden||l._expand():a&&l._expand();l._updateExpandedState(!1)})}else c.hidden||this._expand(),this._updateExpandedState(!1);this._commandService=c.commandService;this._lastMonitor=0;this._loading={}}function f(b){this._section=b;this._id=++b._lastMonitor}b.prototype={setTitle:function(b){this.titleNode.textContent=b},getHeaderElement:function(b){return this.domNode},getTitleElement:function(b){return this.titleNode},getActionElement:function(b){return this._toolActionsNode},
setContent:function(b){"string"===typeof b?this._contentParent.innerHTML=b:(this._contentParent.innerHTML="",this._contentParent.appendChild(b))},getContentElement:function(){return this._contentParent},embedExplorer:function(b,e,a){this._contentParent.innerHTML="";b.parent||(b.parent=e);this._contentParent.appendChild(b.parent);b.section=this;c.mixin(b,{createActionSections:function(){this.actionsSections&&this.actionsSections.forEach(function(a){if(!g.node(a)){var b=document.createElement("ul");
b.id=a;b.classList.add("commandList");b.classList.add("layoutRight");this.section.actionsNode.appendChild(b)}}.bind(this))},getCommandsVisible:function(){return"hidden"!==this.section.actionsNode.style.visibility},setCommandsVisible:function(a,b){this.section.actionsNode.style.visibility=a?"":"hidden";void 0===b&&(b=a?null:"cursorOnly");this.renderer.selectionPolicy=b;var d=this.getNavHandler();d&&d.setSelectionPolicy(b);a?this.updateCommands():this.actionsSections&&this.actionsSections.forEach(function(a){g.node(a)&&
this.commandRegistry.destroy(a)}.bind(this))},destroy:function(){Object.getPrototypeOf(this).destroy.call(this);var a=this;this.actionsSections&&(this.actionsSections.forEach(function(b){delete a[b]}),delete this.actionsSections)},updateCommands:function(a){this.section.actionsNode&&this.getCommandsVisible()&&(this.createActionSections(),Object.getPrototypeOf(this).updateCommands.call(this,a))},loaded:function(){var b=this;!this.selection&&!a&&(this.serviceRegistry||this.registry?(this.selection=
new h.Selection(this.serviceRegistry||this.registry,this.parent.id+"Selection"),this.selection.addEventListener("selectionChanged",function(a){b.updateCommands(a.selections)})):window.console.error("Could not create a Selection for the explorer because of lack of serviceRegistry"));var d=this.registerCommands();!d||!d.then?b.updateCommands():d.then(function(){b.updateCommands()})}});b.renderer&&(b.renderer.section=this,c.mixin(b.renderer,{getCellHeaderElement:function(a){(a=Object.getPrototypeOf(this).getCellHeaderElement.call(this,
a))&&this.section.setTitle(a.innerHTML);return null}}))},createProgressMonitor:function(){return new f(this)},_setMonitorMessage:function(b,c){this._progressNode.style.visibility="visible";this._loading[b]=c;var a="",e;for(e in this._loading)""!==a&&(a+="\n"),a+=this._loading[e];this._progressNode.title=a},_monitorDone:function(b){delete this._loading[b];b="";for(var c in this._loading)""!==b&&(b+="\n"),b+=this._loading[c];this._progressNode.title=b;""===b&&(this._progressNode.style.visibility="hidden")},
_changeExpandedState:function(){this.hidden?this._expand():this._collapse();this._updateExpandedState(!0)},_updateExpandedState:function(b){var c=!this.hidden,a=this.twistie,e=this.id;a&&(a.classList.add(c?this._expandImageClass:this._collapseImageClass),a.classList.remove(c?this._collapseImageClass:this._expandImageClass));this._preferenceService&&b&&this._preferenceService.getPreferences("/window/views").then(function(a){a.put(e,c)});this._onExpandCollapse&&this._onExpandCollapse(c,this)},_expand:function(){this._contentParent.classList.remove("sectionClosed");
this.domNode.classList.remove("sectionClosed");this.hidden=!1},_collapse:function(){this.hidden=!0;this._contentParent.classList.add("sectionClosed");this.domNode.classList.add("sectionClosed")}};b.prototype.constructor=b;f.prototype={begin:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},worked:function(b){this.status=b;this._section._setMonitorMessage(this.id,b)},done:function(b){this.status=b;this._section._monitorDone(this.id)}};f.prototype.constructor=f;return{Section:b}});
define("orion/compare/nls/root/messages",{"Copy current change from right to left":"Copy current change from right to left","Copy current change from left to right":"Copy current change from left to right","Switch to unified diff":"Switch to unified diff",Unified:"Unified","Switch to side by side diff":"Switch to side by side diff","Side by side":"Side by side","Generate link of the current diff":"Generate link of the current diff","Generate Link":"Generate Link","Next diff block":"Next diff block",
"Previous diff block":"Previous diff block","Next diff change":"Next diff change","Previous diff change":"Previous diff change","Copy the link URL:":"Copy the link URL:",Compare:"Compare","Open the compare page":"Open the compare page","fetching...":"fetching...","There are unsaved changes.":"There are unsaved changes.","ERROR: ":"ERROR: ","Compare...":"Compare...","files changed":" files changed",Location:"Location",Options:"Options","Sort by folders":"Sort by folders","Line 0 : Col 0":"Line 0 : Col 0",
"No Matching DiffService for location:":"No Matching DiffService for location:","${0} files compared. The two folders are identical.":"${0} files compared. The two folders are identical."});define("orion/compare/nls/messages",["orion/i18n!orion/compare/nls/messages","orion/compare/nls/root/messages"],function(g,l){var k={root:l};Object.keys(g).forEach(function(e){"undefined"===typeof k[e]&&(k[e]=g[e])});return k});
define("orion/compare/compareCommands",["i18n!orion/compare/nls/messages","orion/commands","orion/keyBinding","orion/webui/littlelib"],function(g,l,k,e){var c={};c.CompareCommandFactory=function(){function c(b){this.setOptions(b,!0)}c.prototype={setOptions:function(b,c){c&&(this.options={});this.options||(this.options={});b&&Object.keys(b).forEach(function(d){this.options[d]=b[d]}.bind(this))},getOptions:function(){return this.options},initCommands:function(b){var c=this.options.commandSpanId,d=this.options.commandService;
if(d&&c){var e=new l.Command({name:g["Copy current change from right to left"],tooltip:g["Copy current change from right to left"],imageClass:"core-sprite-leftarrow",id:"orion.compare.copyToLeft",groupId:"orion.compareGroup",visibleWhen:function(a){return"twoWay"===b.type&&!b.getImageMode()&&b.options.newFile&&!b.options.newFile.readonly}.bind(this),callback:function(a){a.items.copyToLeft()}}),a=new l.Command({name:g["Copy current change from left to right"],tooltip:g["Copy current change from left to right"],
imageClass:"core-sprite-rightarrow",id:"orion.compare.copyToRight",groupId:"orion.compareGroup",visibleWhen:function(a){return"twoWay"===b.type&&!b.getImageMode()&&b.options.oldFile&&!b.options.oldFile.readonly}.bind(this),callback:function(a){a.items.copyToRight()}}),h=new l.Command({tooltip:g["Switch to unified diff"],name:g.Unified,id:"orion.compare.toggle2Inline",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.toggler&&"twoWay"===a.options.toggler.getWidget().type},callback:function(a){a.items.options.toggler.toggle()}}),
p=new l.Command({tooltip:g["Switch to side by side diff"],name:g["Side by side"],id:"orion.compare.toggle2TwoWay",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.toggler&&"inline"===a.options.toggler.getWidget().type},callback:function(a){a.items.options.toggler.toggle()}}),t=new l.Command({name:g["Next diff block"],tooltip:g["Next diff block"],imageClass:"core-sprite-move-down",id:"orion.compare.nextDiff",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},
callback:function(a){a.items.nextDiff()}}),r=new l.Command({name:g["Previous diff block"],tooltip:g["Previous diff block"],imageClass:"core-sprite-move-up",id:"orion.compare.prevDiff",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},callback:function(a){a.items.prevDiff()}}),s=new l.Command({name:g["Next diff change"],tooltip:g["Next diff change"],imageClass:"core-sprite-move-down",id:"orion.compare.nextChange",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},
callback:function(a){a.items.nextChange()}}),w=new l.Command({name:g["Previous diff change"],tooltip:g["Previous diff change"],imageClass:"core-sprite-move-up",id:"orion.compare.prevChange",groupId:"orion.compareGroup",visibleWhen:function(a){return!b.getImageMode()},callback:function(a){a.items.prevChange(a)}});d.addCommand(e);d.addCommand(a);d.addCommand(p);d.addCommand(h);d.addCommand(t);d.addCommand(r);d.addCommand(s);d.addCommand(w);d.registerCommandContribution(c,"orion.compare.toggle2Inline",
108);d.registerCommandContribution(c,"orion.compare.toggle2TwoWay",109);d.registerCommandContribution(c,"orion.compare.copyToLeft",110,null,!1,new k.KeyBinding(37,!0,!1,!0));d.registerCommandContribution(c,"orion.compare.copyToRight",111,null,!1,new k.KeyBinding(39,!0,!1,!0));d.registerCommandContribution(c,"orion.compare.nextDiff",112,null,!1,new k.KeyBinding(40,!0));d.registerCommandContribution(c,"orion.compare.prevDiff",113,null,!1,new k.KeyBinding(38,!0));b.options.wordLevelNav?(d.registerCommandContribution(c,
"orion.compare.nextChange",114,null,!1,new k.KeyBinding(40,!0,!0)),d.registerCommandContribution(c,"orion.compare.prevChange",115,null,!1,new k.KeyBinding(38,!0,!0))):(d.registerCommandContribution(c,"orion.compare.nextChange",114,null,!0,new k.KeyBinding(40,!0,!0)),d.registerCommandContribution(c,"orion.compare.prevChange",115,null,!0,new k.KeyBinding(38,!0,!0)))}},renderCommands:function(b){var c=this.options.commandSpanId,d=this.options.commandService;d&&c&&(e.empty(e.node(c)),this.options.gridRenderer&&
this.options.gridRenderer.navGridHolder?(this.options.gridRenderer.navGridHolder.splice(0,this.options.gridRenderer.navGridHolder.length),this.options.gridRenderer.additionalCmdRender?this.options.gridRenderer.before?(this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder),d.renderCommands(c,c,b,b,"tool",null,this.options.gridRenderer.navGridHolder)):(d.renderCommands(c,c,b,b,"tool",null,this.options.gridRenderer.navGridHolder),this.options.gridRenderer.additionalCmdRender(this.options.gridRenderer.navGridHolder)):
d.renderCommands(c,c,b,b,"tool",null,this.options.gridRenderer.navGridHolder)):d.renderCommands(c,c,b,b,"tool",null))}};return c}();return c});
define("orion/compare/compareUtils",["orion/URITemplate"],function(g){var l=l||{};l.compareUtils=l.compareUtils||{};l.compareUtils.lookUpMapper=function(g,e,c){for(var h=0,b=0;b<g.length;b++){var f=g[b][e];0===f&&(f=1);if(c>=h&&c<h+f)return{mapperIndex:b,startFrom:h};if(b===g.length-1)break;h+=g[b][e]}return{mapperIndex:g.length-1,startFrom:h}};l.compareUtils.lookUpLineIndex=function(g,e,c){if(0===c)return 0;for(var h=0,b=0;b<c;b++)h+=g[b][e];return h};l.compareUtils.updateMapper=function(g,e,c,h,
b){if(h!==b&&(0<h||0<b)){var f=l.compareUtils.lookUpMapper(g,e,c);if(!(0>f.mapperIndex)){if(0<h){var d=c-f.startFrom;for(c=f.mapperIndex;c<g.length;c++){d=g[c][e]-d;if(h<=d){g[c][e]-=h;break}g[c][e]-=d;h-=d;d=0}}0<b&&(g[f.mapperIndex][e]+=b)}}};l.compareUtils.overlapMapper=function(g,e,c,h,b){g=c+g[e]-1;g<c&&(g=c);b<h&&(b=h);return g<h||b<c?!1:!0};l.compareUtils.findFirstDiff=function(g,e,c,h){for(var b=0,f=null,d=0;d<g.length&&!(b>h)&&(!l.compareUtils.overlapMapper(g[d],e,b,c,h)||!(f={mapperIndex:d,
startFrom:b},0!==g[d][2]));d++)b+=g[d][e];return f};l.compareUtils.matchMapper=function(g,e,c,h){if(0===g.length)return c;var b=c+Math.round((h-c)/3),f=l.compareUtils.findFirstDiff(g,e,c,h),d=0===g[f.mapperIndex][e]?f.startFrom:f.startFrom+g[f.mapperIndex][e]-1,m=l.compareUtils.lookUpLineIndex(g,1-e,f.mapperIndex),a=f.startFrom-c;return 0===g[f.mapperIndex][2]?m-a:b>=f.startFrom&&b<=d?m-Math.round((h-c)/3):b<f.startFrom?m-a:(0===g[f.mapperIndex][1-e]?m:m+g[f.mapperIndex][1-e]-1)-(d-c)};l.compareUtils.getMapperLineCount=
function(g){for(var e=0,c=0;c<g.length;c++)e+=Math.max(g[c][0],g[c][1]);return e};l.compareUtils.getAnnotationIndex=function(g,e){for(var c=0;c<g.length;c++)if(g[c][0]===e)return c;return-1};l.compareUtils.getAnnotationMapperIndex=function(g,e){return g[e][1]};l.compareUtils.getAnnotationIndexByMapper=function(g,e){for(var c=0;c<g.length;c++)if(g[c][1]===e)return{current:c,prev:c-1,next:c+1};return{current:-1,prev:-1,next:-1}};l.compareUtils.isMapperConflict=function(g,e){return 0>e||!g[e][3]?!1:
1===g[e][3]};l.compareUtils.mergeDiffBlocks=function(g,e,c,h,b,f){for(var d=0;d<e.length;d++){var m=e[d][0],a=c[e[d][1]];if(0<a[0]){for(var n="",p=0;p<a[0];p++)n=n+h[a[2]-1+p].substring(b)+f;a=g.getLineCount();m>=a&&(m=g.getLineEnd(a-1),p=g.getLineEnd(a-1,!0),m===p?(g.setText(f,m,m),m=a):m=a-1);m=g.getLineStart(m);g.setText(n,m,m)}}};l.compareUtils.generateCompareHref=function(k,e){var c=require.toUrl("compare/compare.html");e.conflict||(e.conflict=void 0);e.readonly||(e.readonly=void 0);return(new g(c+
"#{,resource,params*}")).expand({resource:k,params:e})};l.compareUtils.generateCompareTreeHref=function(k,e){var c=require.toUrl("compare-tree/compare-tree.html");return(new g(c+"#{,resource,params*}")).expand({resource:k,params:e})};return l.compareUtils});
define("orion/compare/diffProvider",["i18n!orion/compare/nls/messages","orion/Deferred"],function(g,l){function k(c,e,b){var f=new l;c[e].apply(c,b).then(function(b){f.resolve(b)},function(b){f.reject(b)});return f}function e(c,e){var b=c.getServiceReferences("orion.core.diff"),f,d=b;if(e){d=[];for(f=0;f<b.length;++f)e(b[f])&&d.push(b[f])}var m=[],a=[];for(f=0;f<d.length;++f)m[f]=RegExp(d[f].getProperty("pattern")||".*"),a[f]=c.getService(d[f]);this._getService=function(b){if(-1===b.indexOf("://")){var d=
document.createElement("a");d.href=b;b=d.href}for(d=0;d<m.length;++d)if(m[d].test(b))return a[d];throw g["No Matching DiffService for location:"]+b;}}e.prototype={getDiffContent:function(c){return k(this._getService(c),"getDiffContent",arguments)},getDiffFileURI:function(c){return k(this._getService(c),"getDiffFileURI",arguments)}};return{DiffProvider:e}});
define("orion/compare/diffParser",[],function(){var g=g||{};g.DiffParser=function(){function g(e,c){this._lineDelimiter=e?e:k?"\r\n":"\n";this._diffLineDelimiter=c?c:this._lineDelimiter;this._DEBUG=!1}var k=-1!==window.navigator.platform.indexOf("Win");g.prototype={_init:function(){this._oFileContents=[];this._diffContents=[];this._oBlocks=[];this._nBlocks=[];this._hunkRanges=[];this._lastToken=" ";this._deltaMap=[];this._nFileContents=[];this._nNewLineAtEnd=this._oNewLineAtEnd=!0;this._diffContentIndex=
1},setLineDelim:function(e){this._diffLineDelimiter=this._lineDelimiter=e},getDiffArray:function(){return{array:this._diffContents,index:this._diffContentIndex}},parse:function(e,c,h,b){this._init();if(""===c)return{outPutFile:e,mapper:[]};this._oFileContents=""===e?[]:e.split(this._lineDelimiter);this._diffContents=c.split(this._diffLineDelimiter);c=this._diffContents.length;this._hunkRanges=[];for(var f=0;f<c;f++){var d=this._parseHunkRange(f);d&&this._hunkRanges.push(d)}if(0===this._hunkRanges.length)return{outPutFile:e,
mapper:[]};this._DEBUG&&(console.log("***Diff contents: \n"),this._diffContents.forEach(function(b){console.log(b)}),console.log("***Hunk ranges: \n"),console.log(JSON.stringify(this._hunkRanges)));for(e=0;e<this._hunkRanges.length;e++)this._parseHunkBlock(e);this._DEBUG&&(console.log("***Original Hunk range blocks: \n"),console.log(JSON.stringify(this._oBlocks)),console.log("***New Hunk range blocks: \n"),console.log(JSON.stringify(this._nBlocks)));this._buildMap(h);this._DEBUG&&(console.log("***New Line at end of file(original): \n"),
console.log(JSON.stringify(this._oNewLineAtEnd)),console.log("***New Line at end of file(new): \n"),console.log(JSON.stringify(this._nNewLineAtEnd)),console.log("***Mapper: \n"),this._logMap(),console.log("***Total line number in original file: "+this._oFileContents.length));b||this._buildNewFile();return{outPutFile:this._nFileContents.join(this._diffLineDelimiter),mapper:this._deltaMap}},_logMap:function(){for(var e=0;e<this._deltaMap.length;e++)if(console.log(JSON.stringify(this._deltaMap[e])),
0<this._deltaMap[e][2]){console.log("    **Diff content on change/add: \n");for(var c=0;c<this._deltaMap[e][0];c++)console.log("    "+this._diffContents[this._deltaMap[e][2]+c-1])}},_logNewFile:function(){for(var e=0;e<this._nFileContents.length;e++)console.log(this._nFileContents[e])},_createBlock:function(e,c,h,b){b===h&&" "===e||(h=[h,b-h,"s"],"-"===e?h[2]="r":"+"===e?h[2]="a":"c"===e&&(h[2]="c"),c.push(h))},_createMinusBlock:function(e,c,h){var b=this._oBlocks.length;0===b||e!==this._oBlocks[b-
1][0]?(this._oBlocks.push([0===e?1:e,h]),this._nBlocks.push([c,0,-2])):this._oBlocks[b-1][1]+=h},_createPlusBlock:function(e,c,h,b){var f=this._nBlocks.length;0===f||c!==this._nBlocks[f-1][0]?(this._oBlocks.push([0===e?1:e,0]),this._nBlocks.push([c,h,b])):(this._nBlocks[f-1][1]+=h,this._nBlocks[f-1][2]=b)},_parseHunkBlock:function(e){for(var c=" ",h=this._hunkRanges[e][0]+1,b=e===this._hunkRanges.length-1?this._diffContents.length:this._hunkRanges[e+1][0],f=0,d=0,g=this._hunkRanges[e][1],a=this._hunkRanges[e][3],
n=h,p=h;p<b;p++)if(0!==this._diffContents[p].length){var k=this._diffContents[p][0];if("\\"===k&&("\\ No newline at end of file"===this._diffContents[p].substring(0,this._diffContents[p].length-1)||"\\ No newline at end of file"===this._diffContents[p]))"-"===c?this._oNewLineAtEnd=!1:" "===c?this._oNewLineAtEnd=this._nNewLineAtEnd=!1:this._nNewLineAtEnd=!1,p>h&&"\r"===this._diffContents[p-1][this._diffContents[p-1].length-1]&&(this._diffContents[p-1]=this._diffContents[p-1].substring(0,this._diffContents[p-
1].length-1));else{switch(k){case "-":case "+":case " ":break;default:continue}if(c!==k){"+"===k&&(n=p);switch(c){case " ":g=this._hunkRanges[e][1]+f;a=this._hunkRanges[e][3]+d;break;case "-":this._createMinusBlock(g,a,this._hunkRanges[e][1]+f-g);break;case "+":this._createPlusBlock(g,a,this._hunkRanges[e][3]+d-a,n)}c=k}switch(k){case "-":f++;break;case "+":d++;break;case " ":f++,d++}}}switch(c){case "-":this._createMinusBlock(g,a,this._hunkRanges[e][1]+f-g);break;case "+":this._createPlusBlock(g,
a,this._hunkRanges[e][3]+d-a,n)}},_detectConflictes:function(e,c){if(0>e)return!1;for(var h=e+c,b=e;b<h;b++){var f=this._diffContents[b];if(-1<f.indexOf("\x3c\x3c\x3c\x3c\x3c")||-1<f.indexOf("\x3e\x3e\x3e\x3e\x3e"))return!0}return!1},_buildMap:function(e){var c=this._oBlocks.length,h=this._oFileContents.length,b=0,f;f=1;for(var d=0;d<c;d++)f=this._oBlocks[d][0]-f,0<f&&(this._deltaMap.push([f,f,0]),b+=f),e&&this._detectConflictes(this._nBlocks[d][2],this._nBlocks[d][1])?this._deltaMap.push([this._nBlocks[d][1],
this._oBlocks[d][1],this._nBlocks[d][2]+1,1]):this._deltaMap.push([this._nBlocks[d][1],this._oBlocks[d][1],this._nBlocks[d][2]+1]),b+=this._oBlocks[d][1],f=this._oBlocks[d][0]+this._oBlocks[d][1];0<h-f&&(this._deltaMap.push([h-f+1,h-f+1,0]),b+=h-f+1);b<h&&(f=h-b,e=this._deltaMap[this._deltaMap.length-1],0===e[2]?(e[0]+=f,e[1]+=f):-1===e[2]?this._deltaMap.push([f,f,0]):this._nNewLineAtEnd===this._oNewLineAtEnd?this._deltaMap.push([f,f,0]):(this._nNewLineAtEnd&&(e[0]+=f),this._oNewLineAtEnd&&(e[1]+=
f)))},_buildNewFile:function(){var e=1,c=!1,h=this._deltaMap.length,b,f;for(b=0;b<h;b++){c=!1;if(0===this._deltaMap[b][2]){for(f=0;f<this._deltaMap[b][0];f++)this._nFileContents.push(this._oFileContents[e+f-1]);c=!0}else if(0<this._deltaMap[b][2])for(f=0;f<this._deltaMap[b][0];f++)this._nFileContents.push(this._diffContents[this._deltaMap[b][2]+f-1].substring(1));e+=this._deltaMap[b][1]}this._nNewLineAtEnd&&!c&&this._nFileContents.push("")},_converHRangeBody:function(e,c){if(e){var h=parseInt(e,10);
c.push(0<=h?h:1)}else c.push(1)},_parseHunkRange:function(e){var c=this._diffContents[e],h=/^@@\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/,b=/^@@\s*-([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*\+([\+|\-]*[\d]+)\s*,*\s*([\d]*)\s*@@+/.exec(c),f=null;if(b&&5===b.length)f=[e],this._converHRangeBody(b[1],f),this._converHRangeBody(b[2],f),this._converHRangeBody(b[3],f),this._converHRangeBody(b[4],f);else if((b=h.exec(c))&&5===b.length)f=[e],this._converHRangeBody(b[3],f),this._converHRangeBody(b[4],
f),this._converHRangeBody(b[1],f),this._converHRangeBody(b[2],f);return f}};return g}();return g});
define("orion/compare/compareRulers",["orion/compare/compareUtils"],function(g){var l=l||{};l.CompareRuler=function(){function g(e,c,h){this._location=e||"left";this._overview=c||"page";this._rulerStyle=h;this._editor=null;var b=this;this._listener={onModelChanged:function(c){b._onModelChanged(c)}}}g.prototype={setView:function(e){this._onModelChanged&&this._editor&&this._editor.removeEventListener("ModelChanged",this._listener.onModelChanged);this._editor=e;this._onModelChanged&&this._editor&&this._editor.addEventListener("ModelChanged",
this._listener.onModelChanged)},getLocation:function(){return this._location},getOverview:function(e){return this._overview},getAnnotationModel:function(){return null},addAnnotationType:function(e){},isAnnotationTypeVisible:function(e){return!1},removeAnnotationType:function(e){},setAnnotationModel:function(e){},getAnnotations:function(e,c){for(var h=[],b=e;b<c;b++){var f=this.getStyle(b);f&&(h[b]={html:this.getHTML(b),style:f})}return h},getWidestAnnotation:function(){return{html:this.getHTML(-1),
style:this.getStyle(-1)}},getRulerStyle:function(){return this.getStyle(void 0)}};return g}();l.LineNumberCompareRuler=function(){function g(e,c,h,b,f,d){l.CompareRuler.call(this,h,"page",b);this._diffNavigator=e;this._oddStyle=f||{style:{backgroundColor:"white"}};this._evenStyle=d||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._mapperColumnIndex=c}g.prototype=new l.CompareRuler;g.prototype.getStyle=function(e){return void 0===e?this._rulerStyle:this._evenStyle};g.prototype.getHTML=function(e){var c=
this._editor.getModel(),h=this._diffNavigator.getFeeder(0===this._mapperColumnIndex);return!h?"":-1===e?c.getLineCount():h.getLineNumber?(e=h.getLineNumber(e),-1===e?"":e+1):e+1};g.prototype._onModelChanged=function(e){var c=e.start,h=this._editor.getModel();e=h.getLineCount();var b=(e+"").length;this._numOfDigits!==b&&(this._numOfDigits=b,c=h.getLineAtOffset(c),this._editor.redrawLines(c,e,this))};return g}();l.CompareOverviewRuler=function(){function k(e,c,h,b){this._diffNavigator=h;this._onClick=
b;l.CompareRuler.call(this,e,"document",c)}k.prototype=new l.CompareRuler;k.prototype.getStyle=function(e){var c,h;if(void 0===e)c=this._rulerStyle||{},h=c.style||(c.style={}),h.lineHeight="1px",h.fontSize="1px",h.width="14px";else if(c=-1!==e?{styleClass:"annotationOverview breakpoint"}:{},h=c.style||(c.style={}),h.cursor="pointer",h.width="8px",h.left="2px",0<=e){var b;if(this._diffNavigator&&this._diffNavigator.getFeeder())b=this._diffNavigator.getFeeder().getDiffBlocks();else return null;e=g.getAnnotationIndex(b,
e);if(-1===e)return null;b=g.getAnnotationMapperIndex(b,e);var f;f=this._diffNavigator.getMapper();if(b=g.isMapperConflict(f,b))h.border="1px #FF0000 solid";e===this._diffNavigator.getCurrentBlockIndex()&&(h.backgroundColor=b?"red":"blue");e=this._diffNavigator.getFeeder().getDiffBlockH(e);b=this._diffNavigator.getFeeder().getOverviewLineCount();if(0>e)return null;f=this._editor.getClientArea();e=Math.floor(f.height*e/b);2>e&&(e=2);h.height=e+"px"}else return null;return c};k.prototype.setDiffNavigator=
function(e){this._diffNavigator=e};k.prototype.getHTML=function(e){return"\x26nbsp;"};k.prototype.onClick=function(e,c){void 0!==e&&this._onClick(e,this)};k.prototype._onModelChanged=function(e){0<this._editor.getModel().getLineCount()&&this._editor.redrawLines(0,1,this)};return k}();l.CompareCurveRuler=function(){function k(e){this._canvasDiv=e;this._mapper=void 0}k.prototype={init:function(e,c,h,b){this._rightIniting=this._rightIniting=this._leftIniting=!0;this._mapper=e;this._leftEditor=c;this._rightEditor=
h;this._leftTextView=c.getTextView();this._rightTextView=h.getTextView();this._diffNavigator=b;this.render()},matchPositionFrom:function(e){var c=e?this._leftTextView:this._rightTextView,h=e?this._rightTextView:this._leftTextView,b=c.getTopIndex(),c=c.getBottomIndex();e=g.matchMapper(this._mapper,e?0:1,b,c);h.setTopIndex(e)},copyTo:function(e){if(this._diffNavigator.iterator){var c=this._diffNavigator.iterator.cursor();if(c&&("word"===c.type?!c.copied&&!c.parent.copied:!c.copied)){var h=e?this._rightTextView.getText(c.oldA.start,
c.oldA.end):this._leftTextView.getText(c.newA.start,c.newA.end),b=e?c.newA:c.oldA;(e?this._leftTextView:this._rightTextView).setText(h,b.start,b.end);c.copied=!0}}},render:function(){if(this._mapper){var e=this._canvasDiv.getContext("2d");e.clearRect(0,0,this._canvasDiv.width,this._canvasDiv.height);e.strokeStyle="#AAAAAA";e.lineWidth=1;e.beginPath();var c=this._leftTextView.getTopIndex(),h=this._leftTextView.getBottomIndex(),b=this._rightTextView.getTopIndex(),f=this._rightTextView.getBottomIndex();
this._leftLineH=this._leftTextView.getLineHeight();this._rightLineH=this._rightTextView.getLineHeight();for(var d=0,m=0,a=!1,n=0;n<this._mapper.length;n++){if(0!==this._mapper[n][2])if(g.overlapMapper(this._mapper[n],0,d,c,h)||g.overlapMapper(this._mapper[n],1,m,b,f))this._renderCurve(n,d,m,this._canvasDiv,e,c,h,b,f),a=!0;else if(a)break;d+=this._mapper[n][0];m+=this._mapper[n][1]}e.stroke()}},_renderCurve:function(e,c,h,b,f,d,g,a,n){d=this._mapper[e];c=this._leftTextView.getLinePixel(c+d[0]/2)+d[0]%
2*this._leftLineH/3-this._leftTextView.getTopPixel();h=this._rightTextView.getLinePixel(h+d[1]/2)+d[1]%2*this._rightLineH/3-this._rightTextView.getTopPixel();b=b.parentNode.clientWidth;e===this._diffNavigator.getCurrentMapperIndex()?(f.stroke(),f.strokeStyle="#000",f.lineWidth=1,f.beginPath(),f.moveTo(0,c),f.bezierCurveTo(b/3,c,0.666*b,h,b,h),f.stroke(),f.strokeStyle="#AAAAAA",f.lineWidth=1,f.beginPath()):(f.moveTo(0,c),f.bezierCurveTo(b/3,c,0.666*b,h,b,h),f.stroke())},onChanged:function(e,c){var h=
c?this._rightIniting:this._leftIniting;if(e.removedLineCount!==e.addedLineCount){var b=c?this._rightTextView:this._leftTextView;h||g.updateMapper(this._mapper,c?1:0,b.getModel().getLineAtOffset(e.start),e.removedLineCount,e.addedLineCount);(0<e.removedLineCount||0<e.addedLineCount)&&this.render()}c?this._rightIniting=!1:this._leftIniting=!1;return h}};return k}();return l});
define("orion/editor/i18n",{load:function(g,l,k,e){l.specified&&l.specified("orion/bootstrap")?l(["orion/i18n!"+g],function(c){k(c)}):k({})}});
define("orion/editor/nls/root/messages",{multipleAnnotations:"Multiple annotations:",line:"Line: ${0}",breakpoint:"Breakpoint",bookmark:"Bookmark",task:"Task",error:"Error",warning:"Warning",matchingSearch:"Matching Search",currentSearch:"Current Search",currentLine:"Current Line",matchingBracket:"Matching Bracket",currentBracket:"Current Bracket",lineUp:"Line Up",lineDown:"Line Down",lineStart:"Line Start",lineEnd:"Line End",charPrevious:"Previous Character",charNext:"Next Character",pageUp:"Page Up",
pageDown:"Page Down",scrollPageUp:"Scroll Page Up",scrollPageDown:"Scroll Page Down",scrollLineUp:"Scroll Line Up",scrollLineDown:"Scroll Line Down",wordPrevious:"Previous Word",wordNext:"Next Word",textStart:"Document Start",textEnd:"Document End",scrollTextStart:"Scroll Document Start",scrollTextEnd:"Scroll Document End",centerLine:"Center Line",selectLineUp:"Select Line Up",selectLineDown:"Select Line Down",selectWholeLineUp:" Select Whole Line Up",selectWholeLineDown:"Select Whole Line Down",
selectLineStart:"Select Line Start",selectLineEnd:"Select Line End",selectCharPrevious:"Select Previous Character",selectCharNext:"Select Next Character",selectPageUp:"Select Page Up",selectPageDown:"Select Page Down",selectWordPrevious:"Select Previous Word",selectWordNext:"Select Next Word",selectTextStart:"Select Document Start",selectTextEnd:"Select Document End",deletePrevious:"Delete Previous Character",deleteNext:"Delete Next Character",deleteWordPrevious:"Delete Previous Word",deleteWordNext:"Delete Next Word",
deleteLineStart:"Delete Line Start",deleteLineEnd:"Delete Line End",tab:"Insert Tab",enter:"Insert Line Delimiter",enterNoCursor:"Insert Line Delimiter",selectAll:"Select All",copy:"Copy",cut:"Cut",paste:"Paste",uppercase:"To Upper Case",lowercase:"To Lower Case",capitalize:"Capitalize",reversecase:"Reverse Case",toggleWrapMode:"Toggle Wrap Mode",toggleTabMode:"Toggle Tab Mode",toggleOverwriteMode:"Toggle Overwrite Mode",committerOnTime:"${0} on ${1}",emacs:"Emacs",exchangeMarkPoint:"Exchange Mark and Point",
setMarkCommand:"Set Mark",clearMark:"Clear Mark",digitArgument:"Digit Argument ${0}",negativeArgument:"Negative Argument",Comment:"Comment","Flat outline":"Flat outline",incrementalFindStr:"Incremental find: ${0}",incrementalFindStrNotFound:"Incremental find: ${0} (not found)",incrementalFindReverseStr:"Reverse Incremental find: ${0}",incrementalFindReverseStrNotFound:"Reverse Incremental find: ${0} (not found)",find:"Find...",undo:"Undo",redo:"Redo",cancelMode:"Cancel Current Mode",findNext:"Find Next Occurrence",
findPrevious:"Find Previous Occurrence",incrementalFind:"Incremental Find",incrementalFindReverse:"Incremental Find Reverse",indentLines:"Indent Lines",unindentLines:"Unindent Lines",moveLinesUp:"Move Lines Up",moveLinesDown:"Move Lines Down",copyLinesUp:"Copy Lines Up",copyLinesDown:"Copy Lines Down",deleteLines:"Delete Lines",gotoLine:"Goto Line...",gotoLinePrompty:"Goto Line:",nextAnnotation:"Next Annotation",prevAnnotation:"Previous Annotation",expand:"Expand",collapse:"Collapse",expandAll:"Expand All",
collapseAll:"Collapse All",lastEdit:"Last Edit Location",trimTrailingWhitespaces:"Trim Trailing Whitespaces",toggleLineComment:"Toggle Line Comment",addBlockComment:"Add Block Comment",removeBlockComment:"Remove Block Comment",linkedModeEntered:"Linked Mode entered",linkedModeExited:"Linked Mode exited",syntaxError:"Syntax Error",contentAssist:"Content Assist",lineColumn:"Line ${0} : Col ${1}",vi:"vi",vimove:"(Move)",viyank:"(Yank)",videlete:"(Delete)",vichange:"(Change)",viLeft:"${0} Left",viRight:"${0} Right",
viUp:"${0} Up",viDown:"${0} Down",viw:"${0} Next Word",vib:"${0} Beginning of Word",viW:"${0} Next Word (ws stop)",viB:"${0} Beginning of Word (ws stop)",vie:"${0} End of Word",viE:"${0} End of Word (ws stop)",vi$:"${0} End of the line","vi^_":"${0} First non-blank Char Current Line","vi+":"${0} First Char Next Line","vi-":"${0} First Char Previous Line","vi|":"${0} nth Column in Line",viH:"${0} Top of Page",viM:"${0} Middle of Page",viL:"${0} Bottom of Page","vi/":"${0} Search Forward","vi?":"${0} Search Backward",
vin:"${0} Next Search",viN:"${0} Previous Search",vif:"${0} Search Char Fwd",viF:"${0} Search Char Bckwd",vit:"${0} Search Before Char Fwd",viT:"${0} Search Before Char Bckwd","vi,":"${0} Repeat Reverse Char Search","vi;":"${0} Repeat Char Search",viG:"${0} Go to Line",viycd:"${0} Current Line",via:"Append After Cursor",viA:"Append to End of Line",vii:"Insert Before Cursor",viI:"Insert at Beginning of Line",viO:"Insert Line Above",vio:"Insert Line Below",viR:"Begin Overwriting Text",vis:"Substitute a Character",
viS:"Substitute Entire Line",viC:"Change Text Until Line End",vip:"Paste After Char or Line",viP:"Paste Before Char or Line",viStar:"Search Word Under Cursor",replaceAll:"Replacing all...",replacedMatches:"Replaced ${0} matches",nothingReplaced:"Nothing replaced",notFound:"Not found"});
define("orion/editor/nls/messages",["orion/editor/i18n!orion/editor/nls/messages","orion/editor/nls/root/messages"],function(g,l){var k={root:l},e;for(e in g)g.hasOwnProperty(e)&&"undefined"===typeof k[e]&&(k[e]=g[e]);return k});
define("orion/editor/textModel",["orion/editor/eventTarget","orion/regex","orion/util"],function(g,l,k){function e(c,e){this._lastLineIndex=-1;this._text=[""];this._lineOffsets=[0];this.setText(c);this.setLineDelimiter(e)}e.prototype={destroy:function(){},find:function(c){1<this._text.length&&(this._text=[this._text.join("")]);var e=c.string,b=c.regex,f=e,d="",g=c.caseInsensitive;if(f)if(b){if(e=l.parse(f))f=e.pattern,d=e.flags}else f=e.replace(/([\\$\^*\/+?\.\(\)|{}\[\]])/g,"\\$\x26"),g&&(f=f.replace(/[iI\u0130\u0131]/g,
"[Ii\u0130\u0131]"));var a=null,n;if(f){var e=c.reverse,p=c.wrap,b=c.wholeWord,k=c.start||0;c=c.end;var r=null!==c&&void 0!==c;-1===d.indexOf("g")&&(d+="g");-1===d.indexOf("m")&&(d+="m");g&&-1===d.indexOf("i")&&(d+="i");b&&(f="\\b"+f+"\\b");var s=this._text[0],w,v,u=0;r&&(g=k<c?k:c,s=s.substring(g,k<c?c:k),u=g);var y=RegExp(f,d);e?n=function(){var a=null;for(y.lastIndex=0;;){v=y.lastIndex;w=y.exec(s);if(v===y.lastIndex)return null;if(w){if(!(w.index+u<k)){if(!p||a)break;k=s.length+u}a={start:w.index+
u,end:y.lastIndex+u}}else break}a&&(k=a.start);return a}:(r||(y.lastIndex=k),n=function(){for(;;){v=y.lastIndex;w=y.exec(s);if(v===y.lastIndex)break;if(w)return{start:w.index+u,end:y.lastIndex+u};if(!(0!==v&&p))break}return null});a=n()}return{next:function(){var b=a;b&&(a=n());return b},hasNext:function(){return null!==a}}},getCharCount:function(){for(var c=0,e=0;e<this._text.length;e++)c+=this._text[e].length;return c},getLine:function(c,e){var b=this.getLineCount();if(!(0<=c&&c<b))return null;
var f=this._lineOffsets[c];if(c+1<b){b=this.getText(f,this._lineOffsets[c+1]);if(e)return b;for(var f=b.length,d;10===(d=b.charCodeAt(f-1))||13===d;)f--;return b.substring(0,f)}return this.getText(f)},getLineAtOffset:function(c){var e=this.getCharCount();if(!(0<=c&&c<=e))return-1;var b=this.getLineCount();if(c===e)return b-1;var f,d,g=this._lastLineIndex;if(0<=g&&g<b&&(f=this._lineOffsets[g],d=g+1<b?this._lineOffsets[g+1]:e,f<=c&&c<d))return g;for(var a=b,n=-1;1<a-n;)if(g=Math.floor((a+n)/2),f=this._lineOffsets[g],
d=g+1<b?this._lineOffsets[g+1]:e,c<=f)a=g;else if(c<d){a=g;break}else n=g;return this._lastLineIndex=a},getLineCount:function(){return this._lineOffsets.length},getLineDelimiter:function(){return this._lineDelimiter},getLineEnd:function(c,e){var b=this.getLineCount();if(!(0<=c&&c<b))return-1;if(c+1<b){b=this._lineOffsets[c+1];if(e)return b;for(var f=this.getText(Math.max(this._lineOffsets[c],b-2),b),d=f.length,g;10===(g=f.charCodeAt(d-1))||13===g;)d--;return b-(f.length-d)}return this.getCharCount()},
getLineStart:function(c){return!(0<=c&&c<this.getLineCount())?-1:this._lineOffsets[c]},getText:function(c,e){void 0===c&&(c=0);void 0===e&&(e=this.getCharCount());if(c===e)return"";for(var b=0,f=0,d;f<this._text.length;){d=this._text[f].length;if(c<=b+d)break;b+=d;f++}for(var g=b,a=f;f<this._text.length;){d=this._text[f].length;if(e<=b+d)break;b+=d;f++}if(a===f)return this._text[a].substring(c-g,e-b);g=this._text[a].substring(c-g);b=this._text[f].substring(0,e-b);return g+this._text.slice(a+1,f).join("")+
b},onChanging:function(c){return this.dispatchEvent(c)},onChanged:function(c){return this.dispatchEvent(c)},setLineDelimiter:function(c,e){"auto"===c&&(c=void 0,1<this.getLineCount()&&(c=this.getText(this.getLineEnd(0),this.getLineEnd(0,!0))));this._lineDelimiter=c?c:k.platformDelimiter;if(e){var b=this.getLineCount();if(1<b){for(var f=Array(b),d=0;d<b;d++)f[d]=this.getLine(d);this.setText(f.join(this._lineDelimiter))}}},setText:function(c,e,b){void 0===c&&(c="");void 0===e&&(e=0);void 0===b&&(b=
this.getCharCount());if(!(e===b&&""===c)){for(var f=this.getLineAtOffset(e),d=this.getLineAtOffset(b),g=e,a=b-e,n=d-f,p=c.length,k=0,l=this.getLineCount(),s=0,w=0,v=0,u=[];;){-1!==s&&s<=v&&(s=c.indexOf("\r",v));-1!==w&&w<=v&&(w=c.indexOf("\n",v));if(-1===w&&-1===s)break;v=-1!==s&&-1!==w?s+1===w?w+1:(s<w?s:w)+1:-1!==s?s+1:w+1;u.push(e+v);k++}this.onChanging({type:"Changing",text:c,start:g,removedCharCount:a,addedCharCount:p,removedLineCount:n,addedLineCount:k});0===u.length&&(v=this.getLineStart(f),
d=d+1<l?this.getLineStart(d+1):this.getCharCount(),e!==v&&(c=this.getText(v,e)+c,e=v),b!==d&&(c+=this.getText(b,d),b=d));v=p-a;for(d=f+n+1;d<l;d++)this._lineOffsets[d]+=v;if(5E4>u.length)f=[f+1,n].concat(u),Array.prototype.splice.apply(this._lineOffsets,f);else{v=f+1;this._lineOffsets.splice(v,n);for(l=0;l<u.length;l+=5E4)f=[v,0].concat(u.slice(l,Math.min(u.length,l+5E4))),Array.prototype.splice.apply(this._lineOffsets,f),v+=5E4}for(v=l=0;v<this._text.length;){d=this._text[v].length;if(e<=l+d)break;
l+=d;v++}f=l;for(u=v;v<this._text.length;){d=this._text[v].length;if(b<=l+d)break;l+=d;v++}d=this._text[v];e=this._text[u].substring(0,e-f);b=d.substring(b-l);u=[u,v-u+1];e&&u.push(e);c&&u.push(c);b&&u.push(b);Array.prototype.splice.apply(this._text,u);0===this._text.length&&(this._text=[""]);this.onChanged({type:"Changed",start:g,removedCharCount:a,addedCharCount:p,removedLineCount:n,addedLineCount:k})}}};g.EventTarget.addMixin(e.prototype);return{TextModel:e}});
define("orion/editor/keyModes",["orion/keyBinding","orion/util"],function(g,l){function k(c){c&&(this._view=c,this._keyBindings=this.createKeyBindings(),this._keyBindingIndex=0)}function e(c){k.call(this,c)}k.prototype={createKeyBindings:function(){return[]},getKeyBindings:function(c){for(var e=[],b=this._keyBindings,f=0;f<b.length;f++)b[f].actionID===c&&e.push(b[f].keyBinding);return e},getView:function(){return this._view},isActive:function(){return-1!==this._view.getKeyModes().indexOf(this)},match:function(c){if("keydown"===
c.type)switch(c.keyCode){case 16:case 17:case 18:case 91:return}for(var e=this._keyBindingIndex,b=this._matchingKeyBindings||this._keyBindings,f=[],d=0;d<b.length;d++){var g=b[d],a=g.keyBinding.match(c,e);if(!0===a)return this._keyBindingIndex=0,this._matchingKeyBindings=null,g.actionID;"number"===typeof a&&f.push(g)}if(0===f.length)this._keyBindingIndex=0,this._matchingKeyBindings=null;else return this._keyBindingIndex++,this._matchingKeyBindings=f,"noop"},setKeyBinding:function(c,e){for(var b=this._keyBindings,
f=0;f<b.length;f++){var d=b[f];if(d.keyBinding.equals(c)){e?d.actionID=e:d.predefined?d.actionID="noop":b.splice(f,1);return}}e&&b.push({keyBinding:c,actionID:e})},setView:function(c){this._view=c}};e.prototype=new k;e.prototype.createKeyBindings=function(){var c=g.KeyBinding,e=[];e.push({actionID:"lineUp",keyBinding:new c(38),predefined:!0});e.push({actionID:"lineDown",keyBinding:new c(40),predefined:!0});e.push({actionID:"charPrevious",keyBinding:new c(37),predefined:!0});e.push({actionID:"charNext",
keyBinding:new c(39),predefined:!0});l.isMac?(e.push({actionID:"scrollPageUp",keyBinding:new c(33),predefined:!0}),e.push({actionID:"scrollPageDown",keyBinding:new c(34),predefined:!0}),e.push({actionID:"pageUp",keyBinding:new c(33,null,null,!0),predefined:!0}),e.push({actionID:"pageDown",keyBinding:new c(34,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new c(37,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new c(39,!0),predefined:!0}),e.push({actionID:"wordPrevious",
keyBinding:new c(37,null,null,!0),predefined:!0}),e.push({actionID:"wordNext",keyBinding:new c(39,null,null,!0),predefined:!0}),e.push({actionID:"scrollTextStart",keyBinding:new c(36),predefined:!0}),e.push({actionID:"scrollTextEnd",keyBinding:new c(35),predefined:!0}),e.push({actionID:"textStart",keyBinding:new c(38,!0),predefined:!0}),e.push({actionID:"textEnd",keyBinding:new c(40,!0),predefined:!0}),e.push({actionID:"scrollPageUp",keyBinding:new c(38,null,null,null,!0),predefined:!0}),e.push({actionID:"scrollPageDown",
keyBinding:new c(40,null,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new c(37,null,null,null,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new c(39,null,null,null,!0),predefined:!0}),e.push({actionID:"lineStart",keyBinding:new c(38,null,null,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new c(40,null,null,!0),predefined:!0})):(e.push({actionID:"pageUp",keyBinding:new c(33),predefined:!0}),e.push({actionID:"pageDown",keyBinding:new c(34),predefined:!0}),
e.push({actionID:"lineStart",keyBinding:new c(36),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new c(35),predefined:!0}),e.push({actionID:"wordPrevious",keyBinding:new c(37,!0),predefined:!0}),e.push({actionID:"wordNext",keyBinding:new c(39,!0),predefined:!0}),e.push({actionID:"textStart",keyBinding:new c(36,!0),predefined:!0}),e.push({actionID:"textEnd",keyBinding:new c(35,!0),predefined:!0}));l.isFirefox&&l.isLinux&&(e.push({actionID:"lineUp",keyBinding:new c(38,!0),predefined:!0}),e.push({actionID:"lineDown",
keyBinding:new c(40,!0),predefined:!0}));l.isWindows&&(e.push({actionID:"scrollLineUp",keyBinding:new c(38,!0),predefined:!0}),e.push({actionID:"scrollLineDown",keyBinding:new c(40,!0),predefined:!0}));e.push({actionID:"selectLineUp",keyBinding:new c(38,null,!0),predefined:!0});e.push({actionID:"selectLineDown",keyBinding:new c(40,null,!0),predefined:!0});e.push({actionID:"selectCharPrevious",keyBinding:new c(37,null,!0),predefined:!0});e.push({actionID:"selectCharNext",keyBinding:new c(39,null,!0),
predefined:!0});e.push({actionID:"selectPageUp",keyBinding:new c(33,null,!0),predefined:!0});e.push({actionID:"selectPageDown",keyBinding:new c(34,null,!0),predefined:!0});l.isMac?(e.push({actionID:"selectLineStart",keyBinding:new c(37,!0,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new c(39,!0,!0),predefined:!0}),e.push({actionID:"selectWordPrevious",keyBinding:new c(37,null,!0,!0),predefined:!0}),e.push({actionID:"selectWordNext",keyBinding:new c(39,null,!0,!0),predefined:!0}),
e.push({actionID:"selectTextStart",keyBinding:new c(36,null,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new c(35,null,!0),predefined:!0}),e.push({actionID:"selectTextStart",keyBinding:new c(38,!0,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new c(40,!0,!0),predefined:!0}),e.push({actionID:"selectLineStart",keyBinding:new c(37,null,!0,null,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new c(39,null,!0,null,!0),predefined:!0}),e.push({actionID:"selectLineStart",
keyBinding:new c(38,null,!0,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new c(40,null,!0,!0),predefined:!0})):(l.isLinux&&(e.push({actionID:"selectWholeLineUp",keyBinding:new c(38,!0,!0),predefined:!0}),e.push({actionID:"selectWholeLineDown",keyBinding:new c(40,!0,!0),predefined:!0})),e.push({actionID:"selectLineStart",keyBinding:new c(36,null,!0),predefined:!0}),e.push({actionID:"selectLineEnd",keyBinding:new c(35,null,!0),predefined:!0}),e.push({actionID:"selectWordPrevious",
keyBinding:new c(37,!0,!0),predefined:!0}),e.push({actionID:"selectWordNext",keyBinding:new c(39,!0,!0),predefined:!0}),e.push({actionID:"selectTextStart",keyBinding:new c(36,!0,!0),predefined:!0}),e.push({actionID:"selectTextEnd",keyBinding:new c(35,!0,!0),predefined:!0}));e.push({actionID:"undo",keyBinding:new g.KeyBinding("z",!0),predefined:!0});l.isMac?e.push({actionID:"redo",keyBinding:new g.KeyBinding("z",!0,!0),predefined:!0}):e.push({actionID:"redo",keyBinding:new g.KeyBinding("y",!0),predefined:!0});
e.push({actionID:"deletePrevious",keyBinding:new c(8),predefined:!0});e.push({actionID:"deletePrevious",keyBinding:new c(8,null,!0),predefined:!0});e.push({actionID:"deleteNext",keyBinding:new c(46),predefined:!0});e.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0),predefined:!0});e.push({actionID:"deleteWordPrevious",keyBinding:new c(8,!0,!0),predefined:!0});e.push({actionID:"deleteWordNext",keyBinding:new c(46,!0),predefined:!0});e.push({actionID:"tab",keyBinding:new c(9),predefined:!0});
e.push({actionID:"shiftTab",keyBinding:new c(9,null,!0),predefined:!0});e.push({actionID:"enter",keyBinding:new c(13),predefined:!0});e.push({actionID:"enter",keyBinding:new c(13,null,!0),predefined:!0});e.push({actionID:"selectAll",keyBinding:new c("a",!0),predefined:!0});e.push({actionID:"toggleTabMode",keyBinding:new c("m",!0),predefined:!0});l.isMac&&(e.push({actionID:"deleteNext",keyBinding:new c(46,null,!0),predefined:!0}),e.push({actionID:"deleteWordPrevious",keyBinding:new c(8,null,null,!0),
predefined:!0}),e.push({actionID:"deleteWordNext",keyBinding:new c(46,null,null,!0),predefined:!0}));e.push({actionID:"toggleWrapMode",keyBinding:new g.KeyBinding("w",!0,!1,!0)});e.push({actionID:"toggleOverwriteMode",keyBinding:new g.KeyBinding(45)});if(!l.isFirefox){var b=l.isMac&&l.isChrome;e.push({actionID:"noop",keyBinding:new c("u",!b,!1,!1,b),predefined:!0});e.push({actionID:"noop",keyBinding:new c("i",!b,!1,!1,b),predefined:!0});e.push({actionID:"noop",keyBinding:new c("b",!b,!1,!1,b),predefined:!0})}l.isFirefox&&
(e.push({actionID:"copy",keyBinding:new c(45,!0),predefined:!0}),e.push({actionID:"paste",keyBinding:new c(45,null,!0),predefined:!0}),e.push({actionID:"cut",keyBinding:new c(46,null,!0),predefined:!0}));l.isMac&&(e.push({actionID:"lineStart",keyBinding:new c("a",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineEnd",keyBinding:new c("e",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineUp",keyBinding:new c("p",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"lineDown",keyBinding:new c("n",!1,!1,
!1,!0),predefined:!0}),e.push({actionID:"charPrevious",keyBinding:new c("b",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"charNext",keyBinding:new c("f",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deletePrevious",keyBinding:new c("h",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteNext",keyBinding:new c("d",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteLineEnd",keyBinding:new c("k",!1,!1,!1,!0),predefined:!0}),l.isFirefox?(e.push({actionID:"scrollPageDown",keyBinding:new c("v",!1,
!1,!1,!0),predefined:!0}),e.push({actionID:"deleteLineStart",keyBinding:new c("u",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"deleteWordPrevious",keyBinding:new c("w",!1,!1,!1,!0),predefined:!0})):(e.push({actionID:"pageDown",keyBinding:new c("v",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"centerLine",keyBinding:new c("l",!1,!1,!1,!0),predefined:!0}),e.push({actionID:"enterNoCursor",keyBinding:new c("o",!1,!1,!1,!0),predefined:!0})));return e};return{KeyMode:k,DefaultKeyMode:e}});
define("orion/editor/util",[],function(){return{contains:function(g,l){if(!l)return!1;if(!g.compareDocumentPosition){for(var k=l;k;){if(g===k)return!0;k=k.parentNode}return!1}return g===l||0!==(g.compareDocumentPosition(l)&16)},addEventListener:function(g,l,k,e){"function"===typeof g.addEventListener?g.addEventListener(l,k,!0===e):g.attachEvent("on"+l,k)},removeEventListener:function(g,l,k,e){"function"===typeof g.removeEventListener?g.removeEventListener(l,k,!0===e):g.detachEvent("on"+l,k)}}});
define("orion/editor/textView","i18n!orion/editor/nls/messages orion/editor/textModel orion/editor/keyModes orion/editor/eventTarget orion/editor/textTheme orion/editor/util orion/util".split(" "),function(g,l,k,e,c,h,b){function f(a,d,c){if(c){d.className="";c=d.attributes;for(var e=c.length;0<e--;)(!b.isIE||9<=b.isIE||9>b.isIE&&c[e].specified)&&d.removeAttribute(c[e].name)}if(a){a.styleClass&&(d.className=a.styleClass);if(c=a.style)for(var f in c)c.hasOwnProperty(f)&&(d.style[f]=c[f]);if(a=a.attributes)for(var g in a)a.hasOwnProperty(g)&&
d.setAttribute(g,a[g])}}function d(a){return a instanceof Array?a.slice(0):a}function m(a,b){if(!a)return b;if(!b)return a;for(var d in b)b.hasOwnProperty(d)&&(a.hasOwnProperty(d)||(a[d]=b[d]));return a}function a(b,d){if(b===d)return!0;if(b&&!d||!b&&d||b&&b.constructor===String||d&&d.constructor===String)return!1;if(b instanceof Array||d instanceof Array){if(!(b instanceof Array&&d instanceof Array)||b.length!==d.length)return!1;for(var c=0;c<b.length;c++)if(!a(b[c],d[c]))return!1;return!0}if(!(b instanceof
Object)||!(d instanceof Object))return!1;for(c in b)if(b.hasOwnProperty(c)&&(!d.hasOwnProperty(c)||!a(b[c],d[c])))return!1;for(c in d)if(!b.hasOwnProperty(c))return!1;return!0}function n(a,b,d){for(var c=0,e=0,f=0,g=a.length;f<g;){-1!==c&&c<=f&&(c=a.indexOf("\r",f));-1!==e&&e<=f&&(e=a.indexOf("\n",f));var h=f,m;if(-1===e&&-1===c){b(a.substring(f));break}-1!==c&&-1!==e?c+1===e?(m=c,f=e+1):(m=c<e?c:e,f=(c<e?c:e)+1):-1!==c?(m=c,f=c+1):(m=e,f=e+1);b(a.substring(h,m));d()}}function p(a){var b,d,c,e,f=
a.ownerDocument.defaultView||a.ownerDocument.parentWindow;f.getComputedStyle?(a=f.getComputedStyle(a,null),b=a.getPropertyValue("padding-left"),d=a.getPropertyValue("padding-top"),c=a.getPropertyValue("padding-right"),e=a.getPropertyValue("padding-bottom")):a.currentStyle&&(b=a.currentStyle.paddingLeft,d=a.currentStyle.paddingTop,c=a.currentStyle.paddingRight,e=a.currentStyle.paddingBottom);return{left:parseInt(b,10)||0,top:parseInt(d,10)||0,right:parseInt(c,10)||0,bottom:parseInt(e,10)||0}}function t(a){var b,
d,c,e,f=a._trim;if(!f){var f=p(a),g=a.ownerDocument.defaultView||a.ownerDocument.parentWindow;g.getComputedStyle?(e=g.getComputedStyle(a,null),b=e.getPropertyValue("border-left-width"),d=e.getPropertyValue("border-top-width"),c=e.getPropertyValue("border-right-width"),e=e.getPropertyValue("border-bottom-width")):a.currentStyle&&(b=a.currentStyle.borderLeftWidth,d=a.currentStyle.borderTopWidth,c=a.currentStyle.borderRightWidth,e=a.currentStyle.borderBottomWidth);b=parseInt(b,10)||0;d=parseInt(d,10)||
0;c=parseInt(c,10)||0;e=parseInt(e,10)||0;f.left+=b;f.top+=d;f.right+=c;f.bottom+=e;a._trim=f}return f}function r(a,b,d,c){function e(b){if(b.animationName===g){var d=b.target;"function"===typeof d.__DOMReady&&(a.defaultView||a.parentWindow).setTimeout(function(){d.__DOMReady()},0)}}function f(a,b){for(var d=["","-webkit-","-moz-","-ms-","-o-"],c="",e="body ."+a+" {\n",q=0;q<d.length;q++)c+="@"+d[q]+"keyframes "+b+" {\nfrom { opacity: 0.99; }\nto { opacity: 1; }\n}\n",e+=d[q]+"animation-duration: 0.001s;\n"+
d[q]+"animation-name: "+b+";\n";return c+(e+"}")}d="_"+d+"DOMReady";b.className=b.className?b.className+" "+d:d;b.__DOMReady=c;c=d+"Style";if(!a.getElementById(c)){var g=d+"Animation";a.addEventListener("animationstart",e,!1);a.addEventListener("MSAnimationStart",e,!1);a.addEventListener("webkitAnimationStart",e,!1);b=a.createElement("style");b.id=c;c=a.getElementsByTagName("head")[0]||a.documentElement;b.appendChild(a.createTextNode(f(d,g)));c.insertBefore(b,c.firstChild)}}function s(a,b,d){this.start=
a;this.end=b;this.caret=d}function w(a){this.left=a.left;this.top=a.top;this.right=a.right;this.bottom=a.bottom}function v(a,b,d){this.view=a;this.lineIndex=b;this._lineDiv=d}function u(a){this._init(a||{})}var y=h.addEventListener,x=h.removeEventListener,z=function(){function a(b){this.options=b}a.prototype.play=function(){var a="number"===typeof this.options.duration?this.options.duration:350,b=this.options.easing||this.defaultEasing,d=this.options.onAnimate||function(){},c=this.options.curve[0],
e=this.options.curve[1],q=e-c,f=-1,g,h=this;this.interval=this.options.window.setInterval(function(){f=-1===f?(new Date).getTime():f;var m=((new Date).getTime()-f)/a;1>m?(m=b(m),g=c+m*q,d(g)):(d(e),h.stop())},"number"===typeof this.options.rate?this.options.rate:20)};a.prototype.stop=function(){this.options.window.clearInterval(this.interval);(this.options.onEnd||function(){})()};a.prototype.defaultEasing=function(a){return Math.sin(a*(Math.PI/2))};return a}();s.prototype={clone:function(){return new s(this.start,
this.end,this.caret)},collapse:function(){this.caret?this.end=this.start:this.start=this.end},extend:function(a){this.caret?this.start=a:this.end=a;this.start>this.end&&(a=this.start,this.start=this.end,this.end=a,this.caret=!this.caret)},setCaret:function(a){this.end=this.start=a;this.caret=!1},getCaret:function(){return this.caret?this.start:this.end},toString:function(){return"start\x3d"+this.start+" end\x3d"+this.end+(this.caret?" caret is at start":" caret is at end")},isEmpty:function(){return this.start===
this.end},equals:function(a){return this.caret===a.caret&&this.start===a.start&&this.end===a.end}};w.prototype={toString:function(){return"{l\x3d"+this.left+", t\x3d"+this.top+", r\x3d"+this.right+", b\x3d"+this.bottom+"}"}};v.prototype={create:function(a,b){if(!this._lineDiv){var d=this._lineDiv=this._createLine(a,b,this.lineIndex);d._line=this;return d}},_createLine:function(d,c,e){var g=this.view,h=g._model,m=h.getLine(e),n=h.getLineStart(e),p={type:"LineStyle",textView:g,lineIndex:e,lineText:m,
lineStart:n};g.onLineStyle(p);var k=d.ownerDocument,h=c||b.createElement(k,"div");if(!c||!a(c.viewStyle,p.style))f(p.style,h,c),c&&(c._trim=null),h.viewStyle=p.style,h.setAttribute("role","presentation");h.lineIndex=e;if(c&&h.viewLineText===m&&a(p.ranges,h.viewRanges))return h;h.viewRanges=p.ranges;h.viewLineText=m;e=[];this._createRanges(p.ranges,m,0,m.length,n,{tabOffset:0,ranges:e});p=" ";!g._fullSelection&&9>b.isIE&&(p="\ufeff");g={text:p,style:g._metrics.largestFontStyle,ignoreChars:1};0===e.length||
!e[e.length-1].style||"div"!==e[e.length-1].style.tagName?e.push(g):e.splice(e.length-1,0,g);var t,l,r,s=p=0;if(b.isFirefox&&2E3<m.length){c&&(h.innerHTML="",c.lineWidth=void 0);c=k.createDocumentFragment();for(m=0;m<e.length;m++)g=e[m],n=g.text,t=g.style,t=this._createSpan(h,n,t,g.ignoreChars),c.appendChild(t);h.appendChild(c)}else{var x,w;if(c){if(l=c.modelChangedEvent)0===l.removedLineCount&&0===l.addedLineCount?(w=l.start-n,x=l.addedCharCount-l.removedCharCount):w=-1,c.modelChangedEvent=void 0;
l=c.firstChild}for(m=0;m<e.length;m++){g=e[m];n=g.text;p+=n.length;t=g.style;if(l)if(r=l.firstChild.data,k=l.viewStyle,r===n&&a(t,k)){s+=r.length;l._rectsCache=void 0;t=l=l.nextSibling;continue}else for(;l;){if(-1!==w){k=p;k>=w&&(k-=x);r=(r=l.firstChild.data)?r.length:0;if(s+r>k)break;s+=r}k=l.nextSibling;h.removeChild(l);l=k}t=this._createSpan(h,n,t,g.ignoreChars);l?h.insertBefore(t,l):h.appendChild(t);c&&(c.lineWidth=void 0)}if(c)for(x=t?t.nextSibling:null;x;)k=x.nextSibling,c.removeChild(x),x=
k}h.parentNode||d.appendChild(h);return h},_createRanges:function(b,d,c,e,f,g){if(!(c>e)){if(b)for(var h=0;h<b.length;h++){var m=b[h];if(!(m.end<f+c)){var n=Math.max(f+c,m.start)-f;if(n>e)break;var p=Math.min(f+e,m.end)-f;if(n<=p){n=Math.max(c,n);p=Math.min(e,p);c<n&&this._createRange(d,c,n,null,g);if(!m.style||!m.style.unmergeable)for(;h+1<b.length&&b[h+1].start-f===p&&a(m.style,b[h+1].style);)m=b[h+1],p=Math.min(f+e,m.end)-f,h++;this._createRange(d,n,p,m.style,g);c=p}}}c<e&&this._createRange(d,
c,e,null,g)}},_createRange:function(a,b,d,c,e){if(!(b>d)){var f=this.view._customTabSize;if(f&&8!==f)for(var g=a.indexOf("\t",b);-1!==g&&g<d;){b<g&&(b={text:a.substring(b,g),style:c},e.ranges.push(b),e.tabOffset+=b.text.length);b=f-e.tabOffset%f;if(0<b){for(var h="\u00a0",m=1;m<b;m++)h+=" ";b={text:h,style:c,ignoreChars:b-1};e.ranges.push(b);e.tabOffset+=b.text.length}b=g+1;if(b===d)return;g=a.indexOf("\t",b)}b<=d&&(b={text:a.substring(b,d),style:c},e.ranges.push(b),e.tabOffset+=b.text.length)}},
_createSpan:function(a,d,c,e){var g=this.view,h="span";c&&c.tagName&&(h=c.tagName.toLowerCase());var m="a"===h;m&&(this.hasLink=!0);m&&!g._linksVisible&&(h="span");m=a.ownerDocument;a=b.createElement(a.ownerDocument,h);a.appendChild(m.createTextNode(c&&c.text?c.text:d));c&&c.html?(a.innerHTML=c.html,a.ignore=!0):c&&c.node&&(a.appendChild(c.node),a.ignore=!0);f(c,a);if("a"===h){var n=g._getWindow();y(a,"click",function(a){return g._handleLinkClick(a?a:n.event)},!1)}a.viewStyle=c;e&&(a.ignoreChars=
e);return a},_ensureCreated:function(){return this._lineDiv?this._lineDiv:this._createdDiv=this.create(this.view._clientDiv,null)},getBoundingClientRect:function(a,d){var c=this._ensureCreated(),e=this.view;if(void 0===a)return this._getLineBoundingClientRect(c,!0);var f=e._model,g=c.ownerDocument,h=this.lineIndex,m=null;if(a<f.getLineEnd(h)){var n=f.getLineStart(h);this.forEach(function(d){var f=d.firstChild,h=this._nodeLength(d);if(n+h>a){var A=a-n;if(1===f.length)m=new w(d.getBoundingClientRect());
else if(e._isRangeRects)h=g.createRange(),h.setStart(f,A),h.setEnd(f,A+1),m=new w(h.getBoundingClientRect());else if(b.isIE)h=g.body.createTextRange(),h.moveToElementText(d),h.collapse(),(f=0===A&&8===b.isIE)&&(A=1),h.moveEnd("character",A+1),h.moveStart("character",A),m=new w(h.getBoundingClientRect()),f&&(m.left=d.getClientRects()[0].left);else{var p=f.data;d.removeChild(f);d.appendChild(g.createTextNode(p.substring(0,A)));var k=b.createElement(g,"span");k.appendChild(g.createTextNode(p.substring(A,
A+1)));d.appendChild(k);d.appendChild(g.createTextNode(p.substring(A+1)));m=new w(k.getBoundingClientRect());d.innerHTML="";d.appendChild(f);this._createdDiv||(d=e._getSelection(),(n<=d.start&&d.start<n+h||n<=d.end&&d.end<n+h)&&e._updateDOMSelection())}b.isIE&&(A=c.ownerDocument.defaultView||c.ownerDocument.parentWindow,d=A.screen.logicalXDPI/A.screen.deviceXDPI,A=A.screen.logicalYDPI/A.screen.deviceYDPI,m.left*=d,m.right*=d,m.top*=A,m.bottom*=A);return!1}n+=h;return!0})}f=this.getBoundingClientRect();
m||(e._wrapMode?(h=this.getClientRects(),m=h[h.length-1],m.left=m.right,m.left+=f.left,m.top+=f.top,m.right+=f.left,m.bottom+=f.top):(m=new w(f),m.left=m.right));if(d||void 0===d)m.left-=f.left,m.top-=f.top,m.right-=f.left,m.bottom-=f.top;return m},forEach:function(a){for(var b=this._ensureCreated().firstChild;b;){var d=b.nextSibling;if(!b.ignore&&!a.call(this,b))break;b=d}},_getClientRects:function(a,b){var d,c,e,f;if(!a._rectsCache){d=a.getClientRects();c=Array(d.length);for(f=0;f<d.length;f++)e=
c[f]=new w(d[f]),e.left-=b.left,e.top-=b.top,e.right-=b.left,e.bottom-=b.top;a._rectsCache=c}d=a._rectsCache;c=[d.length];for(f=0;f<d.length;f++)c[f]=new w(d[f]);return c},getClientRects:function(a){if(!this.view._wrapMode)return[this.getBoundingClientRect()];var b=[],d=this._ensureCreated().getBoundingClientRect();this.forEach(function(a){a=this._getClientRects(a,d);for(var c=0;c<a.length;c++){var e=a[c],q,f;if(e.top!==e.bottom){var g=e.top+(e.bottom-e.top)/2;for(q=0;q<b.length&&!(f=b[q],f.top<=
g&&g<f.bottom);q++);q===b.length?b.push(e):(e.left<f.left&&(f.left=e.left),e.top<f.top&&(f.top=e.top),e.right>f.right&&(f.right=e.right),e.bottom>f.bottom&&(f.bottom=e.bottom))}}return!0});return void 0!==a?b[a]:b},_getLineBoundingClientRect:function(a,b){var d=new w(a.getBoundingClientRect());if(!this.view._wrapMode){d.right=d.left;for(var c=a.lastChild;c&&c.ignoreChars===c.firstChild.length;)c=c.previousSibling;c&&(c=c.getBoundingClientRect(),d.right=c.right+t(a).right)}b&&(c=t(a),d.left+=c.left,
d.right-=c.right);return d},getLineCount:function(){return!this.view._wrapMode?1:this.getClientRects().length},getLineIndex:function(a){if(!this.view._wrapMode)return 0;var b=this.getClientRects();a=this.getBoundingClientRect(a);a=a.top+(a.bottom-a.top)/2;for(var d=0;d<b.length;d++)if(b[d].top<=a&&a<b[d].bottom)return d;return b.length-1},getLineStart:function(a){if(!this.view._wrapMode||0===a)return this.view._model.getLineStart(this.lineIndex);var b=this.getClientRects();return this.getOffset(b[a].left+
1,b[a].top+1)},_nodeLength:function(a){if(!a||a.ignore)return 0;var b=a.firstChild.length;a.ignoreChars&&(b-=a.ignoreChars);return b},getModelOffset:function(a,b){if(!a)return 0;var d=0;this.forEach(function(c){var e=c.firstChild;if(e===a)return c.ignoreChars&&(d-=c.ignoreChars),d+=b,!1;c.ignoreChars&&(d-=c.ignoreChars);d+=e.data.length;return!0});return Math.max(0,d)+this.view._model.getLineStart(this.lineIndex)},getNodeOffset:function(a){var b=0,d,c,e=this.view._model,f=e.getLineStart(this.lineIndex),
g=a-f,h=e.getLineEnd(this.lineIndex)-f;this.forEach(function(a){var e=a.firstChild,q=this._nodeLength(a);if(q+b>g||b+q>=h)return d=e,c=g-b,a.ignoreChars&&0<q&&c===q&&(c+=a.ignoreChars),!1;b+=q;return!0});return{node:d,offset:c}},getText:function(a){var b="",d=0;this.forEach(function(c){var e;if(c.ignoreChars){e=c.lastChild;for(var f=0,g=[],h=-1;e;){var m=e.data;if(m)for(var n=m.length-1;0<=n;n--){var p=m.substring(n,n+1);f<c.ignoreChars&&(" "===p||"\ufeff"===p)?f++:g.push("\u00a0"===p?"\t":p)}a===
e&&(h=g.length);e=e.previousSibling}g=g.reverse().join("");-1!==h&&(d=b.length+g.length-h);b+=g}else for(e=c.firstChild;e;)a===e&&(d=b.length),b+=e.data,e=e.nextSibling;return!0});return{text:b,offset:d}},getOffset:function(a,d){function c(e,B,n){var C=e.firstChild,l=t._nodeLength(e),r=p.ownerDocument,s=r.defaultView||r.parentWindow,x=b.isIE?s.screen.logicalXDPI/s.screen.deviceXDPI:1,w=b.isIE?s.screen.logicalYDPI/s.screen.deviceYDPI:1,v,z,u,s=n.left+k.left,P,D;if(b.isIE||f._isRangeRects){for(var r=
f._isRangeRects?r.createRange():r.body.createTextRange(),y=l,T=-1;1<y-T;){var J=Math.floor((y+T)/2);n=T+1;v=J===l-1&&e.ignoreChars?C.length:J+1;P=0===n&&8===b.isIE;f._isRangeRects?(r.setStart(C,n),r.setEnd(C,v)):(P&&(n=1),r.moveToElementText(e),r.move("character",n),r.moveEnd("character",v-n));D=r.getClientRects();for(var U=!1,R=0;R<D.length;R++)if(n=D[R],v=(P?s:n.left)*x-k.left,u=n.right*x-k.left,z=n.top*w-k.top,n=n.bottom*w-k.top,v<=a&&a<u&&(!f._wrapMode||z<=d&&d<n)){U=!0;break}U?y=J:T=J}B+=y;n=
y;v=y===l-1&&e.ignoreChars?C.length:Math.min(y+1,C.length);f._isRangeRects?(r.setStart(C,n),r.setEnd(C,v)):(r.moveToElementText(e),r.move("character",n),r.moveEnd("character",v-n));D=r.getClientRects();l=!1;0<D.length&&(n=D[0],v=(P?s:n.left)*x-k.left,u=n.right*x-k.left,l=a>v+(u-v)/2);e=B-m;C=g.getLine(h);x=C.charCodeAt(e);55296<=x&&56319>=x&&l?e<C.length&&(x=C.charCodeAt(e+1),56320<=x&&57343>=x&&(B+=1)):56320<=x&&57343>=x&&!l&&0<e&&(x=C.charCodeAt(e-1),55296<=x&&56319>=x&&(B-=1));l&&B++}else{x=[];
for(P=0;P<l;P++)x.push("\x3cspan\x3e"),P===l-1?x.push(C.data.substring(P)):x.push(C.data.substring(P,P+1)),x.push("\x3c/span\x3e");e.innerHTML=x.join("");for(x=e.firstChild;x;){n=x.getBoundingClientRect();v=n.left-k.left;u=n.right-k.left;if(v<=a&&a<u){a>v+(u-v)/2&&B++;break}B++;x=x.nextSibling}t._createdDiv||(e.innerHTML="",e.appendChild(C),e=f._getSelection(),(B<=e.start&&e.start<B+l||B<=e.end&&e.end<B+l)&&f._updateDOMSelection())}return B}function e(b){if(b.ignore)return null;b=t._getClientRects(b,
k);for(var c=0;c<b.length;c++){var g=b[c];if(g.left<=a&&a<g.right&&(!f._wrapMode||g.top<=d&&d<g.bottom))return g}return null}var f=this.view,g=f._model,h=this.lineIndex,m=g.getLineStart(h),n=g.getLineEnd(h);if(m===n)return m;var p=this._ensureCreated(),k=this.getBoundingClientRect(),t=this,l,r;if(f._wrapMode){l=this.getClientRects();d<l[0].top&&(d=l[0].top);for(var s=0;s<l.length&&!(r=l[s],r.top<=d&&d<r.bottom);s++);a<r.left&&(a=r.left);a>r.right&&(a=r.right-1)}else 0>a&&(a=0),a>k.right-k.left&&(a=
k.right-k.left);var x,w;if(this._lastHitChild&&this._lastHitChild.parentNode){if(x=this._lastHitOffset,w=this._lastHitChild,r=e(w),!r){l=x;for(var s=x+this._nodeLength(w),v=w.previousSibling,z=w.nextSibling;v||z;){if(v){l-=this._nodeLength(v);if(r=e(v)){w=v;x=l;break}v=v.previousSibling}if(z){if(r=e(z)){w=z;x=s;break}s+=this._nodeLength(z);z=z.nextSibling}}}}else x=m,this.forEach(function(a){w=a;if(r=e(w))return!1;x+=this._nodeLength(w);return!0});w&&r&&(this._lastHitChild=w,this._lastHitOffset=x,
x=c(w,x,r));return Math.min(n,Math.max(m,x))},getNextOffset:function(a,d){if("line"===d.unit){var c=this.view._model,e=c.getLineAtOffset(a);if(0<d.count)return d.count--,c.getLineEnd(e);d.count++;return c.getLineStart(e)}return"wordend"===d.unit||"wordWS"===d.unit||"wordendWS"===d.unit?this._getNextOffset_W3C(a,d):b.isIE?this._getNextOffset_IE(a,d):this._getNextOffset_W3C(a,d)},_getNextOffset_W3C:function(a,b){function d(a){return 33<=a&&47>=a||58<=a&&64>=a||91<=a&&94>=a||96===a||123<=a&&126>=a}function c(a){return 32===
a||9===a}var e=this.view._model,f=e.getLineAtOffset(a),g=e.getLine(f),h=e.getLineStart(f),e=e.getLineEnd(f),f=g.length,m=a-h,n,p=0>b.count?-1:1;if("word"===b.unit||"wordend"===b.unit||"wordWS"===b.unit||"wordendWS"===b.unit)for(var k,t,l;0!==b.count;){if(0<b.count){if(m===f)return e;n=g.charCodeAt(m);k=d(n);t=!k&&!c(n);for(m++;m<f;){n=g.charCodeAt(m);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){l=d(n);if("wordend"===b.unit){if(!l&&k)break}else if(l&&!k)break;n=!l&&!c(n)}else n=!c(n);if("wordend"===
b.unit||"wordendWS"===b.unit){if(!n&&t)break}else if(n&&!t)break;t=n;k=l;m++}}else{if(0===m)return h;m--;n=g.charCodeAt(m);k=d(n);for(t=!k&&!c(n);0<m;){n=g.charCodeAt(m-1);if("wordWS"!==b.unit&&"wordendWS"!==b.unit){l=d(n);if("wordend"===b.unit){if(l&&!k)break}else if(!l&&k)break;n=!l&&!c(n)}else n=!c(n);if("wordend"===b.unit||"wordendWS"===b.unit){if(n&&!t)break}else if(!n&&t)break;t=n;k=l;m--}}b.count-=p}else for(;0!==b.count&&0<=m+p&&m+p<=f;)m+=p,n=g.charCodeAt(m),56320<=n&&57343>=n&&0<m&&(n=g.charCodeAt(m-
1),55296<=n&&56319>=n&&(m+=p)),b.count-=p;return h+m},_getNextOffset_IE:function(a,b){var d=this._ensureCreated(),c=this.view._model,e=this.lineIndex,f=0,g;g=c.getLineStart(e);var h=d.ownerDocument,m=0>b.count?-1:1;if(a===c.getLineEnd(e)){for(d=d.lastChild;d&&d.ignoreChars===d.firstChild.length;)d=d.previousSibling;if(!d)return g;f=h.body.createTextRange();f.moveToElementText(d);g=f.text.length;f.moveEnd(b.unit,m);f=a+f.text.length-g}else if(a===g&&0>b.count)f=g;else for(d=d.firstChild;d;){c=this._nodeLength(d);
if(g+c>a){f=h.body.createTextRange();if(a===g&&0>b.count){for(g=d.previousSibling;g&&(!g.firstChild||!g.firstChild.length);)g=g.previousSibling;f.moveToElementText(g?g:d.previousSibling)}else f.moveToElementText(d),f.collapse(),f.moveEnd("character",a-g);g=f.text.length;f.moveEnd(b.unit,m);f=a+f.text.length-g;break}g=c+g;d=d.nextSibling}b.count-=m;return f},updateLinks:function(){var a=this._ensureCreated();if(this.hasLink){var b=this;this.forEach(function(d){var c=d.viewStyle;c&&c.tagName&&"a"===
c.tagName.toLowerCase()&&a.replaceChild(b._createSpan(a,d.firstChild.data,c),d);return!0})}},destroy:function(){var a=this._createdDiv;a&&(a.parentNode.removeChild(a),this._createdDiv=null)}};u.prototype={addKeyMode:function(a,b){var d=this._keyModes;void 0!==b?d.splice(b,0,a):d.push(a);a._modeAdded&&a._modeAdded()},addRuler:function(a,b){a.setView(this);var d=this._rulers;if(void 0!==b){var c,e;for(e=c=0;c<d.length&&e<b;c++)a.getLocation()===d[c].getLocation()&&e++;d.splice(e,0,a);b=e}else d.push(a);
this._createRuler(a,b);this._update()},computeSize:function(){var a=0,d=0,c=this._model,e=this._clientDiv;if(!e)return{width:a,height:d};var f=e.style.width;b.isWebkit&&(e.style.width="0x7fffffffpx");for(var c=c.getLineCount(),g=0;g<c;g++){var h=this._getLine(g),m=h.getBoundingClientRect(),a=Math.max(a,m.right-m.left),d=d+(m.bottom-m.top);h.destroy()}b.isWebkit&&(e.style.width=f);e=this._getViewPadding();a+=e.right+e.left+this._metrics.scrollWidth;d+=e.bottom+e.top+this._metrics.scrollWidth;return{width:a,
height:d}},convert:function(a,b,d){if(this._clientDiv){var c=this._getScroll(),e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect();"document"===b&&(void 0!==a.x&&(a.x+=-c.x+f.left+e.left),void 0!==a.y&&(a.y+=-c.y+f.top+e.top));"document"===d&&(void 0!==a.x&&(a.x+=c.x-f.left-e.left),void 0!==a.y&&(a.y+=c.y-f.top-e.top));return a}},destroy:function(){for(var a=0;a<this._rulers.length;a++)this._rulers[a].setView(null);this.rulers=null;this._destroyView();this.onDestroy({type:"Destroy"});
this._parent=null;this._model&&this._model.destroy&&this._model.destroy();this._actions=this._keyModes=this._doubleClickSelection=this._selection=this._theme=this._model=null},focus:function(){this._clientDiv&&(this._updateDOMSelection(),this._clientDiv.focus(),this._updateDOMSelection())},hasFocus:function(){return this._hasFocus},getActionDescription:function(a){if(a=this._actions[a])return a.actionDescription},getActions:function(a){var b=[],d=this._actions,c;for(c in d)d.hasOwnProperty(c)&&(a||
!d[c].defaultHandler)&&b.push(c);return b},getBottomIndex:function(a){return!this._clientDiv?0:this._getBottomIndex(a)},getBottomPixel:function(){return!this._clientDiv?0:this._getScroll().y+this._getClientHeight()},getCaretOffset:function(){return this._getSelection().getCaret()},getClientArea:function(){if(!this._clientDiv)return{x:0,y:0,width:0,height:0};var a=this._getScroll();return{x:a.x,y:a.y,width:this._getClientWidth(),height:this._getClientHeight()}},getHorizontalPixel:function(){return!this._clientDiv?
0:this._getScroll().x},getKeyBindings:function(a){for(var b=[],d=this._keyModes,c=0;c<d.length;c++)b=b.concat(d[c].getKeyBindings(a));return b},getKeyModes:function(){return this._keyModes.slice(0)},getLineHeight:function(a){return!this._clientDiv?0:this._getLineHeight(a)},getLineIndex:function(a){return!this._clientDiv?0:this._getLineIndex(a)},getLinePixel:function(a){return!this._clientDiv?0:this._getLinePixel(a)},getLocationAtOffset:function(a){if(!this._clientDiv)return{x:0,y:0};var b=this._model;
a=Math.min(Math.max(0,a),b.getCharCount());var b=b.getLineAtOffset(a),d=this._getLine(b);a=d.getBoundingClientRect(a);d.destroy();d=a.left;b=this._getLinePixel(b)+a.top;return{x:d,y:b}},getNextOffset:function(a,b){var d=new s(a,a,!1);this._doMove(b,d);return d.getCaret()},getOptions:function(){var a;if(0===arguments.length)a=this._defaultOptions();else if(1===arguments.length){if(a=arguments[0],"string"===typeof a)return d(this["_"+a])}else{a={};for(var b in arguments)arguments.hasOwnProperty(b)&&
(a[arguments[b]]=void 0)}for(var c in a)a.hasOwnProperty(c)&&(a[c]=d(this["_"+c]));return a},getModel:function(){return this._model},getOffsetAtLocation:function(a,b){if(!this._clientDiv)return 0;var d=this._getLineIndex(b),c=this._getLine(d),d=c.getOffset(a,b-this._getLinePixel(d));c.destroy();return d},getLineAtOffset:function(a){this.getModel().getLineAtOffset(a)},getLineStart:function(a){this.getModel().getLineStart(a)},getRulers:function(){return this._rulers.slice(0)},getSelection:function(){var a=
this._getSelection();return{start:a.start,end:a.end}},getText:function(a,b){return this._model.getText(a,b)},getTopIndex:function(a){return!this._clientDiv?0:this._getTopIndex(a)},getTopPixel:function(){return!this._clientDiv?0:this._getScroll().y},invokeAction:function(a,b,d){if(this._clientDiv){if(a=this._actions[a]){if(!b&&a.handler&&a.handler(d))return!0;if(a.defaultHandler)return"boolean"===typeof a.defaultHandler(d)}return!1}},isDestroyed:function(){return!this._clientDiv},onContextMenu:function(a){return this.dispatchEvent(a)},
onDragStart:function(a){return this.dispatchEvent(a)},onDrag:function(a){return this.dispatchEvent(a)},onDragEnd:function(a){return this.dispatchEvent(a)},onDragEnter:function(a){return this.dispatchEvent(a)},onDragOver:function(a){return this.dispatchEvent(a)},onDragLeave:function(a){return this.dispatchEvent(a)},onDrop:function(a){return this.dispatchEvent(a)},onDestroy:function(a){return this.dispatchEvent(a)},onLineStyle:function(a){return this.dispatchEvent(a)},onKeyDown:function(a){return this.dispatchEvent(a)},
onKeyPress:function(a){return this.dispatchEvent(a)},onKeyUp:function(a){return this.dispatchEvent(a)},onModelChanged:function(a){return this.dispatchEvent(a)},onModelChanging:function(a){return this.dispatchEvent(a)},onModify:function(a){return this.dispatchEvent(a)},onMouseDown:function(a){return this.dispatchEvent(a)},onMouseUp:function(a){return this.dispatchEvent(a)},onMouseMove:function(a){return this.dispatchEvent(a)},onMouseOver:function(a){return this.dispatchEvent(a)},onMouseOut:function(a){return this.dispatchEvent(a)},
onSelection:function(a){return this.dispatchEvent(a)},onScroll:function(a){return this.dispatchEvent(a)},onVerify:function(a){return this.dispatchEvent(a)},onFocus:function(a){return this.dispatchEvent(a)},onBlur:function(a){return this.dispatchEvent(a)},redraw:function(){if(!(0<this._redrawCount)){var a=this._model.getLineCount();this.redrawRulers(0,a);this.redrawLines(0,a)}},redrawRulers:function(a,b){if(!(0<this._redrawCount))for(var d=this.getRulers(),c=0;c<d.length;c++)this.redrawLines(a,b,d[c])},
redrawLines:function(a,b,d){if(!(0<this._redrawCount)&&(void 0===a&&(a=0),void 0===b&&(b=this._model.getLineCount()),a!==b)){var c=this._clientDiv;if(c){if(d)for(c=this._getRulerParent(d).firstChild;c&&c._ruler!==d;)c=c.nextSibling;d?c.rulerChanged=!0:this._lineHeight&&this._resetLineHeight(a,b);if(!d||"page"===d.getOverview())for(c=c.firstChild;c;){var e=c.lineIndex;a<=e&&e<b&&(c.lineChanged=!0);c=c.nextSibling}!d&&!this._wrapMode&&a<=this._maxLineIndex&&this._maxLineIndex<b&&(this._checkMaxLineIndex=
this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._queueUpdate()}}},redrawRange:function(a,b){if(!(0<this._redrawCount)){var d=this._model;void 0===a&&(a=0);void 0===b&&(b=d.getCharCount());var c=d.getLineAtOffset(a),d=d.getLineAtOffset(Math.max(a,b-1))+1;this.redrawLines(c,d)}},removeKeyMode:function(a){for(var b=this._keyModes,d=0;d<b.length;d++)if(b[d]===a){b.splice(d,1);break}a._modeRemoved&&a._modeRemoved()},removeRuler:function(a){for(var b=this._rulers,d=0;d<b.length;d++)if(b[d]===
a){b.splice(d,1);a.setView(null);this._destroyRuler(a);this._update();break}},resize:function(){this._clientDiv&&this._handleResize(null)},setAction:function(a,b,d){if(a){var c=this._actions,e=c[a];e||(e=c[a]={});e.handler=b;void 0!==d&&(e.actionDescription=d)}},setKeyBinding:function(a,b){this._keyModes[0].setKeyBinding(a,b)},setCaretOffset:function(a,b,d){var c=this._model.getCharCount();a=Math.max(0,Math.min(a,c));a=new s(a,a,!1);this._setSelection(a,void 0===b||b,!0,d)},setHorizontalPixel:function(a){this._clientDiv&&
(a=Math.max(0,a),this._scrollView(a-this._getScroll().x,0))},setRedraw:function(a){a?0===--this._redrawCount&&this.redraw():this._redrawCount++},setModel:function(a){if(a&&a!==this._model){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);var b=this._model.getLineCount(),d=this._model.getCharCount(),c=a.getLineCount(),e=a.getCharCount(),f={type:"ModelChanging",text:a.getText(),start:0,removedCharCount:d,
addedCharCount:e,removedLineCount:b,addedLineCount:c};this.onModelChanging(f);this._model=a;f={type:"ModelChanged",start:0,removedCharCount:d,addedCharCount:e,removedLineCount:b,addedLineCount:c};this.onModelChanged(f);this._model.addEventListener("preChanging",this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._reset();this._update()}},setOptions:function(b){var c=this._defaultOptions(),e;for(e in b)if(b.hasOwnProperty(e)){var f=b[e];if(!a(this["_"+
e],f)){var g=c[e]?c[e].update:null;g?g.call(this,f):this["_"+e]=d(f)}}},setSelection:function(a,b,d,c){var e=a>b;if(e){var f=a;a=b;b=f}f=this._model.getCharCount();a=Math.max(0,Math.min(a,f));b=Math.max(0,Math.min(b,f));a=new s(a,b,e);this._setSelection(a,void 0===d||d,!0,c)},setText:function(a,d,c){var e=void 0===d&&void 0===c;void 0===d&&(d=0);void 0===c&&(c=this._model.getCharCount());e&&(this._variableLineHeight=!1);this._modifyContent({text:a,start:d,end:c,_code:!0},!e);e&&(this._columnX=-1,
this._setSelection(new s(0,0,!1),!0),13>b.isFirefox&&this._fixCaret())},setTopIndex:function(a){this._clientDiv&&this._scrollView(0,this._getLinePixel(Math.max(0,a))-this._getScroll().y)},setTopPixel:function(a){this._clientDiv&&this._scrollView(0,Math.max(0,a)-this._getScroll().y)},showSelection:function(){return this._showCaret(!0)},update:function(a,b){this._clientDiv&&((a||this._metrics.invalid)&&this._updateStyle(),void 0===b||b?this._update():this._queueUpdate())},_handleRootMouseDown:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)){13>b.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!1,this._ignoreBlur=(this._overlayDiv||this._clientDiv).draggable=!0);var d=this._overlayDiv||this._clientDiv;9>b.isIE&&(d=this._viewDiv);for(var c=a.target?a.target:a.srcElement;c;){if(d===c)return;c=c.parentNode}a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();if(!this._isW3CEvents){var e=this;this._getWindow().setTimeout(function(){e._clientDiv.focus()},0)}}},_handleRootMouseUp:function(a){!this._ignoreEvent(a)&&
13>b.isFirefox&&1===a.which&&(this._clientDiv.contentEditable=!0,(this._overlayDiv||this._clientDiv).draggable=!1,this._fixCaret(),this._ignoreBlur=!1)},_handleBlur:function(a){this._cancelCheckSelection();if(!this._ignoreBlur){this._hasFocus=!1;if(9>b.isIE&&!this._getSelection().isEmpty()){a=this._rootDiv;var d=b.createElement(a.ownerDocument,"div");a.appendChild(d);a.removeChild(d)}this._cursorDiv&&(this._cursorDiv.style.display="none");if(this._selDiv1)if(this._selDiv1.style.background="lightgray",
this._selDiv2.style.background="lightgray",this._selDiv3.style.background="lightgray",a=this._getWindow(),d=this._selDiv1.ownerDocument,a.getSelection){d=a.getSelection();for(a=d.anchorNode;a;){if(a===this._clientDiv){0<d.rangeCount&&d.removeAllRanges();break}a=a.parentNode}}else if(d.selection){this._ignoreSelect=!1;for(a=d.selection.createRange().parentElement();a;){if(a===this._clientDiv){d.selection.empty();break}a=a.parentNode}this._ignoreSelect=!0}if(!this._ignoreFocus)this.onBlur({type:"Blur"})}},
_handleContextMenu:function(a){if(!this._ignoreEvent(a)){b.isIE&&3===this._lastMouseButton&&this._updateDOMSelection();var d=!1;this.isListening("ContextMenu")?(d=this._createMouseEvent("ContextMenu",a),d.screenX=a.screenX,d.screenY=a.screenY,this.onContextMenu(d),d=d.defaultPrevented):b.isMac&&b.isFirefox&&0===a.button&&(d=!0);if(d)return a.preventDefault&&a.preventDefault(),!1;this._contextMenuOpen=!0;b.isFirefox&&(this._checkSelectionChange=!0,this._pollSelectionChange(!0))}},_handleCopy:function(a){this._cancelCheckSelection();
if(!this._ignoreEvent(a)&&!this._ignoreCopy&&this._doCopy(a))return a.preventDefault&&a.preventDefault(),!1},_handleCut:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&this._doCut(a))return a.preventDefault&&a.preventDefault(),!1},_handleDataModified:function(a){this._ignoreEvent(a)||this._startIME()},_handleDblclick:function(a){this._ignoreEvent(a)||(this._lastMouseTime=a.timeStamp?a.timeStamp:(new Date).getTime(),2!==this._clickCount&&(this._clickCount=2,this._handleMouse(a)))},
_handleDragStart:function(a){if(!this._ignoreEvent(a)){if(13>b.isFirefox){var d=this;this._getWindow().setTimeout(function(){d._clientDiv.contentEditable=!0;d._clientDiv.draggable=!1;d._ignoreBlur=!1},0)}if(this.isListening("DragStart")&&-1!==this._dragOffset)this._isMouseDown=!1,this.onDragStart(this._createMouseEvent("DragStart",a)),this._dragOffset=-1;else return a.preventDefault&&a.preventDefault(),!1}},_handleDrag:function(a){if(!this._ignoreEvent(a)&&this.isListening("Drag"))this.onDrag(this._createMouseEvent("Drag",
a))},_handleDragEnd:function(a){if(!this._ignoreEvent(a)){this._dropTarget=!1;this._dragOffset=-1;if(this.isListening("DragEnd"))this.onDragEnd(this._createMouseEvent("DragEnd",a));13>b.isFirefox&&(this._fixCaret(),"none"===a.dataTransfer.dropEffect&&!a.dataTransfer.mozUserCancelled&&this._fixCaret())}},_handleDragEnter:function(a){if(!this._ignoreEvent(a)){var d=!0;this._dropTarget=!0;this.isListening("DragEnter")&&(d=!1,this.onDragEnter(this._createMouseEvent("DragEnter",a)));if(b.isWebkit||d)return a.preventDefault&&
a.preventDefault(),!1}},_handleDragOver:function(a){if(!this._ignoreEvent(a)){var d=!0;this.isListening("DragOver")&&(d=!1,this.onDragOver(this._createMouseEvent("DragOver",a)));if(b.isWebkit||d)return d&&(a.dataTransfer.dropEffect="none"),a.preventDefault&&a.preventDefault(),!1}},_handleDragLeave:function(a){if(!this._ignoreEvent(a)&&(this._dropTarget=!1,this.isListening("DragLeave")))this.onDragLeave(this._createMouseEvent("DragLeave",a))},_handleDrop:function(a){if(!this._ignoreEvent(a)){this._dropTarget=
!1;if(this.isListening("Drop"))this.onDrop(this._createMouseEvent("Drop",a));a.preventDefault&&a.preventDefault();return!1}},_handleFocus:function(a){this._hasFocus=!0;b.isIOS&&void 0!==this._lastTouchOffset?(this.setCaretOffset(this._lastTouchOffset,!0),this._lastTouchOffset=void 0):this._updateDOMSelection();this._cursorDiv&&(this._cursorDiv.style.display="block");this._selDiv1&&(a=this._highlightRGB,this._selDiv1.style.background=a,this._selDiv2.style.background=a,this._selDiv3.style.background=
a);if(!this._ignoreFocus)this.onFocus({type:"Focus"})},_handleKeyDown:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)){if(this.isListening("KeyDown")){var d=this._createKeyEvent("KeyDown",a);this.onKeyDown(d);if(d.defaultPrevented){b.isFirefox&&(this._keyDownPrevented=!0);a.preventDefault();return}}d=!1;switch(a.keyCode){case 16:case 17:case 18:case 91:d=!0;break;default:this._setLinksVisible(!1)}if(229===a.keyCode){if(this._readonly)return a.preventDefault&&a.preventDefault(),!1;
d=!0;b.isSafari&&b.isMac&&a.ctrlKey&&(d=!1,a.keyCode=129);d&&this._startIME()}else d||this._commitIME();if((b.isMac||b.isLinux)&&4>b.isFirefox||12.16>b.isOpera)return this._keyDownEvent=a,!0;if(this._doAction(a))return a.preventDefault?(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1}},_handleKeyPress:function(a){if(!this._ignoreEvent(a))if(this._keyDownPrevented)a.preventDefault&&(a.preventDefault(),a.stopPropagation()),this._keyDownPrevented=void 0;else{if(b.isMac&&
b.isWebkit&&(63232<=a.keyCode&&63487>=a.keyCode||13===a.keyCode||8===a.keyCode)||((b.isMac||b.isLinux)&&4>b.isFirefox||12.16>b.isOpera)&&this._doAction(this._keyDownEvent))return a.preventDefault&&a.preventDefault(),!1;var d=b.isMac?a.metaKey:a.ctrlKey;if(void 0!==a.charCode&&d)switch(a.charCode){case 99:case 118:case 120:return!0}if(this.isListening("KeyPress")&&(d=this._createKeyEvent("KeyPress",a),this.onKeyPress(d),d.defaultPrevented))a.preventDefault();else{if(this._doAction(a))return a.preventDefault?
(a.preventDefault(),a.stopPropagation()):(a.cancelBubble=!0,a.returnValue=!1,a.keyCode=0),!1;d=!1;if(b.isMac){if(a.ctrlKey||a.metaKey)d=!0}else if(b.isFirefox){if(a.ctrlKey||a.altKey)d=!0}else a.ctrlKey^a.altKey&&(d=!0);if(!d&&(d=b.isOpera?a.which:void 0!==a.charCode?a.charCode:a.keyCode,31<d))return this._doContent(String.fromCharCode(d)),a.preventDefault&&a.preventDefault(),!1}}},_handleDocKeyUp:function(a){(b.isMac?a.metaKey:a.ctrlKey)||this._setLinksVisible(!1)},_handleKeyUp:function(a){if(!this._ignoreEvent(a)){if(this.isListening("KeyUp")){var b=
this._createKeyEvent("KeyUp",a);this.onKeyUp(b);if(b.defaultPrevented){a.preventDefault();return}}this._handleDocKeyUp(a);13===a.keyCode&&this._commitIME()}},_handleLinkClick:function(a){if(!(b.isMac?a.metaKey:a.ctrlKey))return a.preventDefault&&a.preventDefault(),!1},_handleMouse:function(a){var d=this._getWindow(),c=!0,e=d;if(b.isIE||b.isFirefox&&!this._overlayDiv)e=this._clientDiv;if(this._overlayDiv){this._hasFocus&&(this._ignoreFocus=!0);var f=this;d.setTimeout(function(){f.focus();f._ignoreFocus=
!1},0)}1===this._clickCount?(c=this._setSelectionTo(a.clientX,a.clientY,a.shiftKey,(!b.isOpera||12.16<=b.isOpera)&&this._hasFocus&&this.isListening("DragStart")))&&this._setGrab(e):(this._isW3CEvents&&this._setGrab(e),this._doubleClickSelection=null,this._setSelectionTo(a.clientX,a.clientY,a.shiftKey),this._doubleClickSelection=this._getSelection());return c},_handleMouseDown:function(a){if(!this._ignoreEvent(a)){if(this._linksVisible)if("A"!==(a.target||a.srcElement).tagName)this._setLinksVisible(!1);
else return;this._commitIME();var d=a.which;d||(4===a.button&&(d=2),2===a.button&&(d=3),1===a.button&&(d=1));var c=2!==d&&a.timeStamp?a.timeStamp:(new Date).getTime(),e=c-this._lastMouseTime,f=Math.abs(this._lastMouseX-a.clientX),g=Math.abs(this._lastMouseY-a.clientY),h=this._lastMouseButton===d;this._lastMouseX=a.clientX;this._lastMouseY=a.clientY;this._lastMouseTime=c;this._lastMouseButton=d;1===d&&(this._isMouseDown=!0,h&&e<=this._clickTime&&f<=this._clickDist&&g<=this._clickDist?this._clickCount++:
this._clickCount=1);if(this.isListening("MouseDown")&&(c=this._createMouseEvent("MouseDown",a),this.onMouseDown(c),c.defaultPrevented))a.preventDefault();else{if(1===d&&this._handleMouse(a)&&(9<=b.isIE||b.isOpera||b.isChrome||b.isSafari||b.isFirefox&&!this._overlayDiv))this._hasFocus||this.focus(),a.preventDefault();b.isFirefox&&3===this._lastMouseButton&&this._updateDOMSelection()}}},_handleMouseOver:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOver"))this.onMouseOver(this._createMouseEvent("MouseOver",
a))},_handleMouseOut:function(a){if(!this._ignoreEvent(a)&&!this._animation&&this.isListening("MouseOut"))this.onMouseOut(this._createMouseEvent("MouseOut",a))},_handleMouseMove:function(a){if(!this._animation){var d=this._isClientDiv(a);if(this.isListening("MouseMove")&&d)this.onMouseMove(this._createMouseEvent("MouseMove",a));if(!this._dropTarget){var c=this._linksVisible||this._lastMouseMoveX!==a.clientX||this._lastMouseMoveY!==a.clientY;this._lastMouseMoveX=a.clientX;this._lastMouseMoveY=a.clientY;
this._setLinksVisible(c&&!this._isMouseDown&&(b.isMac?a.metaKey:a.ctrlKey));if(!this._isW3CEvents){if(0===a.button)return this._setGrab(null),!0;if(!this._isMouseDown&&1===a.button&&0!==(this._clickCount&1)&&d)return this._clickCount=2,this._handleMouse(a,this._clickCount)}if(this._isMouseDown&&-1===this._dragOffset){d=a.clientX;a=a.clientY;var e=this._getViewPadding(),f=this._viewDiv.getBoundingClientRect(),g=this._getClientWidth(),h=this._getClientHeight(),c=f.left+e.left,m=f.top+e.top,g=f.left+
e.left+g,e=f.top+e.top+h;a<m?this._doAutoScroll("up",d,a-m):a>e?this._doAutoScroll("down",d,a-e):d<c&&!this._wrapMode?this._doAutoScroll("left",d-c,a):d>g&&!this._wrapMode?this._doAutoScroll("right",d-g,a):(this._endAutoScroll(),this._setSelectionTo(d,a,!0))}}}},_isClientDiv:function(a){var b=this._overlayDiv||this._clientDiv;for(a=a.target?a.target:a.srcElement;a;){if(b===a)return!0;a=a.parentNode}return!1},_createKeyEvent:function(a,b){return{type:a,event:b,preventDefault:function(){this.defaultPrevented=
!0}}},_createMouseEvent:function(a,b){var d=this.convert({x:b.clientX,y:b.clientY},"page","document");return{type:a,event:b,clickCount:this._clickCount,x:d.x,y:d.y,preventDefault:function(){this.defaultPrevented=!0}}},_handleMouseUp:function(a){var d=a.which?0===a.button:1===a.button;if(this.isListening("MouseUp")&&(this._isClientDiv(a)||d&&this._isMouseDown))this.onMouseUp(this._createMouseEvent("MouseUp",a));if(!this._linksVisible){if(d&&this._isMouseDown){if(-1!==this._dragOffset){var c=this._getSelection();
c.extend(this._dragOffset);c.collapse();this._setSelection(c,!0,!0);this._dragOffset=-1}this._isMouseDown=!1;this._endAutoScroll();this._isW3CEvents&&this._setGrab(null)}d&&b.isFirefox&&(this._updateDOMSelection(),a.preventDefault())}},_handleMouseWheel:function(a){var d=this._getLineHeight(),c=0,e=0;b.isIE||b.isOpera?e=-a.wheelDelta/40*d:b.isFirefox?"wheel"===a.type?a.deltaMode?(c=Math.max(-256,Math.min(256,a.deltaX))*d,e=Math.max(-256,Math.min(256,a.deltaY))*d):(c=a.deltaX,e=a.deltaY):(d=b.isMac?
3*a.detail:Math.max(-256,Math.min(256,a.detail))*d,a.axis===a.HORIZONTAL_AXIS?c=d:e=d):b.isMac?(e=a.timeStamp-this._wheelTimeStamp,this._wheelTimeStamp=a.timeStamp,c=0!==a.wheelDeltaX%120?1:40>e?40/(40-e):40,e=0!==a.wheelDeltaY%120?1:40>e?40/(40-e):40,c=Math.ceil(-a.wheelDeltaX/c),-1<c&&0>c&&(c=-1),0<c&&1>c&&(c=1),e=Math.ceil(-a.wheelDeltaY/e),-1<e&&0>e&&(e=-1),0<e&&1>e&&(e=1)):(c=-a.wheelDeltaX,e=8*(-a.wheelDeltaY/120)*d);if(b.isSafari||b.isChrome&&b.isMac){for(d=a.target;d&&void 0===d.lineIndex;)d=
d.parentNode;this._mouseWheelLine=d}d=this._getScroll();this._scrollView(c,e);c=this._getScroll();if(d.x!==c.x||d.y!==c.y)return a.preventDefault&&a.preventDefault(),!1},_handlePaste:function(a){this._cancelCheckSelection();if(!this._ignoreEvent(a)&&!this._ignorePaste&&this._doPaste(a)){if(b.isIE){var d=this;this._ignoreFocus=!0;this._getWindow().setTimeout(function(){d._updateDOMSelection();d._ignoreFocus=!1},0)}a.preventDefault&&a.preventDefault();return!1}},_handleResize:function(d){d=this._rootDiv.clientWidth;
var c=this._rootDiv.clientHeight;if(this._rootWidth!==d||this._rootHeight!==c)this._rootWidth!==d&&this._wrapMode&&this._resetLineHeight(),this._rootWidth=d,this._rootHeight=c,d=9>b.isIE,c=this._calculateMetrics(),a(c,this._metrics)||(this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight()),this._metrics=c,d=!0),d?this._queueUpdate():this._update()},_handleRulerEvent:function(a){for(var b=a.target?a.target:a.srcElement,d=b.lineIndex;b&&!b._ruler;)void 0===d&&void 0!==b.lineIndex&&
(d=b.lineIndex),b=b.parentNode;var c=b?b._ruler:null;if(void 0===d&&c&&"document"===c.getOverview()){var d=this._getClientHeight(),e=this._model.getLineCount(),f=this._getViewPadding(),g=this._viewDiv.getBoundingClientRect(),d=Math.floor((a.clientY-g.top-this._metrics.scrollWidth)*e/(d+f.top+f.bottom-2*this._metrics.scrollWidth));0<=d&&d<e||(d=void 0)}if(c)switch(a.type){case "click":if(c.onClick)c.onClick(d,a);break;case "dblclick":if(c.onDblClick)c.onDblClick(d,a);break;case "mousemove":if(c.onMouseMove)c.onMouseMove(d,
a);break;case "mouseover":if(c.onMouseOver)c.onMouseOver(d,a);break;case "mouseout":if(c.onMouseOut){for(e=a.relatedTarget;e&&e!==this._rootDiv;){if(e===b)return;e=e.parentNode}c.onMouseOut(d,a)}}},_handleScroll:function(){var a=this._getScroll(!1),b=this._hScroll,d=this._vScroll;if(b!==a.x||d!==a.y)this._hScroll=a.x,this._vScroll=a.y,this._commitIME(),this._update(d===a.y),this.onScroll({type:"Scroll",oldValue:{x:b,y:d},newValue:a})},_handleSelectStart:function(a){var b=this._contextMenuOpen;this._contextMenuOpen=
!1;if(b)this._checkSelectionChange=!0;else if(this._ignoreSelect)return a&&a.preventDefault&&a.preventDefault(),!1},_getModelOffset:function(a,b){if(a){var d;d="DIV"===a.tagName?a:a.parentNode.parentNode;return!d._line?0:d._line.getModelOffset(a,b)}},_updateSelectionFromDOM:function(){if(!b.isOS&&!b.isAndroid&&!this._checkSelectionChange)return!1;var a=this._getWindow().getSelection(),d=this._getModelOffset(a.anchorNode,a.anchorOffset),c=this._getModelOffset(a.focusNode,a.focusOffset),e=this._getSelection();
if(void 0===d||void 0===c||e.start===d&&e.end===c)return!1;if(this._checkSelectionChange){var e=this._getLineNext(),f=this._getLinePrevious();if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.firstChild.firstChild&&0===a.focusOffset)return!1;if(a.anchorNode===e.firstChild.firstChild&&0===a.anchorOffset&&a.focusNode===f.lastChild.firstChild||a.anchorNode===this._clientDiv&&a.focusNode===this._clientDiv)d=0,c=this.getModel().getCharCount()}this._setSelection(new s(d,c),
!1,!1);this._checkSelectionChange=!1;return!0},_cancelCheckSelection:function(){this._checkSelectionChange&&(this._checkSelectionChange=!1,this._cancelPollSelectionChange())},_cancelPollSelectionChange:function(){this._selPollTimer&&(this._getWindow().clearTimeout(this._selPollTimer),this._selPollTimer=null)},_pollSelectionChange:function(a){var b=this,d=this._getWindow();this._cancelPollSelectionChange();this._selPollTimer=d.setTimeout(function(){b._selPollTimer=null;b._clientDiv&&!b._updateSelectionFromDOM()&&
a&&b._pollSelectionChange(a)},100)},_handleSelectionChange:function(a){-1===this._imeOffset&&(b.isAndroid?this._pollSelectionChange():this._updateSelectionFromDOM())},_handleTextInput:function(a){if(!this._ignoreEvent(a)){this._imeOffset=-1;var b=this._getWindow().getSelection();if(b.anchorNode!==this._anchorNode||b.focusNode!==this._focusNode||b.anchorOffset!==this._anchorOffset||b.focusOffset!==this._focusOffset){for(var d=b.anchorNode;d&&void 0===d.lineIndex;)d=d.parentNode;if(d){var c=this._model,
e=d.lineIndex,f=c.getLine(e),g=f,h=0,c=c.getLineStart(e);0<b.rangeCount&&(b.getRangeAt(0).deleteContents(),e=d.ownerDocument.createTextNode(a.data),b.getRangeAt(0).insertNode(e),h=this._getDOMText(d,e),g=h.text,h=h.offset,e.parentNode.removeChild(e));d.lineRemoved=!0;for(d=0;f.charCodeAt(d)===g.charCodeAt(d)&&d<h;)d++;b=f.length-1;for(e=g.length-f.length;f.charCodeAt(b)===g.charCodeAt(b+e)&&b+e>=h+a.data.length;)b--;b++;f=g.substring(d,b+e);this._modifyContent({text:f,start:d+c,end:b+c,_ignoreDOMSelection:!0},
!0)}}else this._doContent(a.data);a.preventDefault()}},_handleTouchStart:function(a){this._commitIME();var d=this._getWindow();this._touchScrollTimer&&(this._vScrollDiv.style.display="none",this._hScrollDiv.style.display="none",d.clearInterval(this._touchScrollTimer),this._touchScrollTimer=null);var c=a.touches;if(1===c.length){var c=c[0],e=c.clientX,f=c.clientY;this._touchStartX=e;this._touchStartY=f;if(b.isAndroid&&(f<c.pageY-d.pageYOffset||e<c.pageX-d.pageXOffset))e=c.pageX-d.pageXOffset,f=c.pageY-
d.pageYOffset;d=this.convert({x:e,y:f},"page","document");this._lastTouchOffset=this.getOffsetAtLocation(d.x,d.y);this._touchStartTime=a.timeStamp;this._touching=!0}},_handleTouchMove:function(a){var b=a.touches;if(1===b.length){b=b[0];this._touchCurrentX=b.clientX;this._touchCurrentY=b.clientY;if(!this._touchScrollTimer&&200>a.timeStamp-this._touchStartTime){this._vScrollDiv.style.display="block";this._wrapMode||(this._hScrollDiv.style.display="block");var d=this,c=this._getWindow();this._touchScrollTimer=
c.setInterval(function(){var a=0,b=0;if(d._touching)a=d._touchStartX-d._touchCurrentX,b=d._touchStartY-d._touchCurrentY,d._touchSpeedX=a/10,d._touchSpeedY=b/10,d._touchStartX=d._touchCurrentX,d._touchStartY=d._touchCurrentY;else{if(0.1>Math.abs(d._touchSpeedX)&&0.1>Math.abs(d._touchSpeedY)){d._vScrollDiv.style.display="none";d._hScrollDiv.style.display="none";c.clearInterval(d._touchScrollTimer);d._touchScrollTimer=null;return}a=10*d._touchSpeedX;b=10*d._touchSpeedY;d._touchSpeedX*=0.95;d._touchSpeedY*=
0.95}d._scrollView(a,b)},10)}this._touchScrollTimer&&a.preventDefault()}},_handleTouchEnd:function(a){0===a.touches.length&&(this._touching=!1)},_doAction:function(a){var b,d,c=this._keyModes;for(d=c.length-1;0<=d;d--)if(b=c[d],"function"===typeof b.match&&(b=b.match(a),void 0!==b))return this.invokeAction(b);return!1},_doMove:function(a,b){var d=this._model,c=b.getCaret(),e=d.getLineAtOffset(c);for(a.count||(a.count=1);0!==a.count;){var f=d.getLineStart(e);if(0>a.count&&c===f)if(0<e)"character"===
a.unit&&a.count++,e--,b.extend(d.getLineEnd(e));else break;else if(0<a.count&&c===d.getLineEnd(e))if(e+1<d.getLineCount())"character"===a.unit&&a.count--,e++,b.extend(d.getLineStart(e));else break;else{var g=!1;a.expandTab&&"character"===a.unit&&0===(c-f)%this._tabSize&&(f=d.getText(f,c),g=!/[^ ]/.test(f));g?(b.extend(c-this._tabSize),a.count+=0>a.count?1:-1):(f=this._getLine(e),b.extend(f.getNextOffset(c,a)),f.destroy())}c=b.getCaret()}return b},_doBackspace:function(a){var b=this._getSelection();
b.isEmpty()&&(a.count||(a.count=1),a.count*=-1,a.expandTab=this._expandTab,this._doMove(a,b));this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doCase:function(a){var b=this._getSelection();this._doMove(a,b);var d=this.getText(b.start,b.end);this._setSelection(b,!0);switch(a.type){case "lower":d=d.toLowerCase();break;case "capitalize":d=d.replace(/(?:^|\s)\S/g,function(a){return a.toUpperCase()});break;case "reverse":a="";for(b=0;b<d.length;b++){var c=d[b],e=c.toLowerCase(),c=e!==
c?e:c.toUpperCase();a+=c}d=a;break;default:d=d.toUpperCase()}this._doContent(d);return!0},_doContent:function(a){var b=this._getSelection();if(this._overwriteMode&&b.isEmpty()){var d=this._model,c=d.getLineAtOffset(b.end);b.end<d.getLineEnd(c)&&(d=this._getLine(c),b.extend(d.getNextOffset(b.getCaret(),{unit:"character",count:1})),d.destroy())}this._modifyContent({text:a,start:b.start,end:b.end,_ignoreDOMSelection:!0},!0)},_doCopy:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._setClipboardText(b,a)):!0},_doCursorNext:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.start=b.end:this._doMove(a,b);a.select||b.collapse();this._setSelection(b,!0);return!0},_doCursorPrevious:function(a){var b=this._getSelection();!b.isEmpty()&&!a.select?b.end=b.start:(a.count||(a.count=1),a.count*=-1,this._doMove(a,b));a.select||b.collapse();this._setSelection(b,!0);return!0},_doCut:function(a){var b=this._getSelection();return!b.isEmpty()?(b=this._getBaseText(b.start,
b.end),this._doContent(""),this._setClipboardText(b,a)):!0},_doDelete:function(a){var b=this._getSelection();b.isEmpty()&&this._doMove(a,b);this._modifyContent({text:"",start:b.start,end:b.end},!0);return!0},_doEnd:function(a){var b=this._getSelection(),d=this._model,c;if(a.ctrl)b.extend(d.getCharCount()),c=function(){};else{var e=b.getCaret(),f=d.getLineAtOffset(e);if(this._wrapMode){var g=this._getLine(f),e=g.getLineIndex(e),e=e===g.getLineCount()-1?d.getLineEnd(f):g.getLineStart(e+1)-1;g.destroy()}else a.count&&
0<a.count&&(f=Math.min(f+a.count-1,d.getLineCount()-1)),e=d.getLineEnd(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,c);return!0},_doEnter:function(a){var b=this._model,d=this._getSelection();this._doContent(b.getLineDelimiter());a&&a.noCursor&&(d.end=d.start,this._setSelection(d,!0));return!0},_doHome:function(a){var b=this._getSelection(),d=this._model,c;if(a.ctrl)b.extend(0),c=function(){};else{var e=b.getCaret(),f=d.getLineAtOffset(e);this._wrapMode?(d=this._getLine(f),e=d.getLineIndex(e),
e=d.getLineStart(e),d.destroy()):e=d.getLineStart(f);b.extend(e)}a.select||b.collapse();this._setSelection(b,!0,!0,c);return!0},_doLineDown:function(a){var d=this._model,c=this._getSelection(),e=c.getCaret(),f=d.getLineAtOffset(e),g=this._getLine(f),h=this._columnX,m=1,n=!1;if(-1===h||a.wholeLine||a.select&&b.isIE)h=a.wholeLine?d.getLineEnd(f+1):e,h=g.getBoundingClientRect(h).left;(e=g.getLineIndex(e))<g.getLineCount()-1?m=g.getClientRects(e+1).top+1:(e=d.getLineCount()-1,n=f===e,a.count&&0<a.count?
f=Math.min(f+a.count,e):f++);e=!1;if(n){if(a.select||b.isMac||b.isLinux)c.extend(d.getCharCount()),e=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),c.extend(g.getOffset(h,m)),e=!0;e&&(a.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=h;g.destroy();return!0},_doLineUp:function(a){var d=this._model,c=this._getSelection(),e=c.getCaret(),f=d.getLineAtOffset(e),g=this._getLine(f),h=this._columnX,m=!1,n;if(-1===h||a.wholeLine||a.select&&b.isIE)h=a.wholeLine?d.getLineStart(f-1):
e,h=g.getBoundingClientRect(h).left;0<(e=g.getLineIndex(e))?n=g.getClientRects(e-1).top+1:(m=0===f,m||(a.count&&0<a.count?f=Math.max(f-a.count,0):f--,n=this._getLineHeight(f)-1));e=!1;if(m){if(a.select||b.isMac||b.isLinux)c.extend(0),e=!0}else g.lineIndex!==f&&(g.destroy(),g=this._getLine(f)),c.extend(g.getOffset(h,n)),e=!0;e&&(a.select||c.collapse(),this._setSelection(c,!0,!0));this._columnX=h;g.destroy();return!0},_doNoop:function(){return!0},_doPageDown:function(a){var d=this,c=this._model,e=this._getSelection(),
f=e.getCaret(),g=c.getLineAtOffset(f),h=c.getLineCount(),m=this._getScroll(),c=this._getClientHeight(),n,p;if(this._lineHeight){n=this._columnX;m=this._getBoundsAtOffset(f);if(-1===n||a.select&&b.isIE)n=m.left;f=this._getLineIndex(m.top+c);p=this._getLine(f);g=this._getLinePixel(f);f=p.getOffset(n,m.top+c-g);c=p.getBoundingClientRect(f);p.destroy();e.extend(f);a.select||e.collapse();this._setSelection(e,!0,!0,function(){d._columnX=n},c.top+g-m.top);return!0}if(g<h-1){var k=this._getLineHeight(),t=
Math.min(h-g-1,Math.floor(c/k)),t=Math.max(1,t);n=this._columnX;if(-1===n||a.select&&b.isIE)p=this._getLine(g),n=p.getBoundingClientRect(f).left,p.destroy();p=this._getLine(g+t);e.extend(p.getOffset(n,0));p.destroy();a.select||e.collapse();a=h*k;f=m.y+t*k;f+c>a&&(f=a-c);this._setSelection(e,!0,!0,function(){d._columnX=n},f-m.y)}return!0},_doPageUp:function(a){var d=this,c=this._model,e=this._getSelection(),f=e.getCaret(),g=c.getLineAtOffset(f),h=this._getScroll(),m=this._getClientHeight(),n;if(this._lineHeight){n=
this._columnX;h=this._getBoundsAtOffset(f);if(-1===n||a.select&&b.isIE)n=h.left;f=this._getLineIndex(h.bottom-m);c=this._getLine(f);g=this._getLinePixel(f);f=c.getOffset(n,h.bottom-m-g);m=c.getBoundingClientRect(f);c.destroy();e.extend(f);a.select||e.collapse();this._setSelection(e,!0,!0,function(){d._columnX=n},m.top+g-h.top);return!0}if(0<g){var p=this._getLineHeight(),m=Math.max(1,Math.min(g,Math.floor(m/p)));n=this._columnX;if(-1===n||a.select&&b.isIE)c=this._getLine(g),n=c.getBoundingClientRect(f).left,
c.destroy();c=this._getLine(g-m);e.extend(c.getOffset(n,this._getLineHeight(g-m)-1));c.destroy();a.select||e.collapse();a=Math.max(0,h.y-m*p);this._setSelection(e,!0,!0,function(){d._columnX=n},a-h.y)}return!0},_doPaste:function(a){var d=this;return null!==this._getClipboardText(a,function(a){a&&(b.isLinux&&2===d._lastMouseButton&&(new Date).getTime()-d._lastMouseTime<=d._clickTime&&d._setSelectionTo(d._lastMouseX,d._lastMouseY),d._doContent(a))})},_doScroll:function(a){var b=a.type,d=this._model,
c=d.getLineCount();a=this._getClientHeight();var e=this._getLineHeight(),c=c*e,f=this._getScroll().y,g;switch(b){case "textStart":g=0;break;case "textEnd":g=c-a;break;case "pageDown":g=f+a;break;case "pageUp":g=f-a;break;case "lineDown":g=f+e;break;case "lineUp":g=f-e;break;case "centerLine":b=this._getSelection(),g=d.getLineAtOffset(b.start),d=(d.getLineAtOffset(b.end)-g+1)*e,g=g*e-a/2+d/2}void 0!==g&&(g=Math.min(Math.max(0,g),c-a),this._scrollViewAnimated(0,g-f,function(){}));return!0},_doSelectAll:function(a){a=
this._model;var b=this._getSelection();b.setCaret(0);b.extend(a.getCharCount());this._setSelection(b,!1);return!0},_doTab:function(a){if(this._tabMode&&!this._readonly){a="\t";if(this._expandTab){var b=this._model;a=this._getSelection().getCaret();var d=b.getLineAtOffset(a),b=b.getLineStart(d);a=Array(this._tabSize-(a-b)%this._tabSize+1).join(" ")}this._doContent(a);return!0}},_doShiftTab:function(a){if(this._tabMode&&!this._readonly)return!0},_doOverwriteMode:function(a){if(!this._readonly)return this.setOptions({overwriteMode:!this.getOptions("overwriteMode")}),
!0},_doTabMode:function(a){this._tabMode=!this._tabMode;return!0},_doWrapMode:function(a){this.setOptions({wrapMode:!this.getOptions("wrapMode")});return!0},_autoScroll:function(){var a=this._model,d=this._getSelection(),c=this.convert({x:this._autoScrollX,y:this._autoScrollY},"page","document"),e=d.getCaret(),f=a.getLineCount(),g=a.getLineAtOffset(e),h;if("up"===this._autoScrollDir||"down"===this._autoScrollDir)e=this._autoScrollY/this._getLineHeight(),e=0>e?Math.floor(e):Math.ceil(e),h=Math.max(0,
Math.min(f-1,g+e));else if("left"===this._autoScrollDir||"right"===this._autoScrollDir)h=this._getLineIndex(c.y),g=this._getLine(g),c.x+=g.getBoundingClientRect(e,!1).left,g.destroy();0===h&&(b.isMac||b.isLinux)?d.extend(0):h===f-1&&(b.isMac||b.isLinux)?d.extend(a.getCharCount()):(g=this._getLine(h),d.extend(g.getOffset(c.x,c.y-this._getLinePixel(h))),g.destroy());this._setSelection(d,!0)},_autoScrollTimer:function(){this._autoScroll();var a=this;this._autoScrollTimerID=this._getWindow().setTimeout(function(){a._autoScrollTimer()},
this._AUTO_SCROLL_RATE)},_calculateLineHeightTimer:function(a){if(this._lineHeight&&!this._calculateLHTimer){var b=this._model.getLineCount(),d=0;if(a){a=0;for(var c=(new Date).getTime(),e=0;d<b&&!(this._lineHeight[d]||(a++,e||(e=d),this._lineHeight[d]=this._calculateLineHeight(d)),d++,100<(new Date).getTime()-c););this.redrawRulers(0,b);this._queueUpdate()}a=this._getWindow();if(d!==b){var f=this;this._calculateLHTimer=a.setTimeout(function(){f._calculateLHTimer=null;f._calculateLineHeightTimer(!0)},
0)}else this._calculateLHTimer&&(a.clearTimeout(this._calculateLHTimer),this._calculateLHTimer=void 0)}},_calculateLineHeight:function(a){a=this._getLine(a);var b=a.getBoundingClientRect();a.destroy();return Math.max(1,b.bottom-b.top)},_calculateMetrics:function(){var a=this._clientDiv,d=a.ownerDocument,c=b.createElement(d,"div");c.style.lineHeight="normal";var e={type:"LineStyle",textView:this,0:0,lineText:this._model.getLine(0),lineStart:0};this.onLineStyle(e);f(e.style,c);c.style.position="fixed";
c.style.left="-1000px";var g=b.createElement(d,"span");g.appendChild(d.createTextNode(" "));c.appendChild(g);var h=b.createElement(d,"span");h.style.fontStyle="italic";h.appendChild(d.createTextNode(" "));c.appendChild(h);var m=b.createElement(d,"span");m.style.fontWeight="bold";m.appendChild(d.createTextNode(" "));c.appendChild(m);e=b.createElement(d,"span");e.style.fontWeight="bold";e.style.fontStyle="italic";e.appendChild(d.createTextNode(" "));c.appendChild(e);a.appendChild(c);var n=c.getBoundingClientRect(),
g=g.getBoundingClientRect(),h=h.getBoundingClientRect(),m=m.getBoundingClientRect(),e=e.getBoundingClientRect(),g=g.bottom-g.top,h=h.bottom-h.top,m=m.bottom-m.top,k=e.bottom-e.top,l=0,e=0>=n.bottom-n.top,n=Math.max(1,n.bottom-n.top);h>g&&(l=1);m>h&&(l=2);k>m&&(l=3);var r;0!==l&&(r={style:{}},0!==(l&1)&&(r.style.fontStyle="italic"),0!==(l&2)&&(r.style.fontWeight="bold"));g=t(c);a.removeChild(c);k=p(this._viewDiv);c=b.createElement(d,"div");c.style.position="fixed";c.style.left="-1000px";c.style.paddingLeft=
k.left+"px";c.style.paddingTop=k.top+"px";c.style.paddingRight=k.right+"px";c.style.paddingBottom=k.bottom+"px";c.style.width="100px";c.style.height="100px";k=b.createElement(d,"div");k.style.width="100%";k.style.height="100%";c.appendChild(k);a.appendChild(c);l=c.getBoundingClientRect();h=k.getBoundingClientRect();m=0;this._singleMode||(c.style.overflow="hidden",k.style.height="200px",m=c.clientWidth,c.style.overflow="scroll",m-=c.clientWidth);a.removeChild(c);k={left:h.left-l.left,top:h.top-l.top,
right:l.right-h.right,bottom:l.bottom-h.bottom};h=l=0;if(!e&&(this._wrapOffset||this._marginOffset))c=b.createElement(d,"div"),c.style.position="fixed",c.style.left="-1000px",c.innerHTML=Array(this._wrapOffset+1+(b.isWebkit?0:1)).join(" "),a.appendChild(c),l=c.getBoundingClientRect(),l=Math.ceil(l.right-l.left),c.innerHTML=Array(this._marginOffset+1).join(" "),h=c.getBoundingClientRect(),h=Math.ceil(h.right-h.left),a.removeChild(c);return{lineHeight:n,largestFontStyle:r,lineTrim:g,viewPadding:k,scrollWidth:m,
wrapWidth:l,marginWidth:h,invalid:e}},_cancelAnimation:function(){this._animation&&(this._animation.stop(),this._animation=null)},_clearSelection:function(a){var b=this._getSelection();if(b.isEmpty())return!1;"next"===a?b.start=b.end:b.end=b.start;this._setSelection(b,!0);return!0},_commitIME:function(){if(-1!==this._imeOffset){this._scrollDiv.focus();this._clientDiv.focus();var a=this._model,b=a.getLineAtOffset(this._imeOffset),d=a.getLineStart(b),c=this._getDOMText(this._getLineNode(b)).text,a=
a.getLine(b),d=this._imeOffset-d,a=d+c.length-a.length;d!==a&&(c=c.substring(d,a),this._doContent(c));this._imeOffset=-1}},_createActions:function(){this.addKeyMode(new k.DefaultKeyMode(this));var a=this;this._actions={noop:{defaultHandler:function(){return a._doNoop()}},lineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!1}))},actionDescription:{name:g.lineUp}},lineDown:{defaultHandler:function(b){return a._doLineDown(m(b,{select:!1}))},actionDescription:{name:g.lineDown}},lineStart:{defaultHandler:function(b){return a._doHome(m(b,
{select:!1,ctrl:!1}))},actionDescription:{name:g.lineStart}},lineEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!1,ctrl:!1}))},actionDescription:{name:g.lineEnd}},charPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!1,unit:"character"}))},actionDescription:{name:g.charPrevious}},charNext:{defaultHandler:function(b){return a._doCursorNext(m(b,{select:!1,unit:"character"}))},actionDescription:{name:g.charNext}},pageUp:{defaultHandler:function(b){return a._doPageUp(m(b,
{select:!1}))},actionDescription:{name:g.pageUp}},pageDown:{defaultHandler:function(b){return a._doPageDown(m(b,{select:!1}))},actionDescription:{name:g.pageDown}},scrollPageUp:{defaultHandler:function(b){return a._doScroll(m(b,{type:"pageUp"}))},actionDescription:{name:g.scrollPageUp}},scrollPageDown:{defaultHandler:function(b){return a._doScroll(m(b,{type:"pageDown"}))},actionDescription:{name:g.scrollPageDown}},scrollLineUp:{defaultHandler:function(b){return a._doScroll(m(b,{type:"lineUp"}))},
actionDescription:{name:g.scrollLineUp}},scrollLineDown:{defaultHandler:function(b){return a._doScroll(m(b,{type:"lineDown"}))},actionDescription:{name:g.scrollLineDown}},wordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!1,unit:"word"}))},actionDescription:{name:g.wordPrevious}},wordNext:{defaultHandler:function(b){return a._doCursorNext(m(b,{select:!1,unit:"word"}))},actionDescription:{name:g.wordNext}},textStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!1,
ctrl:!0}))},actionDescription:{name:g.textStart}},textEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!1,ctrl:!0}))},actionDescription:{name:g.textEnd}},scrollTextStart:{defaultHandler:function(b){return a._doScroll(m(b,{type:"textStart"}))},actionDescription:{name:g.scrollTextStart}},scrollTextEnd:{defaultHandler:function(b){return a._doScroll(m(b,{type:"textEnd"}))},actionDescription:{name:g.scrollTextEnd}},centerLine:{defaultHandler:function(b){return a._doScroll(m(b,{type:"centerLine"}))},
actionDescription:{name:g.centerLine}},selectLineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!0}))},actionDescription:{name:g.selectLineUp}},selectLineDown:{defaultHandler:function(b){return a._doLineDown(m(b,{select:!0}))},actionDescription:{name:g.selectLineDown}},selectWholeLineUp:{defaultHandler:function(b){return a._doLineUp(m(b,{select:!0,wholeLine:!0}))},actionDescription:{name:g.selectWholeLineUp}},selectWholeLineDown:{defaultHandler:function(b){return a._doLineDown(m(b,
{select:!0,wholeLine:!0}))},actionDescription:{name:g.selectWholeLineDown}},selectLineStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!0,ctrl:!1}))},actionDescription:{name:g.selectLineStart}},selectLineEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!0,ctrl:!1}))},actionDescription:{name:g.selectLineEnd}},selectCharPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!0,unit:"character"}))},actionDescription:{name:g.selectCharPrevious}},selectCharNext:{defaultHandler:function(b){return a._doCursorNext(m(b,
{select:!0,unit:"character"}))},actionDescription:{name:g.selectCharNext}},selectPageUp:{defaultHandler:function(b){return a._doPageUp(m(b,{select:!0}))},actionDescription:{name:g.selectPageUp}},selectPageDown:{defaultHandler:function(b){return a._doPageDown(m(b,{select:!0}))},actionDescription:{name:g.selectPageDown}},selectWordPrevious:{defaultHandler:function(b){return a._doCursorPrevious(m(b,{select:!0,unit:"word"}))},actionDescription:{name:g.selectWordPrevious}},selectWordNext:{defaultHandler:function(b){return a._doCursorNext(m(b,
{select:!0,unit:"word"}))},actionDescription:{name:g.selectWordNext}},selectTextStart:{defaultHandler:function(b){return a._doHome(m(b,{select:!0,ctrl:!0}))},actionDescription:{name:g.selectTextStart}},selectTextEnd:{defaultHandler:function(b){return a._doEnd(m(b,{select:!0,ctrl:!0}))},actionDescription:{name:g.selectTextEnd}},deletePrevious:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"character"}))},actionDescription:{name:g.deletePrevious}},deleteNext:{defaultHandler:function(b){return a._doDelete(m(b,
{unit:"character"}))},actionDescription:{name:g.deleteNext}},deleteWordPrevious:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"word"}))},actionDescription:{name:g.deleteWordPrevious}},deleteWordNext:{defaultHandler:function(b){return a._doDelete(m(b,{unit:"word"}))},actionDescription:{name:g.deleteWordNext}},deleteLineStart:{defaultHandler:function(b){return a._doBackspace(m(b,{unit:"line"}))},actionDescription:{name:g.deleteLineStart}},deleteLineEnd:{defaultHandler:function(b){return a._doDelete(m(b,
{unit:"line"}))},actionDescription:{name:g.deleteLineEnd}},tab:{defaultHandler:function(b){return a._doTab()},actionDescription:{name:g.tab}},shiftTab:{defaultHandler:function(b){return a._doShiftTab()},actionDescription:{name:g.shiftTab}},enter:{defaultHandler:function(b){return a._doEnter()},actionDescription:{name:g.enter}},enterNoCursor:{defaultHandler:function(b){return a._doEnter(m(b,{noCursor:!0}))},actionDescription:{name:g.enterNoCursor}},selectAll:{defaultHandler:function(b){return a._doSelectAll()},
actionDescription:{name:g.selectAll}},copy:{defaultHandler:function(b){return a._doCopy()},actionDescription:{name:g.copy}},cut:{defaultHandler:function(b){return a._doCut()},actionDescription:{name:g.cut}},paste:{defaultHandler:function(b){return a._doPaste()},actionDescription:{name:g.paste}},uppercase:{defaultHandler:function(b){return a._doCase(m(b,{type:"upper"}))},actionDescription:{name:g.uppercase}},lowercase:{defaultHandler:function(b){return a._doCase(m(b,{type:"lower"}))},actionDescription:{name:g.lowercase}},
capitalize:{defaultHandler:function(b){return a._doCase(m(b,{unit:"word",type:"capitalize"}))},actionDescription:{name:g.capitalize}},reversecase:{defaultHandler:function(b){return a._doCase(m(b,{type:"reverse"}))},actionDescription:{name:g.reversecase}},toggleOverwriteMode:{defaultHandler:function(b){return a._doOverwriteMode()},actionDescription:{name:g.toggleOverwriteMode}},toggleTabMode:{defaultHandler:function(b){return a._doTabMode()},actionDescription:{name:g.toggleTabMode}},toggleWrapMode:{defaultHandler:function(b){return a._doWrapMode()},
actionDescription:{name:g.toggleWrapMode}}}},_createRulerParent:function(a,d){var c=b.createElement(a,"div");c.className=d;c.tabIndex=-1;c.style.overflow="hidden";c.style.MozUserSelect="none";c.style.WebkitUserSelect="none";c.style.position="absolute";c.style.top="0px";c.style.bottom="0px";c.style.cursor="default";c.style.display="none";c.setAttribute("aria-hidden","true");this._rootDiv.appendChild(c);return c},_createRuler:function(a,d){if(this._clientDiv){var c=this._getRulerParent(a);if(c){if(c!==
this._marginDiv||this._marginOffset)c.style.display="block";var e=b.createElement(c.ownerDocument,"div");e._ruler=a;e.rulerChanged=!0;e.style.position="relative";e.style.cssFloat="left";e.style.styleFloat="left";e.style.outline="none";if(void 0===d||0>d||d>=c.children.length)c.appendChild(e);else{for(var f=c.firstChild;f&&0<d--;)f=f.nextSibling;c.insertBefore(e,f)}}}},_createView:function(){function a(){g._rootDiv&&(g.update(!0),g._metrics.invalid&&g._getWindow().setTimeout(function(){a()},100))}
if(!this._clientDiv){for(var d=this._parent;d.hasChildNodes();)d.removeChild(d.lastChild);var c=d.ownerDocument,e=b.createElement(c,"div");this._rootDiv=e;e.tabIndex=-1;e.style.position="relative";e.style.overflow="hidden";e.style.width="100%";e.style.height="100%";e.style.overflow="hidden";e.style.WebkitTextSizeAdjust="100%";e.setAttribute("role","application");d.appendChild(e);this._leftDiv=this._createRulerParent(c,"textviewLeftRuler");d=b.createElement(c,"div");d.className="textviewScroll";this._viewDiv=
d;d.tabIndex=-1;d.style.position="absolute";d.style.top="0px";d.style.bottom="0px";d.style.borderWidth="0px";d.style.margin="0px";d.style.outline="none";d.style.background="transparent";b.isMac&&b.isWebkit&&(d.style.pointerEvents="none",d.style.zIndex="2");e.appendChild(d);var f=this._createRulerParent(c,"textviewRightRuler");this._rightDiv=f;f.style.right="0px";this._scrollDiv=f=b.createElement(c,"div");f.style.margin="0px";f.style.borderWidth="0px";f.style.padding="0px";d.appendChild(f);(this._marginDiv=
this._createRulerParent(c,"textviewMarginRuler")).style.zIndex="4";!b.isIE&&!b.isIOS&&(this._clipDiv=d=b.createElement(c,"div"),d.style.position="absolute",d.style.overflow="hidden",d.style.margin="0px",d.style.borderWidth="0px",d.style.padding="0px",d.style.background="transparent",e.appendChild(d),this._clipScrollDiv=f=b.createElement(c,"div"),f.style.position="absolute",f.style.height="1px",f.style.top="-1000px",f.style.background="transparent",d.appendChild(f));this._setFullSelection(this._fullSelection,
!0);d=b.createElement(c,"div");d.className="textviewContent";this._clientDiv=d;d.tabIndex=0;d.style.position="absolute";d.style.borderWidth="0px";d.style.margin="0px";d.style.padding="0px";d.style.outline="none";d.style.zIndex="1";d.style.WebkitUserSelect="text";d.setAttribute("spellcheck","false");if(b.isIOS||b.isAndroid)d.style.WebkitTapHighlightColor="transparent";(this._clipDiv||e).appendChild(d);if(b.isIOS||b.isAndroid)this._vScrollDiv=f=b.createElement(c,"div"),f.style.position="absolute",f.style.borderWidth=
"1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.width="8px",f.style.display="none",e.appendChild(f),this._hScrollDiv=f=b.createElement(c,"div"),f.style.position="absolute",f.style.borderWidth="1px",f.style.borderColor="white",f.style.borderStyle="solid",f.style.borderRadius="4px",f.style.backgroundColor="black",
f.style.opacity="0.5",f.style.margin="0px",f.style.padding="0px",f.style.outline="none",f.style.zIndex="3",f.style.height="8px",f.style.display="none",e.appendChild(f);b.isFirefox&&!d.setCapture&&(this._overlayDiv=f=b.createElement(c,"div"),f.style.position=d.style.position,f.style.borderWidth=d.style.borderWidth,f.style.margin=d.style.margin,f.style.padding=d.style.padding,f.style.cursor="text",f.style.zIndex="2",(this._clipDiv||e).appendChild(f));d.contentEditable="true";d.setAttribute("role","textbox");
d.setAttribute("aria-multiline","true");this._setWrapMode(this._wrapMode,!0);this._setReadOnly(this._readonly);this._setThemeClass(this._themeClass,!0);this._setTabSize(this._tabSize,!0);this._setMarginOffset(this._marginOffset,!0);this._hookEvents();d=this._rulers;for(f=0;f<d.length;f++)this._createRuler(d[f]);this._update();var g=this;r(c,e,"textview",a)}},_defaultOptions:function(){return{parent:{value:void 0,update:null},model:{value:void 0,update:this.setModel},scrollAnimation:{value:0,update:null},
readonly:{value:!1,update:this._setReadOnly},fullSelection:{value:!0,update:this._setFullSelection},tabMode:{value:!0,update:null},tabSize:{value:8,update:this._setTabSize},expandTab:{value:!1,update:null},singleMode:{value:!1,update:this._setSingleMode},overwriteMode:{value:!1,update:this._setOverwriteMode},blockCursorVisible:{value:!1,update:this._setBlockCursor},marginOffset:{value:0,update:this._setMarginOffset},wrapOffset:{value:0,update:this._setWrapOffset},wrapMode:{value:!1,update:this._setWrapMode},
wrappable:{value:!1,update:null},theme:{value:c.TextTheme.getTheme(),update:this._setTheme},themeClass:{value:void 0,update:this._setThemeClass}}},_destroyRuler:function(a){var b=this._getRulerParent(a);if(b)for(var d=b.firstChild;d;){if(d._ruler===a){d._ruler=void 0;b.removeChild(d);if(0===b.children.length&&(b!==this._marginDiv||!this._marginOffset))b.style.display="none";break}d=d.nextSibling}},_destroyView:function(){if(this._clientDiv){this._setGrab(null);this._unhookEvents();var a=this._getWindow();
this._autoScrollTimerID&&(a.clearTimeout(this._autoScrollTimerID),this._autoScrollTimerID=null);this._updateTimer&&(a.clearTimeout(this._updateTimer),this._updateTimer=null);a=this._rootDiv;a.parentNode.removeChild(a);this._hScrollDiv=this._vScrollDiv=this._cursorDiv=this._marginDiv=this._rightDiv=this._leftDiv=this._overlayDiv=this._clientDiv=this._clipScrollDiv=this._clipDiv=this._viewDiv=this._scrollDiv=this._rootDiv=this._clipboardDiv=this._selDiv3=this._selDiv2=this._selDiv1=null}},_doAutoScroll:function(a,
b,d){this._autoScrollDir=a;this._autoScrollX=b;this._autoScrollY=d;this._autoScrollTimerID||this._autoScrollTimer()},_endAutoScroll:function(){this._autoScrollTimerID&&this._getWindow().clearTimeout(this._autoScrollTimerID);this._autoScrollTimerID=this._autoScrollDir=void 0},_fixCaret:function(){var a=this._clientDiv;if(a){var b=this._hasFocus;this._ignoreFocus=!0;b&&a.blur();a.contentEditable=!1;a.contentEditable=!0;b&&a.focus();this._ignoreFocus=!1}},_getBaseText:function(a,b){var d=this._model;
d.getBaseModel&&(a=d.mapOffset(a),b=d.mapOffset(b),d=d.getBaseModel());return d.getText(a,b)},_getBottomIndex:function(a){var b=this._bottomChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var d=this._clientDiv.getBoundingClientRect();a.bottom>d.bottom&&(b=this._getLinePrevious(b)||b)}return b.lineIndex},_getBoundsAtOffset:function(a){var b=this._getLine(this._model.getLineAtOffset(a));a=b.getBoundingClientRect(a);var d=this._getLinePixel(b.lineIndex);a.top+=
d;a.bottom+=d;b.destroy();return a},_getClientHeight:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientHeight-a.top-a.bottom)},_getClientWidth:function(){var a=this._getViewPadding();return Math.max(0,this._viewDiv.clientWidth-a.left-a.right)},_getClipboardText:function(a,d){var c=this._model.getLineDelimiter(),e,f,g=this._getWindow(),h=g.clipboardData;!h&&a&&(h=a.clipboardData);if(h)return e=[],f=h.getData(b.isIE?"Text":"text/plain"),n(f,function(a){e.push(a)},function(){e.push(c)}),
f=e.join(""),d&&d(f),f;if(b.isFirefox){this._ignoreFocus=!0;var m=this._clipboardDiv,h=this._rootDiv.ownerDocument;m||(this._clipboardDiv=m=b.createElement(h,"div"),m.style.position="fixed",m.style.whiteSpace="pre",m.style.left="-1000px",this._rootDiv.appendChild(m));m.innerHTML="\x3cpre contenteditable\x3d''\x3e\x3c/pre\x3e";m.firstChild.focus();var p=this,k=function(){var a=p._getTextFromElement(m);m.innerHTML="";e=[];n(a,function(a){e.push(a)},function(){e.push(c)});return e.join("")},t=!1;this._ignorePaste=
!0;if(!b.isLinux||2!==this._lastMouseButton)try{t=h.execCommand("paste",!1,null)}catch(l){t=1<m.childNodes.length||m.firstChild&&0<m.firstChild.childNodes.length}this._ignorePaste=!1;if(!t){if(a)return g.setTimeout(function(){p.focus();(f=k())&&d&&d(f);p._ignoreFocus=!1},0),null;this.focus();this._ignoreFocus=!1;return""}this.focus();this._ignoreFocus=!1;(f=k())&&d&&d(f);return f}return""},_getDOMText:function(a,b){return a._line.getText(b)},_getTextFromElement:function(a){var b=a.ownerDocument,d=
b.defaultView;if(!d.getSelection)return a.innerText||a.textContent;b=b.createRange();b.selectNode(a);a=d.getSelection();var d=[],c;for(c=0;c<a.rangeCount;c++)d.push(a.getRangeAt(c));this._ignoreSelect=!0;a.removeAllRanges();a.addRange(b);b=a.toString();a.removeAllRanges();for(c=0;c<d.length;c++)a.addRange(d[c]);this._ignoreSelect=!1;return b},_getViewPadding:function(){return this._metrics.viewPadding},_getLine:function(a){var b=this._getLineNode(a);return b&&!b.lineChanged&&!b.lineRemoved?b._line:
new v(this,a)},_getLineHeight:function(a,b){if(void 0!==a&&this._lineHeight){var d=this._lineHeight[a];if(d)return d;if(b||void 0===b)return this._lineHeight[a]=this._calculateLineHeight(a)}return this._metrics.lineHeight},_getLineNode:function(a){for(var b=this._clientDiv.firstChild;b;){if(a===b.lineIndex)return b;b=b.nextSibling}},_getLineNext:function(a){for(a=a?a.nextSibling:this._clientDiv.firstChild;a&&-1===a.lineIndex;)a=a.nextSibling;return a},_getLinePrevious:function(a){for(a=a?a.previousSibling:
this._clientDiv.lastChild;a&&-1===a.lineIndex;)a=a.previousSibling;return a},_getLinePixel:function(a){a=Math.min(Math.max(0,a),this._model.getLineCount());if(this._lineHeight){var b=this._getTopIndex(),d=-this._topIndexY+this._getScroll().y;if(a>b)for(;b<a;b++)d+=this._getLineHeight(b);else for(b-=1;b>=a;b--)d-=this._getLineHeight(b);return d}return this._getLineHeight()*a},_getLineIndex:function(a){var b,d=0,c=this._model.getLineCount();if(this._lineHeight){var d=this._getTopIndex(),e=-this._topIndexY+
this._getScroll().y;if(a!==e)if(a<e)for(;a<e&&0<d;)a+=this._getLineHeight(--d);else for(b=this._getLineHeight(d);a-b>=e&&d<c-1;)a-=b,b=this._getLineHeight(++d)}else b=this._getLineHeight(),d=Math.floor(a/b);return Math.max(0,Math.min(c-1,d))},_getRulerParent:function(a){switch(a.getLocation()){case "left":return this._leftDiv;case "right":return this._rightDiv;case "margin":return this._marginDiv}return null},_getScroll:function(a){(void 0===a||a)&&this._cancelAnimation();a=this._viewDiv;return{x:a.scrollLeft,
y:a.scrollTop}},_getSelection:function(){return this._selection.clone()},_getTopIndex:function(a){var b=this._topChild;if(a&&this._getClientHeight()>this._getLineHeight()){a=b.getBoundingClientRect();var d=this._getViewPadding(),c=this._viewDiv.getBoundingClientRect();a.top<c.top+d.top&&(b=this._getLineNext(b)||b)}return b.lineIndex},_hookEvents:function(){var a=this;this._modelListener={onChanging:function(b){a._onModelChanging(b)},onChanged:function(b){a._onModelChanged(b)}};this._model.addEventListener("preChanging",
this._modelListener.onChanging);this._model.addEventListener("postChanged",this._modelListener.onChanged);this._themeListener={onChanged:function(b){a._setThemeClass(a._themeClass)}};this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);var d=this._handlers=[],c=this._clientDiv,e=this._viewDiv,f=this._rootDiv,g=this._overlayDiv||c,h=c.ownerDocument,m=this._getWindow(),n=b.isIE?h:m;d.push({target:m,type:"resize",handler:function(b){return a._handleResize(b?b:m.event)}});d.push({target:c,
type:"blur",handler:function(b){return a._handleBlur(b?b:m.event)}});d.push({target:c,type:"focus",handler:function(b){return a._handleFocus(b?b:m.event)}});d.push({target:e,type:"focus",handler:function(a){c.focus()}});d.push({target:e,type:"scroll",handler:function(b){return a._handleScroll(b?b:m.event)}});d.push({target:c,type:"textInput",handler:function(b){return a._handleTextInput(b?b:m.event)}});d.push({target:c,type:"keydown",handler:function(b){return a._handleKeyDown(b?b:m.event)}});d.push({target:c,
type:"keypress",handler:function(b){return a._handleKeyPress(b?b:m.event)}});d.push({target:c,type:"keyup",handler:function(b){return a._handleKeyUp(b?b:m.event)}});b.isIE&&d.push({target:h,type:"keyup",handler:function(b){return a._handleDocKeyUp(b?b:m.event)}});d.push({target:c,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:m.event)}});d.push({target:c,type:"copy",handler:function(b){return a._handleCopy(b?b:m.event)}});d.push({target:c,type:"cut",handler:function(b){return a._handleCut(b?
b:m.event)}});d.push({target:c,type:"paste",handler:function(b){return a._handlePaste(b?b:m.event)}});d.push({target:h,type:"selectionchange",handler:function(b){return a._handleSelectionChange(b?b:m.event)}});if(b.isIOS||b.isAndroid)d.push({target:c,type:"touchstart",handler:function(b){return a._handleTouchStart(b?b:m.event)}}),d.push({target:c,type:"touchmove",handler:function(b){return a._handleTouchMove(b?b:m.event)}}),d.push({target:c,type:"touchend",handler:function(b){return a._handleTouchEnd(b?
b:m.event)}});else{d.push({target:c,type:"selectstart",handler:function(b){return a._handleSelectStart(b?b:m.event)}});d.push({target:c,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:m.event)}});d.push({target:c,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:m.event)}});d.push({target:c,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:m.event)}});d.push({target:n,type:"mouseup",handler:function(b){return a._handleMouseUp(b?b:m.event)}});d.push({target:n,
type:"mousemove",handler:function(b){return a._handleMouseMove(b?b:m.event)}});d.push({target:f,type:"mousedown",handler:function(b){return a._handleRootMouseDown(b?b:m.event)}});d.push({target:f,type:"mouseup",handler:function(b){return a._handleRootMouseUp(b?b:m.event)}});d.push({target:g,type:"dragstart",handler:function(b){return a._handleDragStart(b?b:m.event)}});d.push({target:g,type:"drag",handler:function(b){return a._handleDrag(b?b:m.event)}});d.push({target:g,type:"dragend",handler:function(b){return a._handleDragEnd(b?
b:m.event)}});d.push({target:g,type:"dragenter",handler:function(b){return a._handleDragEnter(b?b:m.event)}});d.push({target:g,type:"dragover",handler:function(b){return a._handleDragOver(b?b:m.event)}});d.push({target:g,type:"dragleave",handler:function(b){return a._handleDragLeave(b?b:m.event)}});d.push({target:g,type:"drop",handler:function(b){return a._handleDrop(b?b:m.event)}});d.push({target:this._clientDiv,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?
b:m.event)}});this._clipDiv&&d.push({target:this._clipDiv,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(b){return a._handleMouseWheel(b?b:m.event)}});if(b.isFirefox&&(!b.isWindows||15<=b.isFirefox))(e=m.MutationObserver||m.MozMutationObserver)?(this._mutationObserver=new e(function(b){a._handleDataModified(b)}),this._mutationObserver.observe(c,{subtree:!0,characterData:!0})):d.push({target:this._clientDiv,type:"DOMCharacterDataModified",handler:function(b){return a._handleDataModified(b?
b:m.event)}});this._overlayDiv&&(d.push({target:this._overlayDiv,type:"mousedown",handler:function(b){return a._handleMouseDown(b?b:m.event)}}),d.push({target:this._overlayDiv,type:"mouseover",handler:function(b){return a._handleMouseOver(b?b:m.event)}}),d.push({target:this._overlayDiv,type:"mouseout",handler:function(b){return a._handleMouseOut(b?b:m.event)}}),d.push({target:this._overlayDiv,type:"contextmenu",handler:function(b){return a._handleContextMenu(b?b:m.event)}}));this._isW3CEvents||d.push({target:this._clientDiv,
type:"dblclick",handler:function(b){return a._handleDblclick(b?b:m.event)}})}this._hookRulerEvents(this._leftDiv,d);this._hookRulerEvents(this._rightDiv,d);this._hookRulerEvents(this._marginDiv,d);for(e=0;e<d.length;e++)f=d[e],y(f.target,f.type,f.handler,f.capture)},_hookRulerEvents:function(a,d){if(a){var c=this,e=this._getWindow();b.isIE&&d.push({target:a,type:"selectstart",handler:function(){return!1}});d.push({target:a,type:26<b.isFirefox?"wheel":b.isFirefox?"DOMMouseScroll":"mousewheel",handler:function(a){return c._handleMouseWheel(a?
a:e.event)}});d.push({target:a,type:"click",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"dblclick",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"mousemove",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"mouseover",handler:function(a){c._handleRulerEvent(a?a:e.event)}});d.push({target:a,type:"mouseout",handler:function(a){c._handleRulerEvent(a?a:e.event)}})}},_getWindow:function(){return this._parent.ownerDocument.defaultView||
this._parent.ownerDocument.parentWindow},_ignoreEvent:function(a){for(a=a.target;a&&a!==this._clientDiv;){if(a.ignore)return!0;a=a.parentNode}return!1},_init:function(a){var d=a.parent;"string"===typeof d&&(d=(a.document||document).getElementById(d));if(!d)throw"no parent";a.parent=d;a.model=a.model||new l.TextModel;var c=this._defaultOptions(),e;for(e in c)c.hasOwnProperty(e)&&(this["_"+e]=void 0!==a[e]?a[e]:c[e].value);this._keyModes=[];this._rulers=[];this._selection=new s(0,0,!1);this._linksVisible=
!1;this._maxLineWidth=this._redrawCount=0;this._maxLineIndex=-1;this._ignoreSelect=!0;this._hasFocus=this._ignoreFocus=!1;this._dragOffset=this._columnX=-1;this._isRangeRects=(!b.isIE||9<=b.isIE)&&"function"===typeof d.ownerDocument.createRange().getBoundingClientRect;this._isW3CEvents=d.addEventListener;this._autoScrollTimerID=this._autoScrollY=this._autoScrollX=null;this._AUTO_SCROLL_RATE=50;this._mouseUpClosure=this._moseMoveClosure=this._grabControl=null;this._clickCount=this._lastMouseTime=this._lastMouseY=
this._lastMouseX=0;this._clickTime=250;this._clickDist=5;this._isMouseDown=!1;this._doubleClickSelection=null;this._vScroll=this._hScroll=0;this._imeOffset=-1;this._createActions();this._createView()},_modifyContent:function(a,b){if(!this._readonly||a._code)if(a.type="Verify",this.onVerify(a),!(null===a.text||void 0===a.text)){var d=this._model;try{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!0),d.setText(a.text,a.start,a.end)}finally{a._ignoreDOMSelection&&(this._ignoreDOMSelection=!1)}b&&(d=
this._getSelection(),d.setCaret(a.start+a.text.length),this._setSelection(d,!0));this.onModify({type:"Modify"})}},_onModelChanged:function(a){a.type="ModelChanged";this.onModelChanged(a);a.type="Changed";var b=a.start,d=a.addedCharCount,c=a.removedCharCount,e=a.addedLineCount,f=a.removedLineCount,g=this._getSelection();g.end>b&&(g.end>b&&g.start<b+c?g.setCaret(b+d):(g.start+=d-c,g.end+=d-c),this._setSelection(g,!1,!1));b=this._model.getLineAtOffset(b);for(d=this._getLineNext();d;)c=d.lineIndex,b<=
c&&c<=b+f&&(b===c&&!d.modelChangedEvent&&!d.lineRemoved?(d.modelChangedEvent=a,d.lineChanged=!0):(d.lineRemoved=!0,d.lineChanged=!1,d.modelChangedEvent=null)),c>b+f&&(d.lineIndex=c+e-f,d._line.lineIndex=d.lineIndex),d=this._getLineNext(d);this._lineHeight&&(a=[b,f].concat(Array(e)),Array.prototype.splice.apply(this._lineHeight,a));!this._wrapMode&&b<=this._maxLineIndex&&this._maxLineIndex<=b+f&&(this._checkMaxLineIndex=this._maxLineIndex,this._maxLineIndex=-1,this._maxLineWidth=0);this._update()},
_onModelChanging:function(a){a.type="ModelChanging";this.onModelChanging(a);a.type="Changing"},_queueUpdate:function(){if(!this._updateTimer&&!this._ignoreQueueUpdate){var a=this;this._updateTimer=this._getWindow().setTimeout(function(){a._updateTimer=null;a._update()},0)}},_resetLineHeight:function(a,b){if(this._wrapMode||this._variableLineHeight){if(void 0!==a&&void 0!==b)for(var d=a;d<b;d++)this._lineHeight[d]=void 0;else this._lineHeight=Array(this._model.getLineCount());this._calculateLineHeightTimer()}else this._lineHeight=
null},_resetLineWidth:function(){var a=this._clientDiv;if(a)for(a=a.firstChild;a;)a.lineWidth=void 0,a=a.nextSibling},_reset:function(){this._maxLineIndex=-1;this._maxLineWidth=0;this._columnX=-1;this._bottomChild=this._topChild=null;this._topIndexY=0;this._variableLineHeight=!1;this._resetLineHeight();this._setSelection(new s(0,0,!1),!1,!1);this._viewDiv&&(this._viewDiv.scrollLeft=0,this._viewDiv.scrollTop=0);var a=this._clientDiv;if(a){for(a=a.firstChild;a;)a.lineRemoved=!0,a=a.nextSibling;13>b.isFirefox&&
this._fixCaret()}},_scrollViewAnimated:function(a,b,d){var c=this._getWindow();if(d&&this._scrollAnimation){var e=this;this._animation=new z({window:c,duration:this._scrollAnimation,curve:[b,0],onAnimate:function(a){a=b-Math.floor(a);e._scrollView(0,a);b-=a},onEnd:function(){e._animation=null;e._scrollView(a,b);d&&c.setTimeout(d,0)}});this._animation.play()}else this._scrollView(a,b),d&&c.setTimeout(d,0)},_scrollView:function(a,b){this._ensureCaretVisible=!1;var d=this._viewDiv;a&&(d.scrollLeft+=
a);b&&(d.scrollTop+=b)},_setClipboardText:function(a,d){var c,e=this._getWindow(),f=e.clipboardData;!f&&d&&(f=d.clipboardData);if(f&&(c=[],n(a,function(a){c.push(a)},function(){c.push(b.platformDelimiter)}),f.setData(b.isIE?"Text":"text/plain",c.join(""))))return!0;var g=this._parent.ownerDocument,h=b.createElement(g,"pre");h.style.position="fixed";h.style.left="-1000px";n(a,function(a){h.appendChild(g.createTextNode(a))},function(){h.appendChild(b.createElement(g,"br"))});h.appendChild(g.createTextNode(" "));
this._clientDiv.appendChild(h);f=g.createRange();f.setStart(h.firstChild,0);f.setEndBefore(h.lastChild);var m=e.getSelection();0<m.rangeCount&&m.removeAllRanges();m.addRange(f);var p=this,f=function(){h&&h.parentNode===p._clientDiv&&p._clientDiv.removeChild(h);p._updateDOMSelection()},m=!1;this._ignoreCopy=!0;try{m=g.execCommand("copy",!1,null)}catch(k){}this._ignoreCopy=!1;if(!m&&d)return e.setTimeout(f,0),!1;f();return!0},_setDOMSelection:function(a,d,c,e,f){this._setDOMFullSelection(a,d,c,e);a=
a._line.getNodeOffset(d);c=c._line.getNodeOffset(e);e=this._getWindow();d=this._parent.ownerDocument;if(e.getSelection){var g=e.getSelection();e=d.createRange();e.setStart(a.node,a.offset);e.setEnd(c.node,c.offset);if(this._hasFocus&&(g.anchorNode!==a.node||g.anchorOffset!==a.offset||g.focusNode!==c.node||g.focusOffset!==c.offset||g.anchorNode!==c.node||g.anchorOffset!==c.offset||g.focusNode!==a.node||g.focusOffset!==a.offset))this._anchorNode=a.node,this._anchorOffset=a.offset,this._focusNode=c.node,
this._focusOffset=c.offset,this._ignoreSelect=!1,0<g.rangeCount&&g.removeAllRanges(),g.addRange(e),this._ignoreSelect=!0;this._cursorDiv&&(e=d.createRange(),f?(e.setStart(a.node,a.offset),e.setEnd(a.node,a.offset)):(e.setStart(c.node,c.offset),e.setEnd(c.node,c.offset)),f=e.getClientRects()[0],a=this._cursorDiv.parentNode,c=a.getBoundingClientRect(),f&&c&&(this._cursorDiv.style.top=f.top-c.top+a.scrollTop+"px",this._cursorDiv.style.left=f.left-c.left+a.scrollLeft+"px"))}else d.selection&&this._hasFocus&&
(f=d.body,e=b.createElement(d,"div"),f.appendChild(e),f.removeChild(e),e=f.createTextRange(),e.moveToElementText(a.node.parentNode),e.moveStart("character",a.offset),f=f.createTextRange(),f.moveToElementText(c.node.parentNode),f.moveStart("character",c.offset),e.setEndPoint("EndToStart",f),this._ignoreSelect=!1,e.select(),this._ignoreSelect=!0)},_setDOMFullSelection:function(a,b,d,c){if(this._selDiv1){var e=this._selDiv1;e.style.width="0px";e.style.height="0px";e=this._selDiv2;e.style.width="0px";
e.style.height="0px";e=this._selDiv3;e.style.width="0px";e.style.height="0px";if(!(a===d&&b===c)){var f=this._getViewPadding(),g=this._clientDiv.getBoundingClientRect(),h=this._viewDiv.getBoundingClientRect(),e=h.left+f.left,m=g.right,f=h.top+f.top,n=g.bottom,h=g=0;this._clipDiv?(h=this._clipDiv.getBoundingClientRect(),g=h.left-this._clipDiv.scrollLeft):(h=this._rootDiv.getBoundingClientRect(),g=h.left);h=h.top;this._ignoreDOMSelection=!0;var p=(new v(this,a.lineIndex,a)).getBoundingClientRect(b,
!1),k=p.left;b=(new v(this,d.lineIndex,d)).getBoundingClientRect(c,!1);var t=b.left;this._ignoreDOMSelection=!1;var l=this._selDiv1,k=Math.min(m,Math.max(e,k)),r=Math.min(n,Math.max(f,p.top)),s=m;c=Math.min(n,Math.max(f,p.bottom));l.style.left=k-g+"px";l.style.top=r-h+"px";l.style.width=Math.max(0,s-k)+"px";l.style.height=Math.max(0,c-r)+"px";a.lineIndex===d.lineIndex?(s=Math.min(t,m),l.style.width=Math.max(0,s-k)+"px"):(p=Math.min(n,Math.max(f,b.top)),t=Math.min(m,Math.max(e,t)),f=Math.min(n,Math.max(f,
b.bottom)),n=this._selDiv3,n.style.left=e-g+"px",n.style.top=p-h+"px",n.style.width=Math.max(0,t-e)+"px",n.style.height=Math.max(0,f-p)+"px",1<Math.abs(a.lineIndex-d.lineIndex)&&(a=this._selDiv2,a.style.left=e-g+"px",a.style.top=c-h+"px",a.style.width=Math.max(0,m-e)+"px",a.style.height=Math.max(0,p-c)+"px"))}}},_setGrab:function(a){a!==this._grabControl&&(a?(a.setCapture&&a.setCapture(),this._grabControl=a):(this._grabControl.releaseCapture&&this._grabControl.releaseCapture(),this._grabControl=null))},
_setLinksVisible:function(a){if(this._linksVisible!==a){this._linksVisible=a;b.isIE&&a&&(this._hadFocus=this._hasFocus);var d=this._clientDiv;d.contentEditable=!a;this._hadFocus&&!a&&d.focus();this._overlayDiv&&(this._overlayDiv.style.zIndex=a?"-1":"1");for(a=this._getLineNext();a;)a._line.updateLinks(),a=this._getLineNext(a);this._updateDOMSelection()}},_setSelection:function(a,b,d,c,e){if(a){this._columnX=-1;void 0===d&&(d=!0);var f=this._selection;this._selection=a;!1!==b&&this._showCaret(!1,c,
b,e);d&&this._updateDOMSelection();if(!f.equals(a))this.onSelection({type:"Selection",oldValue:{start:f.start,end:f.end},newValue:{start:a.start,end:a.end}})}},_setSelectionTo:function(a,b,d,c){var e=this._model,f=this._getSelection();b=this.convert({x:a,y:b},"page","document");a=this._getLineIndex(b.y);if(1===this._clickCount){e=this._getLine(a);a=e.getOffset(b.x,b.y-this._getLinePixel(a));e.destroy();if(c&&!d&&f.start<=a&&a<f.end)return this._dragOffset=a,!1;f.extend(a);d||f.collapse()}else 0===
(this._clickCount&1)?(e=this._getLine(a),a=e.getOffset(b.x,b.y-this._getLinePixel(a)),this._doubleClickSelection?a>=this._doubleClickSelection.start?(d=this._doubleClickSelection.start,c=e.getNextOffset(a,{unit:"wordend",count:1})):(d=e.getNextOffset(a,{unit:"word",count:-1}),c=this._doubleClickSelection.end):(d=e.getNextOffset(a,{unit:"word",count:-1}),c=e.getNextOffset(d,{unit:"wordend",count:1})),e.destroy()):this._doubleClickSelection?(c=e.getLineAtOffset(this._doubleClickSelection.start),a>=
c?(d=e.getLineStart(c),c=e.getLineEnd(a)):(d=e.getLineStart(a),c=e.getLineEnd(c))):(d=e.getLineStart(a),c=e.getLineEnd(a)),f.setCaret(d),f.extend(c);this._setSelection(f,!0,!0);return!0},_setFullSelection:function(a,d){this._fullSelection=a;b.isWebkit&&(this._fullSelection=!0);var c=this._clipDiv||this._rootDiv;if(c)if(this._fullSelection){if(!this._selDiv1&&this._fullSelection&&!b.isIOS){var e=c.ownerDocument;this._highlightRGB=b.isWebkit?"transparent":"Highlight";var f=b.createElement(e,"div");
this._selDiv1=f;f.style.position="absolute";f.style.borderWidth="0px";f.style.margin="0px";f.style.padding="0px";f.style.outline="none";f.style.background=this._highlightRGB;f.style.width="0px";f.style.height="0px";f.style.zIndex="0";c.appendChild(f);var g=b.createElement(e,"div");this._selDiv2=g;g.style.position="absolute";g.style.borderWidth="0px";g.style.margin="0px";g.style.padding="0px";g.style.outline="none";g.style.background=this._highlightRGB;g.style.width="0px";g.style.height="0px";g.style.zIndex=
"0";c.appendChild(g);this._selDiv3=e=b.createElement(e,"div");e.style.position="absolute";e.style.borderWidth="0px";e.style.margin="0px";e.style.padding="0px";e.style.outline="none";e.style.background=this._highlightRGB;e.style.width="0px";e.style.height="0px";e.style.zIndex="0";c.appendChild(e);if(b.isFirefox&&b.isMac){c=this._getWindow().getComputedStyle(e,null).getPropertyValue("background-color");switch(c){case "rgb(119, 141, 168)":c="rgb(199, 208, 218)";break;case "rgb(127, 127, 127)":c="rgb(198, 198, 198)";
break;case "rgb(255, 193, 31)":c="rgb(250, 236, 115)";break;case "rgb(243, 70, 72)":c="rgb(255, 176, 139)";break;case "rgb(255, 138, 34)":c="rgb(255, 209, 129)";break;case "rgb(102, 197, 71)":c="rgb(194, 249, 144)";break;case "rgb(140, 78, 184)":c="rgb(232, 184, 255)";break;default:c="rgb(180, 213, 255)"}this._highlightRGB=c;f.style.background=c;g.style.background=c;e.style.background=c}d||this._updateDOMSelection()}}else this._selDiv1&&(c.removeChild(this._selDiv1),this._selDiv1=null),this._selDiv2&&
(c.removeChild(this._selDiv2),this._selDiv2=null),this._selDiv3&&(c.removeChild(this._selDiv3),this._selDiv3=null)},_setBlockCursor:function(a){this._blockCursorVisible=a;this._updateBlockCursorVisible()},_setOverwriteMode:function(a){this._overwriteMode=a;this._updateBlockCursorVisible()},_updateBlockCursorVisible:function(){if(this._blockCursorVisible||this._overwriteMode){if(!this._cursorDiv){var a=this._viewDiv,d=b.createElement(a.ownerDocument,"div");d.className="textviewBlockCursor";this._cursorDiv=
d;d.tabIndex=-1;d.style.zIndex="2";d.style.color="transparent";d.style.position="absolute";d.style.pointerEvents="none";d.innerHTML="\x26nbsp;";a.appendChild(d);this._updateDOMSelection()}}else this._cursorDiv&&(this._cursorDiv.parentNode.removeChild(this._cursorDiv),this._cursorDiv=null)},_setMarginOffset:function(a,b){this._marginOffset=a;this._marginDiv.style.display=a?"block":"none";b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setWrapOffset:function(a,b){this._wrapOffset=
a;b||(this._metrics=this._calculateMetrics(),this._queueUpdate())},_setReadOnly:function(a){this._readonly=a;this._clientDiv.setAttribute("aria-readonly",a?"true":"false")},_setSingleMode:function(a,b){this._singleMode=a;this._updateOverflow();this._updateStyle(b)},_setTabSize:function(a,d){this._tabSize=a;this._customTabSize=void 0;var c=this._clientDiv;b.isOpera?c&&(c.style.OTabSize=this._tabSize+""):537.1<=b.isWebkit?c&&(c.style.tabSize=this._tabSize+""):4<=b.isFirefox?c&&(c.style.MozTabSize=this._tabSize+
""):8!==this._tabSize&&(this._customTabSize=this._tabSize);d||(this.redrawLines(),this._resetLineWidth())},_setTheme:function(a){this._theme&&this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);(this._theme=a)&&this._theme.addEventListener("ThemeChanged",this._themeListener.onChanged);this._setThemeClass(this._themeClass)},_setThemeClass:function(a,b){this._themeClass=a;var d="textview",c=this._theme.getThemeClass();c&&(d+=" "+c);this._themeClass&&c!==this._themeClass&&(d+=
" "+this._themeClass);this._rootDiv.className=d;this._updateStyle(b)},_setWrapMode:function(a,b){this._wrapMode=a&&this._wrappable;var d=this._clientDiv;this._wrapMode?(d.style.whiteSpace="pre-wrap",d.style.wordWrap="break-word"):(d.style.whiteSpace="pre",d.style.wordWrap="normal");this._updateOverflow();b||(this.redraw(),this._resetLineWidth());this._resetLineHeight()},_showCaret:function(a,b,d,c){if(this._clientDiv){var e=this._model,f=this._getSelection(),g=this._getScroll(),h=f.getCaret(),m=f.start,
n=f.end,p=e.getLineAtOffset(m),k=e.getLineAtOffset(n),t=Math.max(Math.max(m,e.getLineStart(k)),n-1),e=this._getClientWidth(),l=this._getClientHeight(),r=e/4,s=this._getBoundsAtOffset(h===m?m:t),x=s.left,w=s.right,v=s.top,z=s.bottom,u=0,y="object"===typeof d;if((a||y)&&!f.isEmpty())s=this._getBoundsAtOffset(h===n?m:t),u=(s.bottom>z?s.bottom:z)-(s.top<v?s.top:v),a&&(s.top===v?h===m?w=x+Math.min(s.right-x,e):x=w-Math.min(w-s.left,e):h===m?z=v+Math.min(s.bottom-v,l):v=z-Math.min(z-s.top,l));a=0;x<g.x&&
(a=Math.min(x-g.x,-r));w>g.x+e&&(a=Math.max(w-g.x-e,r));f=0;v<g.y?f=v-g.y:z>g.y+l&&(f=z-g.y-l);c&&(0<c?0<f&&(f=Math.max(f,c)):0>f&&(f=Math.min(f,c)));c=y&&"always"===d.scrollPolicy;if(0!==a||0!==f||c)return y?(c=0<f,0===f&&(f=v-g.y),g=d.viewAnchor||"caret",v=d.selectionAnchor||"caret",d=Math.min(Math.max(0,d.viewAnchorOffset||0)),f="top"===g?f+Math.floor(c?(1-d)*l:-d*l):"bottom"===g?f+Math.floor(c?d*l:-(1-d)*l):"center"===g?f+Math.floor(c?l/2+d*l:l/2-(1-d)*l):f+Math.floor(c?d*l:-d*l),p!==k&&("top"===
v&&h!==m?f+=Math.floor(-u):"bottom"===v&&h!==n?f+=Math.floor(u):"center"===v&&(f+=Math.floor(u/2)))):0!==f&&"number"===typeof d&&(0>d&&(d=0),1<d&&(d=1),f+=Math.floor(0<f?d*l:-d*l)),this._scrollViewAnimated(a,f,b),l!==this._getClientHeight()||e!==this._getClientWidth()?this._showCaret():this._ensureCaretVisible=!0,!0;b&&b();return!1}},_startIME:function(){if(-1===this._imeOffset){var a=this._getSelection();a.isEmpty()||this._modifyContent({text:"",start:a.start,end:a.end},!0);this._imeOffset=a.start}},
_unhookEvents:function(){this._model.removeEventListener("preChanging",this._modelListener.onChanging);this._model.removeEventListener("postChanged",this._modelListener.onChanged);this._theme.removeEventListener("ThemeChanged",this._themeListener.onChanged);this._modelListener=null;for(var a=0;a<this._handlers.length;a++){var b=this._handlers[a];x(b.target,b.type,b.handler)}this._handlers=null;this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=null)},_updateDOMSelection:function(){if(!(0<
this._redrawCount)&&!this._ignoreDOMSelection&&this._clientDiv){var a=this._getSelection(),b=this._model,d=b.getLineAtOffset(a.start),c=b.getLineAtOffset(a.end),e=this._getLineNext();if(e){var f=this._getLinePrevious(),g;d<e.lineIndex?(d=e,g=b.getLineStart(e.lineIndex)):d>f.lineIndex?(d=f,g=b.getLineStart(f.lineIndex)):(d=this._getLineNode(d),g=a.start);c<e.lineIndex?(c=e,b=b.getLineStart(e.lineIndex)):c>f.lineIndex?(c=f,b=b.getLineStart(f.lineIndex)):(c=this._getLineNode(c),b=a.end);this._setDOMSelection(d,
g,c,b,a.caret)}}},_update:function(a){if(!(0<this._redrawCount)){this._updateTimer&&(this._getWindow().clearTimeout(this._updateTimer),this._updateTimer=null,a=!1);var d=this._clientDiv,c=this._viewDiv;if(d){this._metrics.invalid&&(this._ignoreQueueUpdate=!0,this._updateStyle(),this._ignoreQueueUpdate=!1);var e=this._model,f=this._getScroll(!1),g=this._getViewPadding(),h=e.getLineCount(),m=this._getLineHeight(),n=!1,p=!1,k=!1,t=this._metrics.scrollWidth;this._wrapMode&&(d.style.width=(this._metrics.wrapWidth||
this._getClientWidth())+"px");var l,r,s,x,w=0,z=0,u;if(this._lineHeight){for(;z<h;){u=this._getLineHeight(z);if(w+u>f.y)break;w+=u;z++}l=z;r=Math.max(0,l-1);s=e=f.y-w;0<l&&(e+=this._getLineHeight(l-1))}else x=Math.max(0,f.y)/m,l=Math.floor(x),r=Math.max(0,l-1),e=Math.round((x-r)*m),s=Math.round((x-l)*m);this._topIndexY=s;x=this._rootDiv;var y=x.clientWidth,Q=x.clientHeight;if(a){m=0;this._leftDiv&&(l=this._leftDiv.getBoundingClientRect(),m=l.right-l.left);l=this._getClientWidth();x=this._getClientHeight();
p=l;for(this._wrapMode?this._metrics.wrapWidth&&(p=this._metrics.wrapWidth):p=Math.max(this._maxLineWidth,p);z<h;)u=this._getLineHeight(z,!1),w+=u,z++;h=w}else{x=this._getClientHeight();s=Math.min(l+Math.floor((x+s)/m),h-1);var f=Math.min(s+1,h-1),K;for(u=d.firstChild;u;){K=u.lineIndex;var L=u.nextSibling;if(!(r<=K&&K<=f)||u.lineRemoved||-1===u.lineIndex)this._mouseWheelLine===u?(u.style.display="none",u.lineIndex=-1):d.removeChild(u);u=L}u=this._getLineNext();var L=c.ownerDocument,M=L.createDocumentFragment();
for(K=r;K<=f;K++)!u||u.lineIndex>K?(new v(this,K)).create(M,null):(M.firstChild&&(d.insertBefore(M,u),M=L.createDocumentFragment()),u&&u.lineChanged&&(u=(new v(this,K)).create(M,u),u.lineChanged=!1),u=this._getLineNext(u));M.firstChild&&d.insertBefore(M,u);b.isWebkit&&!this._wrapMode&&(d.style.width="0x7fffffffpx");u=this._getLineNext();K=x+e;for(M=!1;u;)r=u.lineWidth,void 0===r&&(L=u._line.getBoundingClientRect(),r=u.lineWidth=Math.ceil(L.right-L.left),L=L.bottom-L.top,this._lineHeight?this._lineHeight[u.lineIndex]=
L:0!==m&&0!==L&&Math.ceil(m)!==Math.ceil(L)&&(this._variableLineHeight=!0,this._lineHeight=[],this._lineHeight[u.lineIndex]=L)),this._lineHeight&&!M&&(K-=this._lineHeight[u.lineIndex],0>K&&(s=u.lineIndex,M=!0)),this._wrapMode||(r>=this._maxLineWidth&&(this._maxLineWidth=r,this._maxLineIndex=u.lineIndex),this._checkMaxLineIndex===u.lineIndex&&(this._checkMaxLineIndex=-1)),u.lineIndex===l&&(this._topChild=u),u.lineIndex===s&&(this._bottomChild=u),u=this._getLineNext(u);for(-1!==this._checkMaxLineIndex&&
(K=this._checkMaxLineIndex,this._checkMaxLineIndex=-1,0<=K&&K<h&&(m=new v(this,K),L=m.getBoundingClientRect(),r=L.right-L.left,r>=this._maxLineWidth&&(this._maxLineWidth=r,this._maxLineIndex=K),m.destroy()));z<h;)u=this._getLineHeight(z,z<=s),w+=u,z++;h=w;this._updateRuler(this._leftDiv,l,f,Q);this._updateRuler(this._rightDiv,l,f,Q);this._updateRuler(this._marginDiv,l,f,Q);m=0;this._leftDiv&&(l=this._leftDiv.getBoundingClientRect(),m=l.right-l.left);f=0;this._rightDiv&&(f=this._rightDiv.getBoundingClientRect(),
f=f.right-f.left);c.style.left=m+"px";c.style.right=f+"px";f=this._scrollDiv;f.style.height=h+"px";l=this._getClientWidth();!this._singleMode&&!this._wrapMode&&(w=n=x,(z="scroll"===c.style.overflowX)?n+=t:w-=t,u=s=l,(r="scroll"===c.style.overflowY)?s+=t:u-=t,x=n,l=s,h>x&&(k=!0,l=u),this._maxLineWidth>l&&(p=!0,x=w,h>x&&(k=!0,l=u)),z!==p&&(c.style.overflowX=p?"scroll":"hidden"),r!==k&&(c.style.overflowY=k?"scroll":"hidden"),n=z!==p||r!==k);k=l;this._wrapMode?this._metrics.wrapWidth&&(k=this._metrics.wrapWidth):
k=Math.max(this._maxLineWidth,k);p=k;if((!b.isIE||9<=b.isIE)&&this._maxLineWidth>l)k+=g.right+g.left;f.style.width=k+"px";this._clipScrollDiv&&(this._clipScrollDiv.style.width=k+"px");f=this._getScroll(!1)}this._vScrollDiv&&(k=x-8,w=Math.max(15,Math.ceil(Math.min(1,k/(h+g.top+g.bottom))*k)),this._vScrollDiv.style.left=m+l-8+"px",this._vScrollDiv.style.top=Math.floor(Math.max(0,f.y*k/h))+"px",this._vScrollDiv.style.height=w+"px");!this._wrapMode&&this._hScrollDiv&&(k=l-8,w=Math.max(15,Math.ceil(Math.min(1,
k/(this._maxLineWidth+g.left+g.right))*k)),this._hScrollDiv.style.left=m+Math.floor(Math.max(0,Math.floor(f.x*k/this._maxLineWidth)))+"px",this._hScrollDiv.style.top=x-9+"px",this._hScrollDiv.style.width=w+"px");z=f.x;w=this._clipDiv;k=this._overlayDiv;if(s=this._marginDiv)s.style.left=-z+m+this._metrics.marginWidth+g.left+"px",s.style.bottom=("scroll"===c.style.overflowX?t:0)+"px";w?(w.scrollLeft=z,w.scrollTop=0,c=m+g.left,t=g.top,a=l,m=x,z=0,s=-e,0===f.x&&(c-=g.left,a+=g.left,z=g.left),f.x+l===
p&&(a+=g.right),0===f.y&&(t-=g.top,m+=g.top,s+=g.top),f.y+x===h&&(m+=g.bottom),w.style.left=c+"px",w.style.top=t+"px",w.style.right=y-a-c+"px",w.style.bottom=Q-m-t+"px",d.style.left=z+"px",d.style.top=s+"px",d.style.width=p+"px",d.style.height=x+e+"px",k&&(k.style.left=d.style.left,k.style.top=d.style.top,k.style.width=d.style.width,k.style.height=d.style.height)):(c=z,t=e,y=z+l,Q=e+x,0===c&&(c-=g.left),0===t&&(t-=g.top),y===p&&(y+=g.right),f.y+x===h&&(Q+=g.bottom),d.style.clip="rect("+t+"px,"+y+
"px,"+Q+"px,"+c+"px)",d.style.left=-z+m+g.left+"px",d.style.width=(this._wrapMode||b.isWebkit?p:l+z)+"px",a||(d.style.top=-e+g.top+"px",d.style.height=x+e+"px"),k&&(k.style.clip=d.style.clip,k.style.left=d.style.left,k.style.width=d.style.width,a||(k.style.top=d.style.top,k.style.height=d.style.height)));this._updateDOMSelection();n&&(d=this._ensureCaretVisible,this._ensureCaretVisible=!1,d&&this._showCaret(),this._queueUpdate())}}},_updateOverflow:function(){var a=this._viewDiv;this._wrapMode?(a.style.overflowX=
"hidden",a.style.overflowY="scroll"):a.style.overflow="hidden"},_updateRuler:function(a,d,c,e){if(a){var g=this._parent.ownerDocument,h=this._getLineHeight(),m=this._getViewPadding();for(a=a.firstChild;a;){var n=a._ruler,p=h,k=n.getOverview();"page"===k&&(p+=this._topIndexY);a.style.top=-p+"px";a.style.height=e+p+"px";a.rulerChanged&&f(n.getRulerStyle(),a);var t,l=a.firstChild;l?(t=l,l=l.nextSibling):(t=b.createElement(g,"div"),t.style.visibility="hidden",a.appendChild(t));var r;if(a.rulerChanged&&
t){p=-1;if(r=n.getWidestAnnotation())f(r.style,t),r.html&&(t.innerHTML=r.html);t.lineIndex=p;t.style.height=h+m.top+"px"}var s;if("page"===k){for(n=n.getAnnotations(d,c+1);l;)p=l.lineIndex,r=l.nextSibling,(!(d<=p&&p<=c)||l.lineChanged)&&a.removeChild(l),l=r;l=a.firstChild.nextSibling;s=g.createDocumentFragment();for(p=d;p<=c;p++)if(!l||l.lineIndex>p){t=b.createElement(g,"div");if(r=n[p])f(r.style,t),r.html&&(t.innerHTML=r.html),t.annotation=r;t.lineIndex=p;t.style.height=this._getLineHeight(p)+"px";
s.appendChild(t)}else s.firstChild&&(a.insertBefore(s,l),s=g.createDocumentFragment()),l&&(l=l.nextSibling);s.firstChild&&a.insertBefore(s,l)}else{r=this._getClientHeight();p=this._model.getLineCount();l=r+m.top+m.bottom-2*this._metrics.scrollWidth;k=h*p<l?h:l/p;if(a.rulerChanged){for(r=a.childNodes.length;1<r;)a.removeChild(a.lastChild),r--;n=n.getAnnotations(0,p);s=g.createDocumentFragment();for(var x in n)p=x>>>0,0>p||(t=b.createElement(g,"div"),r=n[x],f(r.style,t),t.style.position="absolute",
t.style.top=this._metrics.scrollWidth+h+Math.floor(p*k)+"px",r.html&&(t.innerHTML=r.html),t.annotation=r,t.lineIndex=p,s.appendChild(t));a.appendChild(s)}else if(a._oldTrackHeight!==l)for(t=a.firstChild?a.firstChild.nextSibling:null;t;)t.style.top=this._metrics.scrollWidth+h+Math.floor(t.lineIndex*k)+"px",t=t.nextSibling;a._oldTrackHeight=l}a.rulerChanged=!1;a=a.nextSibling}}},_updateStyleSheet:function(){var a="";b.isWebkit&&0<this._metrics.scrollWidth&&(a+="\n.textview ::-webkit-scrollbar-corner {background: #eeeeee;}");
b.isFirefox&&b.isMac&&this._highlightRGB&&"Highlight"!==this._highlightRGB&&(a+="\n.textview ::-moz-selection {background: "+this._highlightRGB+";}");if(a){var d=this._clientDiv.ownerDocument,c=d.getElementById("_textviewStyle");if(c)c.removeChild(c.firstChild),c.appendChild(d.createTextNode(a));else{c=b.createElement(d,"style");c.id="_textviewStyle";var e=d.getElementsByTagName("head")[0]||d.documentElement;c.appendChild(d.createTextNode(a));e.insertBefore(c,e.firstChild)}}},_updateStyle:function(a){!a&&
b.isIE&&(this._rootDiv.style.lineHeight="normal");var d=this._metrics=this._calculateMetrics();this._variableLineHeight&&(this._variableLineHeight=!1,this._resetLineHeight());this._rootDiv.style.lineHeight=b.isIE?d.lineHeight-(d.lineTrim.top+d.lineTrim.bottom)+"px":"normal";this._updateStyleSheet();a||(this.redraw(),this._resetLineWidth())}};e.EventTarget.addMixin(u.prototype);return{TextView:u}});
define("orion/editor/projectionTextModel",["orion/editor/textModel","orion/editor/eventTarget"],function(g,l){function k(e){this._model=e;this._projections=[];var c=this;this._listener={onChanged:function(e){c._onChanged(e)},onChanging:function(e){c._onChanging(e)}};e.addEventListener("postChanged",this._listener.onChanged);e.addEventListener("preChanging",this._listener.onChanging)}k.prototype={destroy:function(){this._model&&(this._model.removeEventListener("postChanged",this._listener.onChanged),
this._model.removeEventListener("preChanging",this._listener.onChanging),this._model=null)},addProjection:function(e){if(e){var c=this._model,h=this._projections;e._lineIndex=c.getLineAtOffset(e.start);e._lineCount=c.getLineAtOffset(e.end)-e._lineIndex;var b=e.text;b||(b="");e._model="string"===typeof b?new g.TextModel(b,c.getLineDelimiter()):b;var c=this.mapOffset(e.start,!0),b=e.end-e.start,f=e._lineCount,d=e._model.getCharCount(),m=e._model.getLineCount()-1,a={type:"Changing",text:e._model.getText(),
start:c,removedCharCount:b,addedCharCount:d,removedLineCount:f,addedLineCount:m};this.onChanging(a);a=this._binarySearch(h,e.start);h.splice(a,0,e);this.onChanged({type:"Changed",start:c,removedCharCount:b,addedCharCount:d,removedLineCount:f,addedLineCount:m})}},getProjections:function(){return this._projections.slice(0)},getBaseModel:function(){return this._model},mapOffset:function(e,c){var g=this._projections,b=0,f,d;if(c){for(f=0;f<g.length;f++){d=g[f];if(d.start>e)break;if(d.end>e)return-1;b+=
d._model.getCharCount()-(d.end-d.start)}return e+b}for(f=0;f<g.length;f++){d=g[f];if(d.start>e-b)break;var m=d._model.getCharCount();if(d.start+m>e-b)return-1;b+=m-(d.end-d.start)}return e-b},removeProjection:function(e){var c,g=0;for(c=0;c<this._projections.length;c++){var b=this._projections[c];if(b===e){e=b;break}g+=b._model.getCharCount()-(b.end-b.start)}if(c<this._projections.length){var b=this._model,g=e.start+g,f=e.end-e.start,d=e._lineCount,m=e._model.getCharCount(),a=e._model.getLineCount()-
1;e={type:"Changing",text:b.getText(e.start,e.end),start:g,removedCharCount:m,addedCharCount:f,removedLineCount:a,addedLineCount:d};this.onChanging(e);this._projections.splice(c,1);this.onChanged({type:"Changed",start:g,removedCharCount:m,addedCharCount:f,removedLineCount:a,addedLineCount:d})}},_binarySearch:function(e,c){for(var g=e.length,b=-1,f;1<g-b;)f=Math.floor((g+b)/2),c<=e[f].start?g=f:b=f;return g},getCharCount:function(){for(var e=this._model.getCharCount(),c=this._projections,g=0;g<c.length;g++)var b=
c[g],e=e+(b._model.getCharCount()-(b.end-b.start));return e},getLine:function(e,c){if(0>e)return null;var g=this._model,b=this._projections,f=0,d=[],m=0,a,n,p;for(a=0;a<b.length;a++){p=b[a];if(p._lineIndex>=e-f)break;n=p._model.getLineCount()-1;if(p._lineIndex+n>=e-f){m=e-(p._lineIndex+f);if(m<n)return p._model.getLine(m,c);d.push(p._model.getLine(n))}m=p.end;f+=n-p._lineCount}for(m=Math.max(m,g.getLineStart(e-f));a<b.length;a++){p=b[a];if(p._lineIndex>e-f)break;d.push(g.getText(m,p.start));n=p._model.getLineCount()-
1;if(p._lineIndex+n>e-f)return d.push(p._model.getLine(0,c)),d.join("");d.push(p._model.getText());m=p.end;f+=n-p._lineCount}b=g.getLineEnd(e-f,c);m<b&&d.push(g.getText(m,b));return d.join("")},getLineAtOffset:function(e){for(var c=this._model,g=this._projections,b=0,f=0,d=0;d<g.length;d++){var m=g[d];if(m.start>e-b)break;var a=m._model.getCharCount();if(m.start+a>e-b){g=e-(m.start+b);f+=m._model.getLineAtOffset(g);b+=g;break}f+=m._model.getLineCount()-1-m._lineCount;b+=a-(m.end-m.start)}return c.getLineAtOffset(e-
b)+f},getLineCount:function(){for(var e=this._projections,c=this._model.getLineCount(),g=0;g<e.length;g++)var b=e[g],c=c+(b._model.getLineCount()-1-b._lineCount);return c},getLineDelimiter:function(){return this._model.getLineDelimiter()},getLineEnd:function(e,c){if(0>e)return-1;for(var g=this._model,b=this._projections,f=0,d=0,m=0;m<b.length;m++){var a=b[m];if(a._lineIndex>e-f)break;var n=a._model.getLineCount()-1;if(a._lineIndex+n>e-f)return a._model.getLineEnd(e-(a._lineIndex+f),c)+a.start+d;d+=
a._model.getCharCount()-(a.end-a.start);f+=n-a._lineCount}return g.getLineEnd(e-f,c)+d},getLineStart:function(e){if(0>e)return-1;for(var c=this._model,g=this._projections,b=0,f=0,d=0;d<g.length;d++){var m=g[d];if(m._lineIndex>=e-b)break;var a=m._model.getLineCount()-1;if(m._lineIndex+a>=e-b)return m._model.getLineStart(e-(m._lineIndex+b))+m.start+f;f+=m._model.getCharCount()-(m.end-m.start);b+=a-m._lineCount}return c.getLineStart(e-b)+f},getText:function(e,c){void 0===e&&(e=0);var g=this._model,b=
this._projections,f=0,d=[],m,a,n;for(m=0;m<b.length;m++){a=b[m];if(a.start>e-f)break;n=a._model.getCharCount();if(a.start+n>e-f){if(void 0!==c&&a.start+n>c-f)return a._model.getText(e-(a.start+f),c-(a.start+f));d.push(a._model.getText(e-(a.start+f)));e=a.end+f+n-(a.end-a.start)}f+=n-(a.end-a.start)}var p=e-f;if(void 0!==c){for(;m<b.length;m++){a=b[m];if(a.start>c-f)break;d.push(g.getText(p,a.start));n=a._model.getCharCount();if(a.start+n>c-f)return d.push(a._model.getText(0,c-(a.start+f))),d.join("");
d.push(a._model.getText());p=a.end;f+=n-(a.end-a.start)}d.push(g.getText(p,c-f))}else{for(;m<b.length;m++)a=b[m],d.push(g.getText(p,a.start)),d.push(a._model.getText()),p=a.end;d.push(g.getText(p))}return d.join("")},_onChanged:function(e){e=this._change;var c=e.baseStart,g=e.baseEnd,b,f,d=this._projections;for(b=0;b<d.length&&!(f=d[b],f.end>c);b++);var m=b;for(b=0;b<d.length&&!(f=d[b],f.start>=g);b++);var a=b,n=this._model,c=e.baseText.length-(g-c);for(b=a;b<d.length;b++)f=d[b],f.start+=c,f.end+=
c,f._lineIndex=n.getLineAtOffset(f.start);f=d.splice(m,a-m);for(b=0;b<f.length;b++)f[b].annotation&&f[b].annotation._expand();this.onChanged({type:"Changed",start:e.start,removedCharCount:e.removedCharCount,addedCharCount:e.addedCharCount,removedLineCount:e.removedLineCount,addedLineCount:e.addedLineCount});this._change=void 0},_onChanging:function(e){var c=!!this._change,g=this._change||{},b=e.start,f=b+e.removedCharCount;g.baseStart=b;g.baseEnd=f;g.baseText=e.text;g.addedLineCount=e.addedLineCount;
if(!c){this._change=g;g.text=e.text;var d=this._projections,m,a,n;e=function(b){for(m=a=0;a<d.length;a++){n=d[a];if(n.start>b)break;if(n.end>b)return-1;m+=n._model.getCharCount()-(n.end-n.start)}return b+m};g.start=e(b);-1===g.start&&(g.text=this._model.getText(n.start,b)+g.text,g.addedLineCount+=this._model.getLineAtOffset(b)-this._model.getLineAtOffset(n.start),g.start=n.start+m);g.end=e(f);-1===g.end&&(g.text+=this._model.getText(f,n.end),g.addedLineCount+=this._model.getLineAtOffset(n.end)-this._model.getLineAtOffset(f),
g.end=n.start+m)}g.addedCharCount=g.text.length;g.removedCharCount=g.end-g.start;g.removedLineCount=this.getLineAtOffset(g.end)-this.getLineAtOffset(g.start);this.onChanging({type:"Changing",text:g.text,start:g.start,removedCharCount:g.removedCharCount,addedCharCount:g.addedCharCount,removedLineCount:g.removedLineCount,addedLineCount:g.addedLineCount})},onChanging:function(e){return this.dispatchEvent(e)},onChanged:function(e){return this.dispatchEvent(e)},setLineDelimiter:function(e){this._model.setLineDelimiter(e)},
setText:function(e,c,g){function b(b){for(d=m=0;m<f.length;m++){a=f[m];if(a.start>b-d)break;var c=a._model.getCharCount();if(a.start+c>b-d)return-1;d+=c-(a.end-a.start)}return b-d}this._change={text:e||"",start:c||0,end:void 0===g?this.getCharCount():g};var f=this._projections,d,m,a,n,p;e=b(this._change.start);-1===e&&(n={projection:a,start:this._change.start-(a.start+d)},e=a.end);c=b(this._change.end);-1===c&&(p={projection:a,end:this._change.end-(a.start+d)},c=a.start);n&&p&&n.projection===p.projection?
a._model.setText(this._change.text,n.start,p.end):(this._model.setText(this._change.text,e,c),n&&(a=n.projection,a._model.setText("",n.start)),p&&(a=p.projection,a._model.setText("",0,p.end),a.start=a.end,a._lineCount=0));this._change=void 0}};l.EventTarget.addMixin(k.prototype);return{ProjectionTextModel:k}});
define("orion/editor/tooltip","i18n!orion/editor/nls/messages orion/editor/textView orion/editor/textModel orion/editor/projectionTextModel orion/editor/util orion/util".split(" "),function(g,l,k,e,c,h){function b(b){this._view=b;this._fadeDelay=500;this._hideDelay=200;this._showDelay=500;this._autoHideDelay=5E3;this._create(b.getOptions("parent").ownerDocument)}b.getTooltip=function(c){c._tooltip||(c._tooltip=new b(c));return c._tooltip};b.prototype={_create:function(b){if(!this._tooltipDiv){var d=
this._tooltipDiv=h.createElement(b,"div");d.tabIndex=0;d.className="textviewTooltip";d.setAttribute("aria-live","assertive");d.setAttribute("aria-atomic","true");var e=this._tooltipContents=h.createElement(b,"div");d.appendChild(e);b.body.appendChild(d);var a=this;c.addEventListener(d,"mouseover",function(b){a._hideDelay&&(b=a._getWindow(),a._delayedHideTimeout&&(b.clearTimeout(a._delayedHideTimeout),a._delayedHideTimeout=null),a._hideTimeout&&(b.clearTimeout(a._hideTimeout),a._hideTimeout=null),
a._nextTarget=null)},!1);c.addEventListener(d,"mouseout",function(b){b=b.relatedTarget||b.toElement;!(b===d||a._hasFocus())&&(!b||!c.contains(d,b))&&a._hide()},!1);c.addEventListener(d,"keydown",function(b){27===b.keyCode&&a._hide()},!1);c.addEventListener(b,"mousedown",this._mouseDownHandler=function(b){a.isVisible()&&(c.contains(d,b.target||b.srcElement)||a._hide())},!0);this._view.addEventListener("Destroy",function(){a.destroy()});this._hide()}},_getWindow:function(){var b=this._tooltipDiv.ownerDocument;
return b.defaultView||b.parentWindow},destroy:function(){if(this._tooltipDiv){this._hide();var b=this._tooltipDiv.parentNode;b&&b.removeChild(this._tooltipDiv);c.removeEventListener(this._tooltipDiv.ownerDocument,"mousedown",this._mouseDownHandler,!0);this._tooltipDiv=null}},_hasFocus:function(){var b=this._tooltipDiv;return!b?!1:c.contains(b,b.ownerDocument.activeElement)},hide:function(b){void 0===b&&(b=this._hideDelay);var d=this._getWindow();this._delayedHideTimeout&&(d.clearTimeout(this._delayedHideTimeout),
this._delayedHideTimeout=null);var c=this;b?c._delayedHideTimeout=d.setTimeout(function(){c._delayedHideTimeout=null;c._hide();c.setTarget(c._nextTarget,0)},b):(c._hide(),c.setTarget(c._nextTarget,0))},_hide:function(){var b=this._tooltipDiv;b&&(this._hasFocus()&&this._view.focus(),this._contentsView&&(this._contentsView.destroy(),this._contentsView=null),this._tooltipContents&&(this._tooltipContents.innerHTML=""),b.style.visibility="hidden",b=this._getWindow(),this._showTimeout&&(b.clearTimeout(this._showTimeout),
this._showTimeout=null),this._delayedHideTimeout&&(b.clearTimeout(this._delayedHideTimeout),this._delayedHideTimeout=null),this._hideTimeout&&(b.clearTimeout(this._hideTimeout),this._hideTimeout=null),this._fadeTimeout&&(b.clearInterval(this._fadeTimeout),this._fadeTimeout=null))},isVisible:function(){return this._tooltipDiv&&"visible"===this._tooltipDiv.style.visibility},setTarget:function(b,d,c){if(this.isVisible())this._hasFocus()||(this._nextTarget=b,this.hide(c));else if(this._target=b){var a=
this;b=a._getWindow();a._showTimeout&&(b.clearTimeout(a._showTimeout),a._showTimeout=null);0===d?a.show(!0):a._showTimeout=b.setTimeout(function(){a._showTimeout=null;a.show(!0)},d?d:a._showDelay)}},show:function(b){if(this._target){var d=this._target.getTooltipInfo();if(d){var c=this._tooltipDiv,a=this._tooltipContents;c.style.left=c.style.right=c.style.width=c.style.height=a.style.width=a.style.height="auto";var g=d.contents;g instanceof Array&&(g=this._getAnnotationContents(g));if("string"===typeof g)a.innerHTML=
g;else if(this._isNode(g))a.appendChild(g);else if(g instanceof e.ProjectionTextModel){var h=this._view,k=h.getOptions();k.wrapMode=!1;k.parent=a;var r=k.themeClass;r?((r=r.replace("tooltipTheme",""))&&(r=" "+r),r="tooltipTheme"+r):r="tooltipTheme";k.themeClass=r;k=this._contentsView=new l.TextView(k);k.addEventListener("LineStyle",function(a){h.onLineStyle(a)});k.setModel(g);g=k.computeSize();a.style.width=g.width+"px";a.style.height=g.height+"px";k.resize()}else return;a=c.ownerDocument.documentElement;
"right"===d.anchor?(g=a.clientWidth-d.x,c.style.right=g+"px"):(g=parseInt(this._getNodeStyle(c,"padding-left","0"),10),g+=parseInt(this._getNodeStyle(c,"border-left-width","0"),10),g=d.x-g,c.style.left=g+"px");c.style.maxWidth=a.clientWidth-g-10+"px";g=parseInt(this._getNodeStyle(c,"padding-top","0"),10);g+=parseInt(this._getNodeStyle(c,"border-top-width","0"),10);g=d.y-g;c.style.top=g+"px";c.style.maxHeight=a.clientHeight-g-10+"px";c.style.opacity="1";c.style.visibility="visible";if(b){var s=this,
w=this._getWindow();s._hideTimeout=w.setTimeout(function(){s._hideTimeout=null;var a=parseFloat(s._getNodeStyle(c,"opacity","1"));s._fadeTimeout=w.setInterval(function(){"visible"===c.style.visibility&&0<a?(a-=0.1,c.style.opacity=a):s._hide()},s._fadeDelay/10)},s._autoHideDelay)}}}},_getAnnotationContents:function(b){function d(a,b){var d=v.getLineStart(v.getLineAtOffset(a)),c=v.getLineEnd(v.getLineAtOffset(b),!0);return v.getText(d,c)}function m(a){var b=a.title,e=h.createElement(l,"div");e.className=
"tooltipRow";a.html&&(e.innerHTML=a.html,e.lastChild&&c.addEventListener(e.lastChild,"click",function(b){b=a.start;var d=a.end;w.getBaseModel&&(b=w.mapOffset(b,!0),d=w.mapOffset(d,!0));s.setSelection(b,d,1/3,function(){k._hide()})},!1),e.appendChild(l.createTextNode("\u00a0")));b||(b=d(a.start,a.end));"function"===typeof b&&(b=a.title());if("string"===typeof b){var f=h.createElement(l,"span");f.appendChild(l.createTextNode(b));b=f}e.appendChild(b);return e}for(var a,n=[],p=0;p<b.length;p++)a=b[p],
""!==a.title&&!a.groupAnnotation&&n.push(a);b=n;if(0===b.length)return null;var k=this,l=this._tooltipDiv.ownerDocument,s=this._view,w=s.getModel(),v=w.getBaseModel?w.getBaseModel():w;if(1===b.length){a=b[0];if(void 0!==a.title)return a=m(a),a.firstChild&&((b=a.firstChild.className)&&(b+=" "),a.firstChild.className=b+"single"),a;b=new e.ProjectionTextModel(v);n=v.getLineStart(v.getLineAtOffset(a.start));p=v.getCharCount();a.end!==p&&b.addProjection({start:a.end,end:p});0<n&&b.addProjection({start:0,
end:n});return b}n=h.createElement(l,"div");a=h.createElement(l,"em");a.appendChild(l.createTextNode(g.multipleAnnotations));n.appendChild(a);for(p=0;p<b.length;p++)a=b[p],(a=m(a))&&n.appendChild(a);return n},_getNodeStyle:function(b,d,c){var a;if(b&&(a=b.style[d],!a))if(b.currentStyle){for(a=0;-1!==(a=d.indexOf("-",a));)d=d.substring(0,a)+d.substring(a+1,a+2).toUpperCase()+d.substring(a+2);a=b.currentStyle[d]}else a=(b=b.ownerDocument.defaultView.getComputedStyle(b,null))?b.getPropertyValue(d):null;
return a||c},_isNode:function(b){return"object"===typeof Node?b instanceof Node:b&&"object"===typeof b&&"number"===typeof b.nodeType&&"string"===typeof b.nodeName}};return{Tooltip:b}});
define("orion/editor/annotations",["i18n!orion/editor/nls/messages","orion/editor/eventTarget"],function(g,l){function k(){}function e(a,b,d){this.start=a;this.end=b;this._projectionModel=d;this.html=this._expandedHTML;this.style=this._expandedStyle;this.expanded=!0}function c(a,b){var d=a.lastIndexOf("."),d=a.substring(d+1),c={title:g[d],style:{styleClass:"annotation "+d},html:"\x3cdiv class\x3d'annotationHTML "+d+"'\x3e\x3c/div\x3e",overviewStyle:{styleClass:"annotationOverview "+d}};b?c.lineStyle=
{styleClass:"annotationLine "+d}:c.rangeStyle={styleClass:"annotationRange "+d};k.registerType(a,c)}function h(){}function b(a,b){for(var d=a.length,c=-1,e;1<d-c;)e=Math.floor((d+c)/2),b<=a[e].start?d=e:c=e;return d}function f(a){this._annotations=[];var b=this;this._listener={onChanged:function(a){b._onChanged(a)}};this.setTextModel(a)}function d(a,b){this._view=a;this._annotationModel=b;var d=this;this._listener={onDestroy:function(a){d._onDestroy(a)},onLineStyle:function(a){d._onLineStyle(a)},
onChanged:function(a){d._onAnnotationModelChanged(a)}};a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("postLineStyle",this._listener.onLineStyle);b.addEventListener("Changed",this._listener.onChanged)}e.prototype={_expandedHTML:"\x3cdiv class\x3d'annotationHTML expanded'\x3e\x3c/div\x3e",_expandedStyle:{styleClass:"annotation expanded"},_collapsedHTML:"\x3cdiv class\x3d'annotationHTML collapsed'\x3e\x3c/div\x3e",_collapsedStyle:{styleClass:"annotation collapsed"},_collapse:function(){if(!this.expanded)return!1;
this.expanded=!1;this.html=this._collapsedHTML;this.style=this._collapsedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_expand:function(){if(this.expanded)return!1;this.expanded=!0;this.html=this._expandedHTML;this.style=this._expandedStyle;this._annotationModel&&this._annotationModel.modifyAnnotation(this);return!0},_collapseImpl:function(a){if(this._collapse()){a&&this._forEachOverlaping(function(a){a.expanded||(a._expandImpl(!1),a._recollapse=!0)});a=this._projectionModel;
var b=a.getBaseModel();this._projection={annotation:this,start:b.getLineStart(b.getLineAtOffset(this.start)+1),end:b.getLineEnd(b.getLineAtOffset(this.end),!0)};a.addProjection(this._projection)}},_expandImpl:function(a){this._expand()&&(this._projectionModel.removeProjection(this._projection),a&&this._forEachOverlaping(function(a){a._recollapse&&(a._collapseImpl(!1),a._recollapse=!1)}))},_forEachOverlaping:function(a){if(this._annotationModel)for(var b=this._annotationModel.getAnnotations(this.start,
this.end);b.hasNext();){var d=b.next();d!==this&&d.type===k.ANNOTATION_FOLDING&&a.call(this,d)}},collapse:function(){this._recollapse=!1;this._collapseImpl(!0)},expand:function(){this._recollapse=!1;this._expandImpl(!0)}};k.ANNOTATION_ERROR="orion.annotation.error";k.ANNOTATION_WARNING="orion.annotation.warning";k.ANNOTATION_TASK="orion.annotation.task";k.ANNOTATION_BREAKPOINT="orion.annotation.breakpoint";k.ANNOTATION_BOOKMARK="orion.annotation.bookmark";k.ANNOTATION_FOLDING="orion.annotation.folding";
k.ANNOTATION_CURRENT_BRACKET="orion.annotation.currentBracket";k.ANNOTATION_MATCHING_BRACKET="orion.annotation.matchingBracket";k.ANNOTATION_CURRENT_LINE="orion.annotation.currentLine";k.ANNOTATION_CURRENT_SEARCH="orion.annotation.currentSearch";k.ANNOTATION_MATCHING_SEARCH="orion.annotation.matchingSearch";k.ANNOTATION_READ_OCCURRENCE="orion.annotation.readOccurrence";k.ANNOTATION_WRITE_OCCURRENCE="orion.annotation.writeOccurrence";k.ANNOTATION_SELECTED_LINKED_GROUP="orion.annotation.selectedLinkedGroup";
k.ANNOTATION_CURRENT_LINKED_GROUP="orion.annotation.currentLinkedGroup";k.ANNOTATION_LINKED_GROUP="orion.annotation.linkedGroup";k.ANNOTATION_BLAME="orion.annotation.blame";k.ANNOTATION_CURRENT_BLAME="orion.annotation.currentBlame";var m={};k.registerType=function(a,b){var d=b;"function"!==typeof d&&(d=function(a,b,d){this.start=a;this.end=b;void 0!==d&&(this.title=d)},d.prototype=b);d.prototype.type=a;m[a]=d;return a};k.createAnnotation=function(a,b,d,c){return new (this.getType(a))(b,d,c)};k.getType=
function(a){return m[a]};c(k.ANNOTATION_ERROR);c(k.ANNOTATION_WARNING);c(k.ANNOTATION_TASK);c(k.ANNOTATION_BREAKPOINT);c(k.ANNOTATION_BOOKMARK);c(k.ANNOTATION_CURRENT_BRACKET);c(k.ANNOTATION_MATCHING_BRACKET);c(k.ANNOTATION_CURRENT_SEARCH);c(k.ANNOTATION_MATCHING_SEARCH);c(k.ANNOTATION_READ_OCCURRENCE);c(k.ANNOTATION_WRITE_OCCURRENCE);c(k.ANNOTATION_SELECTED_LINKED_GROUP);c(k.ANNOTATION_CURRENT_LINKED_GROUP);c(k.ANNOTATION_LINKED_GROUP);c(k.ANNOTATION_CURRENT_LINE,!0);c(k.ANNOTATION_BLAME,!0);c(k.ANNOTATION_CURRENT_BLAME,
!0);k.registerType(k.ANNOTATION_FOLDING,e);h.addMixin=function(a){var b=h.prototype,d;for(d in b)b.hasOwnProperty(d)&&(a[d]=b[d])};h.prototype={addAnnotationType:function(a,b){this._annotationTypes||(this._annotationTypes=[]);var d=b-1;void 0==b||!(0<=d&&d<this._annotationTypes.length)?this._annotationTypes.push(a):this._annotationTypes.splice(d,0,a)},getAnnotationTypePriority:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a)return b+
1;return 0},getAnnotationsByType:function(a,b,d){a=a.getAnnotations(b,d);for(d=[];a.hasNext();)b=a.next(),0!==this.getAnnotationTypePriority(b.type)&&d.push(b);var c=this;d.sort(function(a,b){return c.getAnnotationTypePriority(a.type)-c.getAnnotationTypePriority(b.type)});return d},isAnnotationTypeVisible:function(a){return 0!==this.getAnnotationTypePriority(a)},removeAnnotationType:function(a){if(this._annotationTypes)for(var b=0;b<this._annotationTypes.length;b++)if(this._annotationTypes[b]===a){this._annotationTypes.splice(b,
1);break}}};f.prototype={addAnnotation:function(a){if(a){var d=this._annotations,c=b(d,a.start);d.splice(c,0,a);a._annotationModel=this;this.onChanged({type:"Changed",added:[a],removed:[],changed:[]})}},getTextModel:function(){return this._model},getAnnotations:function(a,b){var d=this._annotations,c,e=0,f;f=void 0===a&&void 0===b?function(){return e<d.length?d[e++]:null}:function(){for(;e<d.length;){var c=d[e++];if(a===c.start||(a>c.start?a<c.end:c.start<b))return c;if(c.start>=b)break}return null};
c=f();return{next:function(){var a=c;a&&(c=f());return a},hasNext:function(){return null!==c}}},modifyAnnotation:function(a){if(a&&!(0>this._getAnnotationIndex(a)))this.onChanged({type:"Changed",added:[],removed:[],changed:[a]})},onChanged:function(a){return this.dispatchEvent(a)},removeAnnotations:function(a){var b=this._annotations,d,c;if(a){d=[];for(c=b.length-1;0<=c;c--){var e=b[c];e.type===a&&(b.splice(c,1),d.splice(0,0,e),e._annotationModel=null)}}else d=b;this.onChanged({type:"Changed",removed:d,
added:[],changed:[]})},removeAnnotation:function(a){if(a){var b=this._getAnnotationIndex(a);0>b||(a._annotationModel=null,a={type:"Changed",removed:this._annotations.splice(b,1),added:[],changed:[]},this.onChanged(a))}},replaceAnnotations:function(a,d){var c=this._annotations,e,f,g,m=[];if(a)for(e=a.length-1;0<=e;e--)g=a[e],f=this._getAnnotationIndex(g),0>f||(g._annotationModel=null,c.splice(f,1),m.splice(0,0,g));d||(d=[]);for(e=0;e<d.length;e++)g=d[e],f=b(c,g.start),g._annotationModel=this,c.splice(f,
0,g);this.onChanged({type:"Changed",removed:m,added:d,changed:[]})},setTextModel:function(a){this._model&&this._model.removeEventListener("Changed",this._listener.onChanged);(this._model=a)&&this._model.addEventListener("Changed",this._listener.onChanged)},_getAnnotationIndex:function(a){for(var d=this._annotations,c=b(d,a.start);c<d.length&&d[c].start===a.start;){if(d[c]===a)return c;c++}return-1},_onChanged:function(a){var b=a.start,d=a.addedCharCount,c=a.removedCharCount,e=this._annotations,f=
b+c;if(0<e.length){a={type:"Changed",added:[],removed:[],changed:[],textModelChangedEvent:a};d-=c;for(c=0;c<e.length;c++){var g=e[c];g.start>=f?(g._oldStart=g.start,g._oldEnd=g.end,g.start+=d,g.end+=d,a.changed.push(g)):g.end<=b||(g.start<b&&f<g.end?(g._oldStart=g.start,g._oldEnd=g.end,g.end+=d,a.changed.push(g)):(e.splice(c,1),a.removed.push(g),g._annotationModel=null,g.expand&&g.expand(),c--))}if(0<a.added.length||0<a.removed.length||0<a.changed.length)this.onChanged(a)}}};l.EventTarget.addMixin(f.prototype);
d.prototype={destroy:function(){var a=this._view;a&&(a.removeEventListener("Destroy",this._listener.onDestroy),a.removeEventListener("LineStyle",this._listener.onLineStyle),this.view=null);(a=this._annotationModel)&&a.removeEventListener("Changed",this._listener.onChanged)},_mergeStyle:function(a,b){if(b){a||(a={});a.styleClass=a.styleClass&&b.styleClass&&a.styleClass!==b.styleClass?a.styleClass+(" "+b.styleClass):b.styleClass;var d;b.tagName&&!a.tagName&&(a.tagName=b.tagName);if(b.style)for(d in a.style||
(a.style={}),b.style)a.style[d]||(a.style[d]=b.style[d]);if(b.attributes)for(d in a.attributes||(a.attributes={}),b.attributes)a.attributes[d]||(a.attributes[d]=b.attributes[d])}return a},_mergeStyleRanges:function(a,d){a||(a=[]);for(var c,e=b(a,d.start);e<a.length&&d;e++){var f=a[e];if(d.end<=f.start)break;if(!(d.start>=f.end)){c=this._mergeStyle({},f.style);c=this._mergeStyle(c,d.style);var g=[];g.push(e,1);d.start<f.start&&g.push({start:d.start,end:f.start,style:d.style});d.start>f.start&&g.push({start:f.start,
end:d.start,style:f.style});g.push({start:Math.max(f.start,d.start),end:Math.min(f.end,d.end),style:c});d.end<f.end&&g.push({start:d.end,end:f.end,style:f.style});d=d.end>f.end?{start:f.end,end:d.end,style:d.style}:null;Array.prototype.splice.apply(a,g)}}d&&(c=this._mergeStyle({},d.style),a.splice(e,0,{start:d.start,end:d.end,style:c}));return a},_onAnnotationModelChanged:function(a){function b(a,d){f.getBaseModel&&(a=f.mapOffset(a,!0),d=f.mapOffset(d,!0));-1!==a&&-1!==d&&c.redrawRange(a,d)}function d(a,
c){for(var f=0;f<a.length;f++)if(e.isAnnotationTypeVisible(a[f].type)){var g=a[f];b(g.start,g.end);c&&void 0!==g._oldStart&&g._oldEnd&&b(g._oldStart,g._oldEnd)}}var c=this._view;if(c){var e=this,f=c.getModel();d(a.added);d(a.removed);d(a.changed,!0)}},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){var b=this._annotationModel,d=a.textView.getModel(),c=b.getTextModel(),e=a.lineStart,f=a.lineStart+a.lineText.length;c!==d&&(e=d.mapOffset(e),f=d.mapOffset(f));for(b=b.getAnnotations(e,
f);b.hasNext();)if(e=b.next(),this.isAnnotationTypeVisible(e.type)){if(e.rangeStyle){var f=e.start,g=e.end;c!==d&&(f=d.mapOffset(f,!0),g=d.mapOffset(g,!0));a.ranges=this._mergeStyleRanges(a.ranges,{start:f,end:g,style:e.rangeStyle})}e.lineStyle&&(a.style=this._mergeStyle({},a.style),a.style=this._mergeStyle(a.style,e.lineStyle))}}};h.addMixin(d.prototype);return{FoldingAnnotation:e,AnnotationType:k,AnnotationTypeList:h,AnnotationModel:f,AnnotationStyler:d}});
define("orion/editor/editor","i18n!orion/editor/nls/messages orion/editor/eventTarget orion/editor/tooltip orion/editor/annotations orion/objects orion/util".split(" "),function(g,l,k,e,c,h){function b(b){b=b||{};this._domNode=b.domNode;this._model=b.model;this._undoStack=b.undoStack;this._statusReporter=b.statusReporter;this._title=null;var a=this;this._listener={onChanged:function(b){a.onChanged(b)}};this._model&&this._model.addEventListener("Changed",this._listener.onChanged);this.checkDirty()}
function f(d){d=d||{};b.call(this,d);this._textViewFactory=d.textViewFactory;this._undoStackFactory=d.undoStackFactory;this._textDNDFactory=d.textDNDFactory;this._annotationFactory=d.annotationFactory;this._foldingRulerFactory=d.foldingRulerFactory;this._lineNumberRulerFactory=d.lineNumberRulerFactory;this._contentAssistFactory=d.contentAssistFactory;this._keyBindingFactory=d.keyBindingFactory;this._contentAssist=this._foldingRuler=this._overviewRuler=this._lineNumberRuler=this._annotationRuler=this._annotationModel=
this._annotationStyler=null}var d=e.AnnotationType;b.prototype={destroy:function(){this.uninstall();this._statusReporter=this._domNode=null;this._model&&this._model.removeEventListener("Changed",this._listener.onChanged)},checkDirty:function(){this.setDirty(this._undoStack&&!this._undoStack.isClean())},focus:function(){},getModel:function(){return this._model},getText:function(b,a){return this.getModel().getText(b,a)},getTitle:function(){return this._title},getUndoStack:function(){return this._undoStack},
install:function(){this.installed=!0},isDirty:function(){return this._dirty},markClean:function(){this.getUndoStack().markClean();this.setDirty(!1)},onDirtyChanged:function(b){return this.dispatchEvent(b)},onInputChanged:function(b){return this.dispatchEvent(b)},onChanged:function(b){this.checkDirty()},reportStatus:function(b,a,d){this._statusReporter&&this._statusReporter(b,a,d)},resize:function(){},setDirty:function(b){this._dirty!==b&&(this._dirty=b,this.onDirtyChanged({type:"DirtyChanged"}))},
_setModelText:function(b){this._model&&this._model.setText(b)},setInput:function(b,a,d,c){this._title=b;c||(a?this.reportStatus(a,"error"):null!==d&&void 0!==d&&"string"===typeof d&&this._setModelText(d),this._undoStack&&this._undoStack.reset());this.checkDirty();this.onInputChanged({type:"InputChanged",title:b,message:a,contents:d,contentsSaved:c})},setText:function(b,a,d){this.getModel().setText(b,a,d)},uninstall:function(){this.installed=!1}};l.EventTarget.addMixin(b.prototype);f.prototype=new b;
c.mixin(f.prototype,{destroy:function(){b.prototype.destroy.call(this);this._textViewFactory=this._undoStackFactory=this._textDNDFactory=this._annotationFactory=this._foldingRulerFactory=this._lineNumberRulerFactory=this._contentAssistFactory=this._keyBindingFactory=null},getAnnotationModel:function(){return this._annotationModel},getAnnotationRuler:function(){return this._annotationRuler},getAnnotationStyler:function(){return this._annotationStyler},getContentAssist:function(){return this._contentAssist},
getFoldingRuler:function(){return this._foldingRuler},getLineNumberRuler:function(){return this._lineNumberRuler},getModel:function(){if(!this._textView)return null;var b=this._textView.getModel();b.getBaseModel&&(b=b.getBaseModel());return b},getOverviewRuler:function(){return this._overviewRuler},getTextView:function(){return this._textView},getKeyModes:function(){return this._textView.getKeyModes()},getSourceCodeActions:function(){return this._sourceCodeActions},getLinkedMode:function(){return this._linkedMode},
getTextActions:function(){return this._textActions},focus:function(){this._textView&&this._textView.focus()},resize:function(){this._textView&&this._textView.resize()},setAnnotationRulerVisible:function(b,a){if(this._annotationRulerVisible!==b||a)if(this._annotationRulerVisible=b,this._annotationRuler){var d=this._textView;b?d.addRuler(this._annotationRuler,0):d.removeRuler(this._annotationRuler)}},setFoldingRulerVisible:function(b,a){if(this._foldingRulerVisible!==b||a)if(this._foldingRulerVisible=
b,this._foldingRuler){var d=this._textView;d.getModel().getBaseModel&&(b?d.addRuler(this._foldingRuler):d.removeRuler(this._foldingRuler))}},setLineNumberRulerVisible:function(b,a){if(this._lineNumberRulerVisible!==b||a)if(this._lineNumberRulerVisible=b,this._lineNumberRuler){var d=this._textView;b?d.addRuler(this._lineNumberRuler,!this._annotationRulerVisible?0:1):d.removeRuler(this._lineNumberRuler)}},setOverviewRulerVisible:function(b,a){if(this._overviewRulerVisible!==b||a)if(this._overviewRulerVisible=
b,this._overviewRuler){var d=this._textView;b?d.addRuler(this._overviewRuler):d.removeRuler(this._overviewRuler)}},mapOffset:function(b,a){var d=this._textView.getModel();d.getBaseModel&&(b=d.mapOffset(b,a));return b},getLineAtOffset:function(b){return this.getModel().getLineAtOffset(this.mapOffset(b))},getLineStart:function(b){return this.getModel().getLineStart(b)},getCaretOffset:function(){return this.mapOffset(this._textView.getCaretOffset())},getSelection:function(){var b=this._textView,a=b.getSelection(),
b=b.getModel();b.getBaseModel&&(a.start=b.mapOffset(a.start),a.end=b.mapOffset(a.end));return a},_expandOffset:function(b){var a=this._textView.getModel(),c=this._annotationModel;if(c&&a.getBaseModel)for(b=c.getAnnotations(b,b+1);b.hasNext();)a=b.next(),a.type===d.ANNOTATION_FOLDING&&a.expand&&a.expand()},setCaretOffset:function(b,a,d){var c=this._textView,e=c.getModel();e.getBaseModel&&(this._expandOffset(b),b=e.mapOffset(b,!0));c.setCaretOffset(b,a,d)},setText:function(b,a,d){var c=this._textView,
e=c.getModel();e.getBaseModel&&(void 0!==a&&(this._expandOffset(a),a=e.mapOffset(a,!0)),void 0!==d&&(this._expandOffset(d),d=e.mapOffset(d,!0)));c.setText(b,a,d)},setSelection:function(b,a,d,c){var e=this._textView,f=e.getModel();f.getBaseModel&&(this._expandOffset(b),this._expandOffset(a),b=f.mapOffset(b,!0),a=f.mapOffset(a,!0));e.setSelection(b,a,d,c)},moveSelection:function(b,a,d,c){var e=this._textView;this.setSelection(b,a||b,1/3,function(){(void 0===c||c)&&e.focus();d&&d()})},_getTooltipInfo:function(b,
a){var d=this._textView,c=this.getAnnotationModel();if(!c)return null;var e=this._annotationStyler;if(!e)return null;var f=d.getOffsetAtLocation(b,a);if(-1===f)return null;f=this.mapOffset(f);e=e.getAnnotationsByType(c,f,f+1);c=[];for(f=0;f<e.length;f++)e[f].rangeStyle&&c.push(e[f]);if(0===c.length)return null;d=d.convert({x:b,y:a},"document","page");return{contents:c,anchor:"left",x:d.x+10,y:d.y+20}},_highlightCurrentLine:function(b,a){var c=this._annotationModel;if(c){var e=this._textView;if(!e.getOptions("singleMode")){var f=
e.getModel(),g=a?f.getLineAtOffset(a.start):-1,h=f.getLineAtOffset(b.start),e=b.start===b.end,k=!a||a.start===a.end,l=f.getLineStart(h),u=f.getLineEnd(h);f.getBaseModel&&(l=f.mapOffset(l),u=f.mapOffset(u));f=this._currentLineAnnotation;if(!(g===h&&k&&e&&f&&f.start===l&&f.end===u)){var g=f?[f]:null,y;e&&(f=d.createAnnotation(d.ANNOTATION_CURRENT_LINE,l,u),y=[f]);this._currentLineAnnotation=f;c.replaceAnnotations(g,y)}}}},installTextView:function(){this.install()},install:function(){if(!this._textView){this._textView=
this._textViewFactory();this._undoStackFactory&&(this._undoStack=this._undoStackFactory.createUndoStack(this),this.checkDirty());this._textDNDFactory&&(this._textDND=this._textDNDFactory.createTextDND(this,this._undoStack));this._contentAssistFactory&&(this._contentAssist=this._contentAssistFactory.createContentAssistMode(this).getContentAssist());var c=this,a=this._textView,e=this;this._listener={onModelChanged:function(a){e.checkDirty()},onMouseOver:function(a){e._listener.onMouseMove(a)},onMouseMove:function(b){var d=
k.Tooltip.getTooltip(a);d&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY)&&(e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,d.setTarget({x:b.x,y:b.y,getTooltipInfo:function(){return e._getTooltipInfo(this.x,this.y)}}))},onMouseOut:function(b){var d=k.Tooltip.getTooltip(a);d&&!(e._listener.lastMouseX===b.event.clientX&&e._listener.lastMouseY===b.event.clientY)&&(e._listener.lastMouseX=b.event.clientX,e._listener.lastMouseY=b.event.clientY,
d.setTarget(null))},onScroll:function(b){(b=k.Tooltip.getTooltip(a))&&b.setTarget(null,0,0)},onSelection:function(a){e._updateCursorStatus();e._highlightCurrentLine(a.newValue,a.oldValue)}};a.addEventListener("ModelChanged",this._listener.onModelChanged);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("MouseOver",this._listener.onMouseOver);a.addEventListener("MouseOut",this._listener.onMouseOut);a.addEventListener("MouseMove",this._listener.onMouseMove);a.addEventListener("Scroll",
this._listener.onScroll);if(this._keyBindingFactory){var f;if(f="function"===typeof this._keyBindingFactory?this._keyBindingFactory(this,this.getKeyModes(),this._undoStack,this._contentAssist):this._keyBindingFactory.createKeyBindings(c,this._undoStack,this._contentAssist))this._textActions=f.textActions,this._linkedMode=f.linkedMode,this._sourceCodeActions=f.sourceCodeActions}f=function(a,b){if(void 0!==a&&-1!==a){for(var e=this.getView().getModel(),f=this.getAnnotationModel(),g=c.mapOffset(e.getLineStart(a)),
e=c.mapOffset(e.getLineEnd(a)),h=f.getAnnotations(g,e),n=null;h.hasNext();){var k=h.next();if(k.type===d.ANNOTATION_BOOKMARK){n=k;break}}n?f.removeAnnotation(n):(n=d.createAnnotation(d.ANNOTATION_BOOKMARK,g,e),n.title=void 0,f.addAnnotation(n))}};if(this._annotationFactory){var g=a.getModel();g.getBaseModel&&(g=g.getBaseModel());if(this._annotationModel=this._annotationFactory.createAnnotationModel(g))if(g=this._annotationStyler=this._annotationFactory.createAnnotationStyler(a,this._annotationModel))g.addAnnotationType(d.ANNOTATION_CURRENT_SEARCH),
g.addAnnotationType(d.ANNOTATION_MATCHING_SEARCH),g.addAnnotationType(d.ANNOTATION_ERROR),g.addAnnotationType(d.ANNOTATION_WARNING),g.addAnnotationType(d.ANNOTATION_MATCHING_BRACKET),g.addAnnotationType(d.ANNOTATION_CURRENT_BRACKET),g.addAnnotationType(d.ANNOTATION_CURRENT_LINE),g.addAnnotationType(d.ANNOTATION_READ_OCCURRENCE),g.addAnnotationType(d.ANNOTATION_WRITE_OCCURRENCE),g.addAnnotationType(d.ANNOTATION_SELECTED_LINKED_GROUP),g.addAnnotationType(d.ANNOTATION_CURRENT_LINKED_GROUP),g.addAnnotationType(d.ANNOTATION_LINKED_GROUP),
g.addAnnotationType("orion.annotation.highlightError");var g=this._annotationFactory.createAnnotationRulers(this._annotationModel),h=this._annotationRuler=g.annotationRuler;h&&(h.onDblClick=f,h.setMultiAnnotationOverlay({html:"\x3cdiv class\x3d'annotationHTML overlay'\x3e\x3c/div\x3e"}),h.addAnnotationType(d.ANNOTATION_ERROR),h.addAnnotationType(d.ANNOTATION_WARNING),h.addAnnotationType(d.ANNOTATION_TASK),h.addAnnotationType(d.ANNOTATION_BOOKMARK));this.setAnnotationRulerVisible(this._annotationRulerVisible||
void 0===this._annotationRulerVisible,!0);if(h=this._overviewRuler=g.overviewRuler)h.addAnnotationType(d.ANNOTATION_CURRENT_SEARCH),h.addAnnotationType(d.ANNOTATION_MATCHING_SEARCH),h.addAnnotationType(d.ANNOTATION_READ_OCCURRENCE),h.addAnnotationType(d.ANNOTATION_WRITE_OCCURRENCE),h.addAnnotationType(d.ANNOTATION_CURRENT_BLAME),h.addAnnotationType(d.ANNOTATION_ERROR),h.addAnnotationType(d.ANNOTATION_WARNING),h.addAnnotationType(d.ANNOTATION_TASK),h.addAnnotationType(d.ANNOTATION_BOOKMARK),h.addAnnotationType(d.ANNOTATION_MATCHING_BRACKET),
h.addAnnotationType(d.ANNOTATION_CURRENT_BRACKET),h.addAnnotationType(d.ANNOTATION_CURRENT_LINE);this.setOverviewRulerVisible(this._overviewRulerVisible||void 0===this._overviewRulerVisible,!0)}this._lineNumberRulerFactory&&(this._lineNumberRuler=this._lineNumberRulerFactory.createLineNumberRuler(this._annotationModel),this._lineNumberRuler.addAnnotationType(d.ANNOTATION_CURRENT_BLAME),this._lineNumberRuler.addAnnotationType(d.ANNOTATION_BLAME),this._lineNumberRuler.onDblClick=f,this.setLineNumberRulerVisible(this._lineNumberRulerVisible||
void 0===this._lineNumberRulerVisible,!0));this._foldingRulerFactory&&(this._foldingRuler=this._foldingRulerFactory.createFoldingRuler(this._annotationModel),this._foldingRuler.addAnnotationType(d.ANNOTATION_FOLDING),this.setFoldingRulerVisible(this._foldingRulerVisible||void 0===this._foldingRulerVisible,!0));this.dispatchEvent({type:"TextViewInstalled",textView:a});b.prototype.install.call(this)}},uninstallTextView:function(){this.uninstall()},uninstall:function(){var d=this._textView;d&&(d.destroy(),
this._textView=this._undoStack=this._textDND=this._contentAssist=this._listener=this._annotationModel=this._annotationStyler=this._annotationRuler=this._overviewRuler=this._lineNumberRuler=this._foldingRuler=this._currentLineAnnotation=this._title=null,this._dirty=!1,this._foldingRulerVisible=this._overviewRulerVisible=this._lineNumberRulerVisible=this._annotationRulerVisible=void 0,this.dispatchEvent({type:"TextViewUninstalled",textView:d}),b.prototype.uninstall.call(this))},_updateCursorStatus:function(){for(var b=
this.getModel(),a=this.getCaretOffset(),d=b.getLineAtOffset(a),b=b.getLineStart(d),a=a-b,b=this.getKeyModes(),c=0;c<b.length;c++){var e=b[c];if(e.isActive()&&e.isStatusActive&&e.isStatusActive())return}this.reportStatus(h.formatMessage(g.lineColumn,d+1,a+1))},showAnnotations:function(b,a,c,e){var f=this._annotationModel;if(f){for(var g=[],h=[],k=f.getTextModel(),l=f.getAnnotations(),u;l.hasNext();)u=l.next(),-1!==a.indexOf(u.type)&&u.creatorID===this&&g.push(u);if(b)for(a=0;a<b.length;a++)if(u=b[a]){if(c)u=
c(u);else{var y;"number"===typeof u.line?(y=k.getLineStart(u.line-1),l=y+u.start-1,y=y+u.end-1):(l=u.start,y=u.end);var x=e(u);if(!x)continue;u=d.createAnnotation(x,l,y,u.description)}u.creatorID=this;h.push(u)}f.replaceAnnotations(g,h)}},showProblems:function(b){this.showAnnotations(b,[d.ANNOTATION_ERROR,d.ANNOTATION_WARNING,d.ANNOTATION_TASK],null,function(a){switch(a.severity){case "error":return d.ANNOTATION_ERROR;case "warning":return d.ANNOTATION_WARNING;case "task":return d.ANNOTATION_TASK}return null})},
showOccurrences:function(b){this.showAnnotations(b,[d.ANNOTATION_READ_OCCURRENCE,d.ANNOTATION_WRITE_OCCURRENCE],null,function(a){return a.readAccess?d.ANNOTATION_READ_OCCURRENCE:d.ANNOTATION_WRITE_OCCURRENCE})},showBlame:function(b){var a=this._blameRGB,f=this.getTextView().getOptions("parent").ownerDocument;if(!a){var k=h.createElement(f,"div");k.className="annotation blame";f.body.appendChild(k);var l=(f.defaultView||f.parentWindow).getComputedStyle(k).getPropertyValue("background-color");k.parentNode.removeChild(k);
var k=l.indexOf("("),r=l.indexOf(")"),l=l.substring(k+1,r);this._blameRGB=a=l.split(",").slice(0,3)}var s=function(){var a=e.AnnotationType.createAnnotation(this.groupType,this.start,this.end,this.title);a.style=c.mixin({},a.style);a.style.style=c.mixin({},a.style.style);a.style.style.backgroundColor="";this.groupAnnotation=a;a.blame=this.blame;a.html=this.html;a.creatorID=this.creatorID;return a},w=function(){var a=h.createElement(f,"div");a.className="tooltipTitle";var b=this.blame.Message.indexOf("\n");
-1===b&&(b=this.blame.Message.length);var d=h.createElement(f,"a");d.href=this.blame.CommitLink;d.appendChild(f.createTextNode(this.blame.Message.substring(0,b)));a.appendChild(d);a.appendChild(h.createElement(f,"br"));a.appendChild(f.createTextNode(h.formatMessage(g.committerOnTime,this.blame.AuthorName,this.blame.Time)));return a},v=this.getModel();this.showAnnotations(b,[d.ANNOTATION_BLAME,d.ANNOTATION_CURRENT_BLAME],function(b){var f=v.getLineStart(b.Start-1),g=v.getLineEnd(b.End-1,!0),f=e.AnnotationType.createAnnotation(d.ANNOTATION_BLAME,
f,g,w),g=a.slice(0);g.push(b.Shade);f.style=c.mixin({},f.style);f.style.style=c.mixin({},f.style.style);f.style.style.backgroundColor="rgba("+g.join()+")";f.groupId=b.Name;f.groupType=d.ANNOTATION_CURRENT_BLAME;f.createGroupAnnotation=s;f.html='\x3cimg class\x3d"annotationHTML blame" src\x3d"'+b.AuthorImage+'"/\x3e';f.blame=b;return f})},showSelection:function(b,a,d,c,e){"number"===typeof b?("number"!==typeof a&&(a=b),this.moveSelection(b,a)):"number"===typeof d&&(b=this.getModel().getLineStart(d-
1),"number"===typeof c&&(b+=c),"number"!==typeof e&&(e=0),this.moveSelection(b,b+e))},_setModelText:function(b){this._textView&&(this._textView.setText(b),this._textView.getModel().setLineDelimiter("auto"),this._highlightCurrentLine(this._textView.getSelection()))},setInput:function(d,a,c,e,f){b.prototype.setInput.call(this,d,a,c,e);this._textView&&!e&&!f&&this._textView.focus()},onGotoLine:function(b,a,d,c){if(this._textView){var e=this.getModel();b=Math.max(0,Math.min(b,e.getLineCount()-1));var f=
e.getLineStart(b),g=0;void 0===d&&(d=0);"string"===typeof a?(b=e.getLine(b).indexOf(a),-1!==b&&(g=b,d=g+a.length)):(g=a,a=e.getLineEnd(b)-f,g=Math.min(g,a),d=Math.min(d,a));this.moveSelection(f+g,f+d,c)}}});return{BaseEditor:b,Editor:f}});
define("orion/editor/find","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/regex orion/objects orion/util".split(" "),function(g,l,k,e,c,h,b){function f(a){var b=a.getTextView();k.KeyMode.call(this,b);this.editor=a;this._active=!1;this._success=!0;this._ignoreSelection=!1;this._prefix="";b.setAction("incrementalFindCancel",function(){this.setActive(!1);return!0}.bind(this));b.setAction("incrementalFindBackspace",function(){return this._backspace()}.bind(this));
var d=this;this._listener={onVerify:function(a){var b=d.editor,e=b.getModel(),f=b.mapOffset(a.start),b=b.mapOffset(a.end),e=e.getText(f,b);if((e=d._prefix.match(RegExp("^"+c.escape(e),"i")))&&0<e.length)d._prefix+=a.text,d._success=!0,d._status(),d.find(d._forward,!0),a.text=null},onSelection:function(){d._ignoreSelection||d.setActive(!1)}}}function d(a,b,d){if(a){this._editor=a;this._undoStack=b;this._showAll=!0;this._visible=!1;this._wrap=this._caseInsensitive=!0;this._wholeWord=!1;this._incremental=
!0;this._regex=!1;this._findAfterReplace=!0;this._reverse=this._hideAfterFind=!1;this._timer=this._end=this._start=void 0;this._lastString="";var c=this;this._listeners={onEditorFocus:function(a){c._removeCurrentAnnotation(a)}};this.setOptions(d)}}var m={};f.prototype=new k.KeyMode;h.mixin(f.prototype,{createKeyBindings:function(){var a=l.KeyBinding,b=[];b.push({actionID:"incrementalFindBackspace",keyBinding:new a(8)});b.push({actionID:"incrementalFindCancel",keyBinding:new a(13)});b.push({actionID:"incrementalFindCancel",
keyBinding:new a(27)});b.push({actionID:"incrementalFindReverse",keyBinding:new a(38)});b.push({actionID:"incrementalFind",keyBinding:new a(40)});b.push({actionID:"incrementalFindReverse",keyBinding:new a("k",!0,!0)});b.push({actionID:"incrementalFind",keyBinding:new a("k",!0)});return b},find:function(a,b){this._forward=a;if(!this.isActive())return this.setActive(!0),!1;var d=this._prefix;if(0===d.length)return!1;var c=this.editor,e=c.getModel(),e=a?this._success?b?this._start:c.getCaretOffset()+
1:0:this._success?b?this._start:c.getCaretOffset():e.getCharCount()-1;(d=c.getModel().find({string:d,start:e,reverse:!a,caseInsensitive:d.toLowerCase()===d}).next())?(b||(this._start=e),this._ignoreSelection=this._success=!0,c.moveSelection(a?d.start:d.end,a?d.end:d.start),this._ignoreSelection=!1):this._success=!1;this._status();return!0},isActive:function(){return this._active},isStatusActive:function(){return this.isActive()},setActive:function(a){this._active!==a&&(this._active=a,this._prefix=
"",this._success=!0,a=this.editor.getTextView(),this._start=this.editor.getCaretOffset(),this.editor.setCaretOffset(this._start),this._active?(a.addEventListener("Verify",this._listener.onVerify),a.addEventListener("Selection",this._listener.onSelection),a.addKeyMode(this)):(a.removeEventListener("Verify",this._listener.onVerify),a.removeEventListener("Selection",this._listener.onSelection),a.removeKeyMode(this)),this._status())},_backspace:function(){var a=this._prefix,a=this._prefix=a.substring(0,
a.length-1);return 0===a.length?(this._ignoreSelection=this._success=!0,this.editor.setCaretOffset(this.editor.getSelection().start),this._ignoreSelection=!1,this._status(),!0):this.find(this._forward,!0)},_status:function(){if(this.isActive()){var a;a=this._forward?this._success?g.incrementalFindStr:g.incrementalFindStrNotFound:this._success?g.incrementalFindReverseStr:g.incrementalFindReverseStrNotFound;a=b.formatMessage(a,this._prefix);this.editor.reportStatus(a,this._success?"":"error")}else this.editor.reportStatus("")}});
m.IncrementalFind=f;d.prototype={find:function(a,b,d){this.setOptions({reverse:!a});var c=this.getFindString(),e;b&&(c=b.findString||c,e=b.count);a=this.getOptions();this.setOptions(b);b=d?this._startOffset:this.getStartOffset();if((e=this._doFind(c,b,e))&&!d)this._startOffset=e.start;this.setOptions(a);this._hideAfterFind&&this.hide();return e},getStartOffset:function(){return void 0!==this._start?this._start:this._reverse?this._editor.getSelection().start-1:this._editor.getCaretOffset()},getFindString:function(){var a=
this._editor.getSelection(),a=this._editor.getText(a.start,a.end);this._regex&&(a=c.escape(a));return a||this._lastString},getOptions:function(){return{showAll:this._showAll,caseInsensitive:this._caseInsensitive,wrap:this._wrap,wholeWord:this._wholeWord,incremental:this._incremental,regex:this._regex,findAfterReplace:this._findAfterReplace,hideAfterFind:this._hideAfterFind,reverse:this._reverse,findCallback:this._findCallback,start:this._start,end:this._end}},getReplaceString:function(){return""},
hide:function(){this._visible=!1;this._savedOptions&&(this.setOptions(this._savedOptions.pop()),0===this._savedOptions.length&&(this._savedOptions=null));this._removeAllAnnotations();var a=this._editor.getTextView();a&&(a.removeEventListener("Focus",this._listeners.onEditorFocus),a.focus())},_processReplaceString:function(a){var b=a;if(this._regex){for(var b="",d=!1,c=this._editor.getModel().getLineDelimiter(),e=0;e<a.length;e++){var f=a.substring(e,e+1);if(d){switch(f){case "R":b+=c;break;case "r":b+=
"\r";break;case "n":b+="\n";break;case "t":b+="\t";break;case "\\":b+="\\";break;default:b+="\\"+f}d=!1}else"\\"===f?d=!0:b+=f}d&&(b+="\\")}return b},isVisible:function(){return this._visible},replace:function(){var a=this.getFindString();if(a){var b=this._editor,d=this._processReplaceString(this.getReplaceString()),c=b.getSelection().start;if(b=b.getModel().find({string:a,start:c,reverse:!1,wrap:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive}).next())this.startUndo(),
this._doReplace(b.start,b.end,a,d),this.endUndo()}this._findAfterReplace&&a&&this._doFind(a,this.getStartOffset())},replaceAll:function(){var a=this.getFindString();if(a){this._replacingAll=!0;var d=this._editor,c=d.getTextView();d.reportStatus(g.replaceAll);var e=this._processReplaceString(this.getReplaceString()),f=this;window.setTimeout(function(){for(var h=0,m=0;;){var k=f._doFind(a,h,null,!0);if(!k)break;m++;1===m&&(c.setRedraw(!1),f.startUndo());f._doReplace(k.start,k.end,a,e);h=f.getStartOffset()}0<
m&&(f.endUndo(),c.setRedraw(!0));0<h?d.reportStatus(b.formatMessage(g.replacedMatches,m)):d.reportStatus(g.nothingReplaced,"error");f._replacingAll=!1},100)}},setOptions:function(a){if(a){if((!0===a.showAll||!1===a.showAll)&&this._showAll!==a.showAll)if(this._showAll=a.showAll,this.isVisible())if(this._showAll)this._markAllOccurrences();else{var b=this._editor.getAnnotationModel();b&&b.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH)}if(!0===a.caseInsensitive||!1===a.caseInsensitive)this._caseInsensitive=
a.caseInsensitive;if(!0===a.wrap||!1===a.wrap)this._wrap=a.wrap;if(!0===a.wholeWord||!1===a.wholeWord)this._wholeWord=a.wholeWord;if(!0===a.incremental||!1===a.incremental)this._incremental=a.incremental;if(!0===a.regex||!1===a.regex)this._regex=a.regex;if(!0===a.findAfterReplace||!1===a.findAfterReplace)this._findAfterReplace=a.findAfterReplace;if(!0===a.hideAfterFind||!1===a.hideAfterFind)this._hideAfterFind=a.hideAfterFind;if(!0===a.reverse||!1===a.reverse)this._reverse=a.reverse;a.hasOwnProperty("findCallback")&&
(this._findCallback=a.findCallback);a.hasOwnProperty("start")&&(this._start=a.start);a.hasOwnProperty("end")&&(this._end=a.end)}},show:function(a){this._visible=!0;a&&(this._savedOptions||(this._savedOptions=[]),this._savedOptions.push(this.getOptions()),this.setOptions(a));this._startOffset=this._editor.getSelection().start;this._editor.getTextView().addEventListener("Focus",this._listeners.onEditorFocus);var b=this;window.setTimeout(function(){b._incremental&&b.find(!0,null,!0)},0)},startUndo:function(){this._undoStack&&
this._undoStack.startCompoundChange()},endUndo:function(){this._undoStack&&this._undoStack.endCompoundChange()},_find:function(a,b,d){return this._editor.getModel().find({string:a,start:b,end:this._end,reverse:this._reverse,wrap:d?!1:this._wrap,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive})},_doFind:function(a,b,d,c){d=d||1;var f=this._editor;if(!a)return this._removeAllAnnotations(),null;this._lastString=a;var h,m;if(this._regex)try{m=this._find(a,b,c)}catch(k){f.reportStatus(k.message,
"error");return}else m=this._find(a,b,c);for(a=0;a<d&&m.hasNext();a++)h=m.next();if(!this._replacingAll){h?this._editor.reportStatus(""):this._editor.reportStatus(g.notFound,"error");if(this.isVisible()){d=e.AnnotationType.ANNOTATION_CURRENT_SEARCH;if(m=f.getAnnotationModel())m.removeAnnotations(d),h&&m.addAnnotation(e.AnnotationType.createAnnotation(d,h.start,h.end));if(this._showAll){this._timer&&window.clearTimeout(this._timer);var l=this;this._timer=window.setTimeout(function(){l._markAllOccurrences();
l._timer=null},500)}}this._findCallback?this._findCallback(h):h&&f.moveSelection(h.start,h.end,null,!1)}return h},_doReplace:function(a,b,d,c){var e=this._editor;if(!this._regex||!(c=e.getText(a,b).replace(RegExp(d,this._caseInsensitive?"i":""),c),!c))e.setText(c,a,b),e.setSelection(a,a+c.length,!0)},_markAllOccurrences:function(){var a=this._editor.getAnnotationModel();if(a){for(var b=e.AnnotationType.ANNOTATION_MATCHING_SEARCH,d=a.getAnnotations(),c=[],f;d.hasNext();){var g=d.next();g.type===b&&
c.push(g)}if(this.isVisible()){d=this.getFindString();d=this._editor.getModel().find({string:d,regex:this._regex,wholeWord:this._wholeWord,caseInsensitive:this._caseInsensitive});for(f=[];d.hasNext();)g=d.next(),f.push(e.AnnotationType.createAnnotation(b,g.start,g.end))}a.replaceAnnotations(c,f)}},_removeAllAnnotations:function(){var a=this._editor.getAnnotationModel();a&&(a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH),a.removeAnnotations(e.AnnotationType.ANNOTATION_MATCHING_SEARCH))},
_removeCurrentAnnotation:function(a){(a=this._editor.getAnnotationModel())&&a.removeAnnotations(e.AnnotationType.ANNOTATION_CURRENT_SEARCH)}};m.Find=d;return m});
define("orion/editor/actions","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/annotations orion/editor/tooltip orion/editor/find orion/util".split(" "),function(g,l,k,e,c,h){function b(a,b,d){this.editor=a;this.undoStack=b;this._incrementalFind=new c.IncrementalFind(a);this._find=d?d:new c.Find(a,b);this._lastEditLocation=null;this.init()}function f(a,b,d,c){this.editor=a;this.undoStack=b;this.contentAssist=d;this.linkedMode=c;this.contentAssist&&this.contentAssist.addEventListener("ProposalApplied",
this.contentAssistProposalApplied.bind(this));this.init()}var d=k.AnnotationType,m={};b.prototype={init:function(){var a=this.editor.getTextView();this._lastEditListener={onModelChanged:function(a){this.editor.isDirty()&&(this._lastEditLocation=a.start+a.addedCharCount)}.bind(this)};a.addEventListener("ModelChanged",this._lastEditListener.onModelChanged);a.setAction("undo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.undo(),--b;return!0}return!1}.bind(this),
{name:g.undo});a.setAction("redo",function(a){if(this.undoStack){var b=1;for(a&&a.count&&(b=a.count);0<b;)this.undoStack.redo(),--b;return!0}return!1}.bind(this),{name:g.redo});a.setKeyBinding(new l.KeyBinding("f",!0),"find");a.setAction("find",function(){if(this._find){var a=this.editor.getSelection();(a=prompt(g.find,this.editor.getText(a.start,a.end)))&&this._find.find(!0,{findString:a})}}.bind(this),{name:g.find});a.setKeyBinding(new l.KeyBinding("k",!0),"findNext");a.setAction("findNext",function(a){return this._find?
(this._find.find(!0,a),!0):!1}.bind(this),{name:g.findNext});a.setKeyBinding(new l.KeyBinding("k",!0,!0),"findPrevious");a.setAction("findPrevious",function(a){return this._find?(this._find.find(!1,a),!0):!1}.bind(this),{name:g.findPrevious});a.setKeyBinding(new l.KeyBinding("j",!0),"incrementalFind");a.setAction("incrementalFind",function(){this._incrementalFind&&this._incrementalFind.find(!0);return!0}.bind(this),{name:g.incrementalFind});a.setKeyBinding(new l.KeyBinding("j",!0,!0),"incrementalFindReverse");
a.setAction("incrementalFindReverse",function(){this._incrementalFind&&this._incrementalFind.find(!1);return!0}.bind(this),{name:g.incrementalFindReverse});a.setAction("tab",function(){return this.indentLines()}.bind(this));a.setAction("shiftTab",function(){return this.unindentLines()}.bind(this),{name:g.unindentLines});a.setKeyBinding(new l.KeyBinding(38,!1,!1,!0),"moveLinesUp");a.setAction("moveLinesUp",function(){return this.moveLinesUp()}.bind(this),{name:g.moveLinesUp});a.setKeyBinding(new l.KeyBinding(40,
!1,!1,!0),"moveLinesDown");a.setAction("moveLinesDown",function(){return this.moveLinesDown()}.bind(this),{name:g.moveLinesDown});a.setKeyBinding(new l.KeyBinding(38,!0,!1,!0),"copyLinesUp");a.setAction("copyLinesUp",function(){return this.copyLinesUp()}.bind(this),{name:g.copyLinesUp});a.setKeyBinding(new l.KeyBinding(40,!0,!1,!0),"copyLinesDown");a.setAction("copyLinesDown",function(){return this.copyLinesDown()}.bind(this),{name:g.copyLinesDown});a.setKeyBinding(new l.KeyBinding("d",!0,!1,!1),
"deleteLines");a.setAction("deleteLines",function(a){return this.deleteLines(a)}.bind(this),{name:g.deleteLines});a.setKeyBinding(new l.KeyBinding("l",!h.isMac,!1,!1,h.isMac),"gotoLine");a.setAction("gotoLine",function(){return this.gotoLine()}.bind(this),{name:g.gotoLine});a.setKeyBinding(new l.KeyBinding(190,!0),"nextAnnotation");a.setAction("nextAnnotation",function(){return this.nextAnnotation(!0)}.bind(this),{name:g.nextAnnotation});a.setKeyBinding(new l.KeyBinding(188,!0),"previousAnnotation");
a.setAction("previousAnnotation",function(){return this.nextAnnotation(!1)}.bind(this),{name:g.prevAnnotation});a.setKeyBinding(new l.KeyBinding("e",!0,!1,!0,!1),"expand");a.setAction("expand",function(){return this.expandAnnotation(!0)}.bind(this),{name:g.expand});a.setKeyBinding(new l.KeyBinding("c",!0,!1,!0,!1),"collapse");a.setAction("collapse",function(){return this.expandAnnotation(!1)}.bind(this),{name:g.collapse});a.setKeyBinding(new l.KeyBinding("e",!0,!0,!0,!1),"expandAll");a.setAction("expandAll",
function(){return this.expandAnnotations(!0)}.bind(this),{name:g.expandAll});a.setKeyBinding(new l.KeyBinding("c",!0,!0,!0,!1),"collapseAll");a.setAction("collapseAll",function(){return this.expandAnnotations(!1)}.bind(this),{name:g.collapseAll});a.setKeyBinding(new l.KeyBinding("q",!h.isMac,!1,!1,h.isMac),"lastEdit");a.setAction("lastEdit",function(){return this.gotoLastEdit()}.bind(this),{name:g.lastEdit})},copyLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),c=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),e=b.getLineStart(c),c=b.getLineEnd(d,!0),f=b.getLineCount(),g="",e=b.getText(e,c);d===f-1&&(e=(g=b.getLineDelimiter())+e);a.setText(e,c,c);a.setSelection(c+g.length,c+e.length);return!0},copyLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getLineAtOffset(d.start),d=b.getLineAtOffset(d.end>d.start?d.end-
1:d.end),c=b.getLineStart(c),e=b.getLineEnd(d,!0),f=b.getLineCount(),g="",e=b.getText(c,e);d===f-1&&(e+=g=b.getLineDelimiter());a.setText(e,c,c);a.setSelection(c,c+e.length-g.length);return!0},deleteLines:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=1;a&&a.count&&(d=a.count);var c=b.getSelection(),e=b.getModel(),f=e.getLineAtOffset(c.start);a=e.getLineStart(f);d=c.start!==c.end||1===d?e.getLineAtOffset(c.end>c.start?c.end-1:c.end):Math.min(f+d-1,e.getLineCount()-
1);d=e.getLineEnd(d,!0);b.setText("",a,d);return!0},expandAnnotation:function(a){var b=this.editor,d=b.getAnnotationModel();if(!d)return!0;var c=b.getModel(),e=b.getCaretOffset(),f=c.getLineAtOffset(e),e=c.getLineStart(f),f=c.getLineEnd(f,!0);c.getBaseModel&&(e=c.mapOffset(e),f=c.mapOffset(f),c.getBaseModel());for(var g,d=d.getAnnotations(e,f);!g&&d.hasNext();)c=d.next(),c.type===k.AnnotationType.ANNOTATION_FOLDING&&(g=c);g&&a!==g.expanded&&(a?g.expand():(b.setCaretOffset(g.start),g.collapse()));
return!0},expandAnnotations:function(a){var b=this.editor,d=b.getTextView(),b=b.getAnnotationModel();if(!b)return!0;var c=b.getAnnotations();for(d.setRedraw(!1);c.hasNext();)b=c.next(),b.type===k.AnnotationType.ANNOTATION_FOLDING&&a!==b.expanded&&(a?b.expand():b.collapse());d.setRedraw(!0);return!0},indentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){var d=a.getModel(),c=a.getSelection(),e=d.getLineAtOffset(c.start),f=d.getLineAtOffset(c.end>
c.start?c.end-1:c.end);if(e!==f){var g=[];g.push("");for(var h=e;h<=f;h++)g.push(d.getLine(h,!0));h=d.getLineStart(e);d=d.getLineEnd(f,!0);b=b.getOptions("tabSize","expandTab");b=b.expandTab?Array(b.tabSize+1).join(" "):"\t";a.setText(g.join(b),h,d);a.setSelection(h===c.start?c.start:c.start+b.length,c.end+(f-e+1)*b.length);return!0}return!1}},gotoLastEdit:function(){"number"===typeof this._lastEditLocation&&this.editor.showSelection(this._lastEditLocation);return!0},gotoLine:function(){var a=this.editor,
b=a.getModel().getLineAtOffset(a.getCaretOffset());if(b=prompt(g.gotoLinePrompty,b+1))b=parseInt(b,10),a.onGotoLine(b-1,0);return!0},moveLinesDown:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getLineAtOffset(d.start),e=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineCount();if(e===f-1)return!0;var c=b.getLineStart(c),d=b.getLineEnd(e,!0),g=b.getLineEnd(e+1,!0)-(d-c),h=0;e!==f-2?b=b.getText(c,d):(e=b.getLineEnd(e),
b=b.getText(e,d)+b.getText(c,e),h+=d-e);this.startUndo();a.setText("",c,d);a.setText(b,g,g);a.setSelection(g+h,g+h+b.length);this.endUndo();return!0},moveLinesUp:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getLineAtOffset(d.start);if(0===c)return!0;var e=b.getLineAtOffset(d.end>d.start?d.end-1:d.end),f=b.getLineCount(),d=b.getLineStart(c-1),g=b.getLineStart(c),h=b.getLineEnd(e,!0),m=b.getText(g,h),k=0;e===f-1&&(e=b.getLineEnd(c-
1),c=b.getLineEnd(c-1,!0),m+=b.getText(e,c),g=e,k=c-e);this.startUndo();a.setText("",g,h);a.setText(m,d,d);a.setSelection(d,d+m.length-k);this.endUndo();return!0},nextAnnotation:function(a){function b(a){return!!a.lineStyle||a.type===d.ANNOTATION_MATCHING_BRACKET||a.type===d.ANNOTATION_CURRENT_BRACKET||!g.isAnnotationTypeVisible(a.type)}var c=this.editor,f=c.getAnnotationModel();if(!f)return!0;var g=c.getOverviewRuler()||c.getAnnotationStyler();if(!g)return!0;for(var h=c.getModel(),m=c.getCaretOffset(),
k=f.getAnnotations(a?m:0,a?h.getCharCount():m),l=null;k.hasNext();){var y=k.next();if(a){if(y.start<=m)continue}else if(y.start>=m)continue;if(!b(y)&&(l=y,a))break}if(l){for(var x=[l],k=f.getAnnotations(l.start,l.start);k.hasNext();)y=k.next(),y!==l&&!b(y)&&x.push(y);var z=c.getTextView(),q=h.getLineAtOffset(l.start),A=e.Tooltip.getTooltip(z);if(!A)return c.moveSelection(l.start),!0;c.moveSelection(l.start,l.start,function(){A.setTarget({getTooltipInfo:function(){var a=z.convert({x:z.getLocationAtOffset(l.start).x,
y:z.getLocationAtOffset(h.getLineStart(q)).y},"document","page");return{contents:x,x:a.x,y:a.y+Math.floor(1.33*z.getLineHeight(q))}}},0)})}return!0},unindentLines:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;if(b.getOptions("tabMode")){for(var d=a.getModel(),c=a.getSelection(),e=d.getLineAtOffset(c.start),f=d.getLineAtOffset(c.end>c.start?c.end-1:c.end),g=b.getOptions("tabSize"),h=Array(g+1).join(" "),m=[],k=b=0,l=e;l<=f;l++){var z=d.getLine(l,!0);if(d.getLineStart(l)!==
d.getLineEnd(l))if(0===z.indexOf("\t"))z=z.substring(1),b++;else if(0===z.indexOf(h))z=z.substring(g),b+=g;else return!0;l===e&&(k=b);m.push(z)}e=d.getLineStart(e);g=d.getLineEnd(f,!0);d=d.getLineStart(f);a.setText(m.join(""),e,g);f=e===c.start?c.start:c.start-k;c=Math.max(f,c.end-b+(c.end===d+1&&c.start!==c.end?1:0));a.setSelection(f,c);return!0}},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()}};m.TextActions=
b;f.prototype={init:function(){var a=this.editor.getTextView();a.setAction("lineStart",function(){return this.lineStart()}.bind(this));a.setAction("enter",function(){return this.autoIndent()}.bind(this));a.setKeyBinding(new l.KeyBinding("t",!0,!1,!0),"trimTrailingWhitespaces");a.setAction("trimTrailingWhitespaces",function(){return this.trimTrailingWhitespaces()}.bind(this),{name:g.trimTrailingWhitespaces});a.setKeyBinding(new l.KeyBinding(191,!0),"toggleLineComment");a.setAction("toggleLineComment",
function(){return this.toggleLineComment()}.bind(this),{name:g.toggleLineComment});a.setKeyBinding(new l.KeyBinding(191,!0,!h.isMac,!1,h.isMac),"addBlockComment");a.setAction("addBlockComment",function(){return this.addBlockComment()}.bind(this),{name:g.addBlockComment});a.setKeyBinding(new l.KeyBinding(220,!0,!h.isMac,!1,h.isMac),"removeBlockComment");a.setAction("removeBlockComment",function(){return this.removeBlockComment()}.bind(this),{name:g.removeBlockComment});a.setKeyBinding(new l.KeyBinding("[",
!1,!1,!1,!1,"keypress"),"autoPairSquareBracket");a.setAction("autoPairSquareBracket",function(){return this.autoPairBrackets("[","]")}.bind(this));a.setKeyBinding(new l.KeyBinding("]",!1,!1,!1,!1,"keypress"),"skipClosingSquareBracket");a.setAction("skipClosingSquareBracket",function(){return this.skipClosingBracket("]")}.bind(this));a.setKeyBinding(new l.KeyBinding("\x3c",!1,!1,!1,!1,"keypress"),"autoPairAngleBracket");a.setAction("autoPairAngleBracket",function(){return this.autoPairBrackets("\x3c",
"\x3e")}.bind(this));a.setKeyBinding(new l.KeyBinding("\x3e",!1,!1,!1,!1,"keypress"),"skipClosingAngleBracket");a.setAction("skipClosingAngleBracket",function(){return this.skipClosingBracket("\x3e")}.bind(this));a.setKeyBinding(new l.KeyBinding("(",!1,!1,!1,!1,"keypress"),"autoPairParentheses");a.setAction("autoPairParentheses",function(){return this.autoPairBrackets("(",")")}.bind(this));a.setKeyBinding(new l.KeyBinding(")",!1,!1,!1,!1,"keypress"),"skipClosingParenthesis");a.setAction("skipClosingParenthesis",
function(){return this.skipClosingBracket(")")}.bind(this));a.setKeyBinding(new l.KeyBinding("{",!1,!1,!1,!1,"keypress"),"autoPairBraces");a.setAction("autoPairBraces",function(){return this.autoPairBrackets("{","}")}.bind(this));a.setKeyBinding(new l.KeyBinding("}",!1,!1,!1,!1,"keypress"),"skipClosingBrace");a.setAction("skipClosingBrace",function(){return this.skipClosingBracket("}")}.bind(this));a.setKeyBinding(new l.KeyBinding("'",!1,!1,!1,!1,"keypress"),"autoPairSingleQuotation");a.setAction("autoPairSingleQuotation",
function(){return this.autoPairQuotations("'")}.bind(this));a.setKeyBinding(new l.KeyBinding('"',!1,!1,!1,!1,"keypress"),"autoPairDblQuotation");a.setAction("autoPairDblQuotation",function(){return this.autoPairQuotations('"')}.bind(this));a.setAction("deletePrevious",function(){return this.deletePrevious()}.bind(this))},autoIndent:function(){var a=this.editor,b=a.getTextView();if(b.getOptions("readonly"))return!1;var d=a.getSelection();if(d.start===d.end){for(var c=a.getModel(),e=c.getLineAtOffset(d.start),
f=c.getLine(e,!1),g=c.getLineStart(e),h=0,m=d.start-g,k;h<m&&(32===(k=f.charCodeAt(h))||9===k);)h++;var g=f.substring(0,h),b=b.getOptions("tabSize","expandTab"),l=b.expandTab?Array(b.tabSize+1).join(" "):"\t",b=c.getLineDelimiter(),z=/^[\s]*\/\*[\*]*[\s]*$/,q=/^[\s]*\*/,A=/\*\/[\s]*$/,B=f.substring(0,m),C=f.substring(m),I;if(this.smartIndentation&&123===f.charCodeAt(I=B.trimRight().length-1))return c=m-I-1,C=C.length-C.trimLeft().length,f=125===f.charCodeAt(m+C)?b+g+l+b+g:b+g+l,a.setText(f,d.start-
c,d.end+C),a.setCaretOffset(d.start+b.length+g.length+l.length-c),!0;if(this.autoCompleteComments&&!A.test(B)&&(z.test(B)||q.test(B))){if(z.exec(B)){f=b+g+" * ";f=A.test(C)?f+C.substring(0,C.length-2).trim():f+C.trim();if(c.getLineCount()===e+1||!q.test(c.getLine(e+1)))f+=b+g+" */";a.setText(f,d.start,d.end+C.length);a.setCaretOffset(d.start+b.length+g.length+3);return!0}if(q.exec(B))for(e-=1;0<=e;e--){h=c.getLine(e,!1);if(z.test(h))return A.test(C)||47===f.charCodeAt(m)?(f=b+g+"*"+C,g=d.start+b.length+
g.length+1):(f=b+g+"* "+C,g=d.start+b.length+g.length+2),a.setText(f,d.start,d.end+C.length),a.setCaretOffset(g),!0;if(!q.test(h))break}}else{if(A.test(B)&&32===g.charCodeAt(g.length-1))return f=b+g.substring(0,g.length-1),a.setText(f,d.start,d.end),a.setCaretOffset(d.start+f.length),!0;if(0<h){for(h=m;h<f.length&&(32===(k=f.charCodeAt(h++))||9===k);)d.end++;a.setText(c.getLineDelimiter()+g,d.start,d.end);return!0}}}return!1},addBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;
var b=a.getModel(),d=a.getSelection(),c=this._findEnclosingComment(b,d.start,d.end);if(void 0!==c.commentStart&&void 0!==c.commentEnd)return!0;b=b.getText(d.start,d.end);if(0===b.length)return!0;var c=b.length,b=b.replace(/\/\*|\*\//g,""),e=b.length;a.setText("/*"+b+"*/",d.start,d.end);a.setSelection(d.start+2,d.end+2+(e-c));return!0},autoPairBrackets:function(a,b){if("["===a&&!this.autoPairSquareBrackets||"{"===a&&!this.autoPairBraces||"("===a&&!this.autoPairParentheses||"\x3c"===a&&!this.autoPairAngleBrackets)return!1;
var d=this.editor;if(d.getTextView().getOptions("readonly"))return!1;var c=d.getSelection(),e=d.getModel(),f=d.getCaretOffset()===e.getCharCount()?"":e.getText(c.start,c.start+1).trim(),g=/^$|[)}\]>]/;return c.start===c.end&&g.test(f)?(d.setText(a+b,c.start,c.start),d.setCaretOffset(c.start+1),!0):c.start!==c.end?(e=e.getText(c.start,c.end),d.setText(a+e+b,c.start,c.end),d.setSelection(c.start+1,c.end+1),!0):!1},autoPairQuotations:function(a){if(!this.autoPairQuotation)return!1;var b=this.editor;
if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),c=b.getModel(),e=b.getCaretOffset(),f=0===e?"":c.getText(d.start-1,d.start).trim(),g=e===c.getCharCount()?"":c.getText(d.start,d.start+1).trim(),e=/^"$|^'$/,h=/\w/,m=/^$|[)}\]>]/;if(d.start!==d.end){c=c.getText(d.start,d.end);if(e.test(c))return!1;b.setText(a+c+a,d.start,d.end);b.setSelection(d.start+1,d.end+1)}else{if(g!==a){if(f===a||e.test(g)||h.test(f)||!m.test(g))return!1;b.setText(a+a,d.start,d.start)}b.setCaretOffset(d.start+
1)}return!0},contentAssistProposalApplied:function(a){a=a.data.proposal;if(a.positions&&0<a.positions.length&&this.linkedMode){for(var b=[],d=0;d<a.positions.length;++d)b[d]={positions:[{offset:a.positions[d].offset,length:a.positions[d].length}]};this.linkedMode.enterLinkedMode({groups:b,escapePosition:a.escapePosition})}else a.groups&&0<a.groups.length&&this.linkedMode?this.linkedMode.enterLinkedMode({groups:a.groups,escapePosition:a.escapePosition}):a.escapePosition&&this.editor.getTextView().setCaretOffset(a.escapePosition);
return!0},deletePrevious:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getSelection();if(b.start!==b.end)return!1;var d=a.getModel(),c=a.getCaretOffset(),e=0===c?"":d.getText(b.start-1,b.start),d=c===d.getCharCount()?"":d.getText(b.start,b.start+1);("("===e&&")"===d||"["===e&&"]"===d||"{"===e&&"}"===d||"\x3c"===e&&"\x3e"===d||'"'===e&&'"'===d||"'"===e&&"'"===d)&&a.setText("",b.start,b.start+1);return!1},_findEnclosingComment:function(a,b,d){var c=a.getLineAtOffset(b),
e=a.getLineAtOffset(d),f,g,h,m,k,l;for(f=c;0<=f&&!(g=a.getLine(f),h=f===c?b-a.getLineStart(c):g.length,m=g.lastIndexOf("/*",h),g=g.lastIndexOf("*/",h),g>m);f--)if(-1!==m){k=a.getLineStart(f)+m;break}for(f=e;f<a.getLineCount()&&!(g=a.getLine(f),h=f===e?d-a.getLineStart(e):0,m=g.indexOf("/*",h),g=g.indexOf("*/",h),-1!==m&&m<g);f++)if(-1!==g){l=a.getLineStart(f)+g;break}return{commentStart:k,commentEnd:l}},lineStart:function(){for(var a=this.editor,b=a.getModel(),d=a.getCaretOffset(),c=b.getLineAtOffset(d),
e=b.getLineStart(c),b=b.getLine(c),c=0;c<b.length;c++){var f=b.charCodeAt(c);if(!(32===f||9===f))break}c+=e;return d!==c?(a.setSelection(c,c),!0):!1},removeBlockComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;var b=a.getModel(),d=a.getSelection(),c=b.getText(d.start,d.end),e,f,g;for(g=0;g<c.length;g++)if("/*"===c.substring(g,g+2)){e=d.start+g;break}for(;g<c.length;g++)if("*/"===c.substring(g,g+2)){f=d.start+g;break}if(void 0!==e&&void 0!==f)a.setText(b.getText(e+
2,f),e,f+2),a.setSelection(e,f);else{c=this._findEnclosingComment(b,d.start,d.end);if(void 0===c.commentStart||void 0===c.commentEnd)return!0;b=b.getText(c.commentStart+2,c.commentEnd);a.setText(b,c.commentStart,c.commentEnd+2);a.setSelection(d.start-2,d.end-2)}return!0},toggleLineComment:function(){var a=this.editor;if(a.getTextView().getOptions("readonly"))return!1;for(var b=this.lineComment||"//",d=a.getModel(),c=a.getSelection(),e=d.getLineAtOffset(c.start),f=d.getLineAtOffset(c.end>c.start?c.end-
1:c.end),g=!0,h=[],m,k,l=e;l<=f;l++)if(m=d.getLine(l,!0),h.push(m),!g||-1===(k=m.indexOf(b)))g=!1;else if(0!==k){var z;for(z=0;z<k;z++){var q=m.charCodeAt(z);if(!(32===q||9===q))break}g=z===k}q=b.length;l=d.getLineStart(e);z=d.getLineEnd(f,!0);if(g){for(g=0;g<h.length;g++)m=h[g],k=m.indexOf(b),h[g]=m.substring(0,k)+m.substring(k+q);b=h.join("");h=d.getLineStart(f);d=l===c.start?c.start:c.start-q;c=c.end-q*(f-e+1)+(c.end===h+1?q:0)}else h.splice(0,0,""),b=h.join(b),d=l===c.start?c.start:c.start+q,
c=c.end+q*(f-e+1);a.setText(b,l,z);a.setSelection(d,c);return!0},trimTrailingWhitespaces:function(){var a=this.editor,b=a.getModel(),d=a.getSelection();a.getTextView().setRedraw(!1);a.getUndoStack().startCompoundChange();for(var c=/(\s+$)/,e=b.getLineCount(),f=0;f<e;f++){var g=b.getLine(f),h=c.exec(g);if(h){var m=b.getLineStart(f),g=h[0].length,h=m+h.index;b.setText("",h,h+g);d.start>h&&(d.start=Math.max(h,d.start-g));d.start!==d.end&&d.end>h&&(d.end=Math.max(h,d.end-g))}}a.getUndoStack().endCompoundChange();
a.getTextView().setRedraw(!0);a.setSelection(d.start,d.end,!1)},startUndo:function(){this.undoStack&&this.undoStack.startCompoundChange()},skipClosingBracket:function(a){var b=this.editor;if(b.getTextView().getOptions("readonly"))return!1;var d=b.getSelection(),c=b.getModel();return(b.getCaretOffset()===c.getCharCount()?"":c.getText(d.start,d.start+1))===a?(b.setCaretOffset(d.start+1),!0):!1},endUndo:function(){this.undoStack&&this.undoStack.endCompoundChange()},setAutoPairParentheses:function(a){this.autoPairParentheses=
a},setAutoPairBraces:function(a){this.autoPairBraces=a},setAutoPairSquareBrackets:function(a){this.autoPairSquareBrackets=a},setAutoPairAngleBrackets:function(a){this.autoPairAngleBrackets=a},setAutoPairQuotations:function(a){this.autoPairQuotation=a},setAutoCompleteComments:function(a){this.autoCompleteComments=a},setLineComment:function(a){this.lineComment=a},setSmartIndentation:function(a){this.smartIndentation=a}};m.SourceCodeActions=f;String.prototype.trimLeft||(String.prototype.trimLeft=function(){return this.replace(/^\s+/g,
"")});String.prototype.trimRight||(String.prototype.trimRight=function(){return this.replace(/\s+$/g,"")});return m});
define("orion/editor/undoStack",[],function(){function g(e,c,g,b,f){this.model=e;this.offset=c;this.text=g;this.previousText=b;this.type=f}function l(e){this.owner=e;this.changes=[]}function k(e,c){this.size=void 0!==c?c:100;this.reset();var g=this;this._listener={onChanging:function(b){g._onChanging(b)},onDestroy:function(b){g._onDestroy(b)}};if(e.getModel){var b=e.getModel();b.getBaseModel&&(b=b.getBaseModel());this.model=b;this.setView(e)}else this.shared=!0,this.model=e;this.model.addEventListener("Changing",
this._listener.onChanging)}g.prototype={getRedoChanges:function(){return[{start:this.offset,end:this.offset+this.previousText.length,text:this.text}]},getUndoChanges:function(){return[{start:this.offset,end:this.offset+this.text.length,text:this.previousText}]},undo:function(e,c){this._doUndoRedo(this.offset,this.previousText,this.text,e,c);return!0},redo:function(e,c){this._doUndoRedo(this.offset,this.text,this.previousText,e,c);return!0},merge:function(e,c,g,b,f){if(b===this.type){if(1===b&&e===
this.offset+this.text.length)return this.text+=c,!0;if(-1===b&&f===this.offset)return this.offset=e,this.previousText=g+this.previousText,!0;if(-1===b&&e===this.offset)return this.previousText+=g,!0}return!1},_doUndoRedo:function(e,c,g,b,f){this.model.setText(c,e,e+g.length);f&&b&&(g=b.getModel(),g!==this.model&&(e=g.mapOffset(e,!0)),b.setSelection(e,e+c.length))}};l.prototype={getRedoChanges:function(){for(var e=[],c=0;c<this.changes.length;c++)e=e.concat(this.changes[c].getRedoChanges());return e},
getUndoChanges:function(){for(var e=[],c=this.changes.length-1;0<=c;c--)e=e.concat(this.changes[c].getUndoChanges());return e},add:function(e){this.changes.push(e)},end:function(e){e&&(this.endSelection=e.getSelection(),this.endCaret=e.getCaretOffset());(e=this.owner)&&e.end&&e.end()},undo:function(e,c){1<this.changes.length&&e&&e.setRedraw(!1);for(var g=this.changes.length-1;0<=g;g--)this.changes[g].undo(e,!1);1<this.changes.length&&e&&e.setRedraw(!0);if(c&&e){var g=this.startSelection.start,b=this.startSelection.end;
e.setSelection(this.startCaret?g:b,this.startCaret?b:g)}(g=this.owner)&&g.undo&&g.undo();return 0<this.changes.length},redo:function(e,c){1<this.changes.length&&e&&e.setRedraw(!1);for(var g=0;g<this.changes.length;g++)this.changes[g].redo(e,!1);(1<this.changes.length,e)&&e.setRedraw(!0);if(c&&e){var g=this.endSelection.start,b=this.endSelection.end;e.setSelection(this.endCaret?g:b,this.endCaret?b:g)}(g=this.owner)&&g.redo&&g.redo();return 0<this.changes.length},merge:function(e,c,g,b,f){var d=this.changes.length;
return 0<d?this.changes[d-1].merge(e,c,g,b,f):!1},start:function(e){e&&(this.startSelection=e.getSelection(),this.startCaret=e.getCaretOffset());(e=this.owner)&&e.start&&e.start()}};k.prototype={destroy:function(){this._onDestroy()},add:function(e){this.compoundChange?this.compoundChange.add(e):(this.stack.splice(this.index,this.stack.length-this.index,e),this.index++,this.stack.length>this.size&&(this.stack.shift(),this.index--))},markClean:function(){this._commitUndo();if(this.cleanChange=this.stack[this.index-
1])this.cleanChange.type=2},isClean:function(){return this.cleanChange===this.stack[this.index-1]},canUndo:function(){return 0<this.index},canRedo:function(){return 0<this.stack.length-this.index},endCompoundChange:function(){this.compoundChange&&this.compoundChange.end(this.view);this.compoundChange=void 0},getSize:function(){return{undo:this.index,redo:this.stack.length-this.index}},getRedoChanges:function(){this._commitUndo();for(var e=[],c=this.index;c<this.stack.length;c++)e=e.concat(this.stack[c].getRedoChanges());
return e},getUndoChanges:function(){this._commitUndo();for(var e=[],c=this.index;0<=c;c--)e=e.concat(this.stack[c].getUndoChanges());return e},undo:function(){this._commitUndo();var e;e=!1;this._ignoreUndo=!0;do{if(0>=this.index)break;e=this.stack[--this.index]}while(!(e=e.undo(this.view,!0)));this._ignoreUndo=!1;return e},redo:function(){this._commitUndo();var e;this._ignoreUndo=!0;do{if(this.index>=this.stack.length)break;e=this.stack[this.index++]}while(!e.redo(this.view,!0));this._ignoreUndo=
!1;return!0},reset:function(){this.index=0;this.cleanChange=void 0;this.stack=[];this._ignoreUndo=!1;this._compoundChange=void 0},setView:function(e){this.view!==e&&(this.view&&e.removeEventListener("Destroy",this._listener.onDestroy),(this.view=e)&&e.addEventListener("Destroy",this._listener.onDestroy))},startCompoundChange:function(e){this._commitUndo();e=new l(e);this.add(e);this.compoundChange=e;this.compoundChange.start(this.view);return this.compoundChange},_commitUndo:function(){this.endCompoundChange()},
_onDestroy:function(e){(!e||!this.shared)&&this.model.removeEventListener("Changing",this._listener.onChanging);this.view&&(this.view.removeEventListener("Destroy",this._listener.onDestroy),this.view=null)},_onChanging:function(e){if(!this._ignoreUndo){var c=e.text,h=e.start,b=e.addedCharCount,f=e.removedCharCount;e=h+f;var d=0;0===b&&1===f?d=-1:1===b&&0===f&&(d=1);b=this.stack.length;f=this.model.getText(h,e);(!(0<b&&this.index===b)||!this.stack[b-1].merge(h,c,f,d,e))&&this.add(new g(this.model,
h,c,f,d))}}};return{UndoStack:k}});
define("orion/editor/rulers",["i18n!orion/editor/nls/messages","orion/editor/annotations","orion/editor/tooltip","orion/util"],function(g,l,k,e){function c(b,a,d,c){this._location=a||"left";this._overview=d||"page";this._rulerStyle=c;this._view=null;var e=this;this._listener={onTextModelChanged:function(a){e._onTextModelChanged(a)},onAnnotationModelChanged:function(a){e._onAnnotationModelChanged(a)}};this.setAnnotationModel(b)}function h(b,a,d,e,f){c.call(this,b,a,"page",d);this._oddStyle=e||{style:{backgroundColor:"white"}};
this._evenStyle=f||{style:{backgroundColor:"white"}};this._numOfDigits=0;this._firstLine=1}function b(b,a,d){c.call(this,b,a,"page",d)}function f(b,a,d){c.call(this,b,a,"document",d)}function d(d,a,c){b.call(this,d,a,c)}c.prototype={getAnnotations:function(b,a){var d=this._annotationModel;if(!d)return[];var c=this._view.getModel(),e=c.getLineStart(b),f=c.getLineEnd(a-1),g=c;c.getBaseModel&&(g=c.getBaseModel(),e=c.mapOffset(e),f=c.mapOffset(f));for(var h=[],d=this.getAnnotationsByType(d,e,f),e=0;e<
d.length;e++)for(var f=d[e],k=g.getLineAtOffset(f.start),l=g.getLineAtOffset(Math.max(f.start,f.end-1)),y=k;y<=l;y++){var x=y;if(c!==g){x=g.getLineStart(y);x=c.mapOffset(x,!0);if(-1===x)continue;x=c.getLineAtOffset(x)}if(b<=x&&x<a){var z=this._mergeAnnotation(h[x],f,y-k,l-k+1);z&&(h[x]=z)}}if(!this._multiAnnotation&&this._multiAnnotationOverlay)for(var q in h)h[q]._multiple&&(h[q].html+=this._multiAnnotationOverlay.html);return h},getAnnotationModel:function(){return this._annotationModel},getLocation:function(){return this._location},
getOverview:function(){return this._overview},getRulerStyle:function(){return this._rulerStyle},getView:function(){return this._view},getWidestAnnotation:function(){return null},setAnnotationModel:function(b){this._annotationModel&&this._annotationModel.removEventListener("Changed",this._listener.onAnnotationModelChanged);(this._annotationModel=b)&&this._annotationModel.addEventListener("Changed",this._listener.onAnnotationModelChanged)},setMultiAnnotation:function(b){this._multiAnnotation=b},setMultiAnnotationOverlay:function(b){this._multiAnnotationOverlay=
b},setView:function(b){this._onTextModelChanged&&this._view&&this._view.removeEventListener("ModelChanged",this._listener.onTextModelChanged);this._view=b;this._onTextModelChanged&&this._view&&this._view.addEventListener("ModelChanged",this._listener.onTextModelChanged)},onClick:function(b,a){if(void 0!==b){var d=this._view,c=d.getModel(),e=c,f=c.getLineStart(b),g=f,h=f,l=this._annotationModel;if(l){d=d.getSelection();h=c.getLineEnd(b,!0);f<=d.start&&d.start<h&&(f=d.start);c.getBaseModel&&(f=c.mapOffset(f),
h=c.mapOffset(h),e=c.getBaseModel());for(var u,h=l.getAnnotations(f,h),l=null;!u&&h.hasNext();)d=h.next(),this.isAnnotationTypeVisible(d.type)&&(l=d,d.start<=f||(u=d));l&&void 0!==l.groupId&&(this._currentClickGroup=this._currentClickGroup===l.groupId?null:l.groupId,this._setCurrentGroup(b));u&&e.getLineAtOffset(u.start)===e.getLineAtOffset(f)?(f=u.start,h=u.end):h=f=g;c.getBaseModel&&(f=c.mapOffset(f,!0),h=c.mapOffset(h,!0))}(c=k.Tooltip.getTooltip(this._view))&&c.setTarget(null);this._view.setSelection(h,
f,1/3,function(){})}},onDblClick:function(b,a){},onMouseMove:function(b,a){var d=k.Tooltip.getTooltip(this._view);if(d&&!(d.isVisible()&&this._tooltipLineIndex===b)){this._tooltipLineIndex=b;var c=this;d.setTarget({y:a.clientY,getTooltipInfo:function(){return c._getTooltipInfo(c._tooltipLineIndex,this.y)}})}},onMouseOver:function(b,a){this.onMouseMove(b,a);this._currentClickGroup||this._setCurrentGroup(b)},onMouseOut:function(b,a){this._currentClickGroup||this._setCurrentGroup(-1);var d=k.Tooltip.getTooltip(this._view);
d&&d.setTarget(null)},_getTooltipInfo:function(b,a){if(void 0!==b){var d=this._view,c=d.getModel(),e=this._annotationModel,f=[];if(e){var f=c.getLineStart(b),g=c.getLineEnd(b);c.getBaseModel&&(f=c.mapOffset(f),g=c.mapOffset(g));f=this.getAnnotationsByType(e,f,g)}e=this._getTooltipContents(b,f);if(!e)return null;e={contents:e,anchor:this.getLocation()};f=d.getClientArea();"document"===this.getOverview()?f.y=d.convert({y:a},"view","document").y:f.y=d.getLocationAtOffset(c.getLineStart(b)).y;d.convert(f,
"document","page");e.x=f.x;e.y=f.y;"right"===e.anchor&&(e.x+=f.width);return e}},_getTooltipContents:function(b,a){return a},_onAnnotationModelChanged:function(b){function a(a){for(var b=0;b<a.length;b++)if(e.isAnnotationTypeVisible(a[b].type)){var f=a[b].start,g=a[b].end;c.getBaseModel&&(f=c.mapOffset(f,!0),g=c.mapOffset(g,!0));-1!==f&&-1!==g&&d.redrawLines(c.getLineAtOffset(f),c.getLineAtOffset(Math.max(f,g-1))+1,e)}}var d=this._view;if(d){var c=d.getModel(),e=this,f=c.getLineCount();b.textModelChangedEvent?
(b=b.textModelChangedEvent.start,c.getBaseModel&&(b=c.mapOffset(b,!0)),b=c.getLineAtOffset(b),d.redrawLines(b,f,e)):(a(b.added),a(b.removed),a(b.changed))}},_mergeAnnotation:function(b,a,d,c){b||(b={});0===d&&(b.html&&a.html?(a.html!==b.html&&!b._multiple&&this._multiAnnotation&&(b.html=this._multiAnnotation.html),b._multiple=!0):b.html=a.html);b.style=this._mergeStyle(b.style,a.style);return b},_mergeStyle:function(b,a){if(a){b||(b={});b.styleClass=b.styleClass&&a.styleClass&&b.styleClass!==a.styleClass?
b.styleClass+(" "+a.styleClass):a.styleClass;var d;if(a.style)for(d in b.style||(b.style={}),a.style)void 0===b.style[d]&&(b.style[d]=a.style[d]);if(a.attributes)for(d in b.attributes||(b.attributes={}),a.attributes)void 0===b.attributes[d]&&(b.attributes[d]=a.attributes[d])}return b},_setCurrentGroup:function(b){var a=this._annotationModel,d=null,c=a.getTextModel(),e,f=this._currentGroupAnnotation;if(-1!==b){var g=c.getLineStart(b),h=c.getLineEnd(b);c.getBaseModel&&(g=c.mapOffset(g),h=c.mapOffset(h));
for(e=a.getAnnotations(g,h);e.hasNext();)if(c=e.next(),this.isAnnotationTypeVisible(c.type)&&c.start<=g&&c.end>=h&&void 0!==c.groupId){d=c;break}if(f&&d&&f.groupId===d.groupId)return}this._currentGroupAnnotation=null;f&&a.removeAnnotations(f.groupType);if(d&&-1!==b){this._currentGroupAnnotation=d;e=a.getAnnotations();for(b=[];e.hasNext();)c=e.next(),delete c.groupAnnotation,c.groupId===d.groupId&&(c=c.createGroupAnnotation(),b.push(c));a.replaceAnnotations(null,b)}}};l.AnnotationTypeList.addMixin(c.prototype);
h.prototype=new c;h.prototype.getAnnotations=function(b,a){for(var d=c.prototype.getAnnotations.call(this,b,a),e=this._view.getModel(),f=b;f<a;f++){var g=f&1?this._oddStyle:this._evenStyle,h=f;e.getBaseModel&&(h=e.getLineStart(h),h=e.getBaseModel().getLineAtOffset(e.mapOffset(h)));d[f]||(d[f]={});d[f].html=this._firstLine+h+"";d[f].style||(d[f].style=g)}return d};h.prototype.getWidestAnnotation=function(){var b=this._view.getModel().getLineCount();return this.getAnnotations(b-1,b)[b-1]};h.prototype.setFirstLine=
function(b){this._firstLine=void 0!==b?b:1};h.prototype._onTextModelChanged=function(b){var a=b.start;b=this._view.getModel();var d=b.getBaseModel?b.getBaseModel().getLineCount():b.getLineCount(),d=(this._firstLine+d-1+"").length;this._numOfDigits!==d&&(this._numOfDigits=d,a=b.getLineAtOffset(a),this._view.redrawLines(a,b.getLineCount(),this))};b.prototype=new c;f.prototype=new c;f.prototype.getRulerStyle=function(){return this._mergeStyle({style:{lineHeight:"1px",fontSize:"1px"}},this._rulerStyle)};
f.prototype._getTooltipContents=function(b,a){if(0===a.length){var d=this._view.getModel(),f=b;d.getBaseModel&&(f=d.getLineStart(f),f=d.getBaseModel().getLineAtOffset(d.mapOffset(f)));return e.formatMessage(g.line,f+1)}return c.prototype._getTooltipContents.call(this,b,a)};f.prototype._mergeAnnotation=function(b,a,d,c){if(0===d)return b||(b={html:"\x26nbsp;",style:{style:{height:3*c+"px"}}},b.style=this._mergeStyle(b.style,a.overviewStyle)),b};d.prototype=new b;d.prototype.onClick=function(b,a){if(void 0!==
b){var d=this._annotationModel;if(d){var c=this._view.getModel(),e=c.getLineStart(b),f=c.getLineEnd(b,!0);c.getBaseModel&&(e=c.mapOffset(e),f=c.mapOffset(f),c=c.getBaseModel());for(var g,d=d.getAnnotations(e,f);!g&&d.hasNext();)f=d.next(),this.isAnnotationTypeVisible(f.type)&&c.getLineAtOffset(f.start)===c.getLineAtOffset(e)&&(g=f);g&&((c=k.Tooltip.getTooltip(this._view))&&c.setTarget(null),g.expanded?g.collapse():g.expand())}}};d.prototype._getTooltipContents=function(d,a){if(0<a.length){var c=this._view.getModel(),
e=c.getLineStart(d);c.getBaseModel&&(e=c.mapOffset(e),c=c.getBaseModel());for(var e=c.getLineAtOffset(e),f=0;f<a.length;f++){var g=a[f];if(this.isAnnotationTypeVisible(g.type)&&c.getLineAtOffset(g.start)===e){if(a[f].expanded)break;return b.prototype._getTooltipContents.call(this,d,[g])}}}return null};d.prototype._onAnnotationModelChanged=function(d){function a(a){for(g=0;g<a.length;g++)if(f.isAnnotationTypeVisible(a[g].type)){var b=a[g].start;e.getBaseModel&&(b=e.mapOffset(b,!0));-1!==b&&(k=Math.min(k,
e.getLineAtOffset(b)))}}if(d.textModelChangedEvent)b.prototype._onAnnotationModelChanged.call(this,d);else{var c=this._view;if(c){var e=c.getModel(),f=this,g,h=e.getLineCount(),k=h;a(d.added);a(d.removed);a(d.changed);d=c.getRulers();for(g=0;g<d.length;g++)c.redrawLines(k,h,d[g])}}};return{Ruler:c,AnnotationRuler:b,LineNumberRuler:h,OverviewRuler:f,FoldingRuler:d}});
define("orion/editor/textDND",["orion/util"],function(g){function l(g,e){this._view=g;this._undoStack=e;this._dragSelection=null;this._dropOffset=-1;this._dropText=null;var c=this;this._listener={onDragStart:function(e){c._onDragStart(e)},onDragEnd:function(e){c._onDragEnd(e)},onDragEnter:function(e){c._onDragEnter(e)},onDragOver:function(e){c._onDragOver(e)},onDrop:function(e){c._onDrop(e)},onDestroy:function(e){c._onDestroy(e)}};g.addEventListener("DragStart",this._listener.onDragStart);g.addEventListener("DragEnd",
this._listener.onDragEnd);g.addEventListener("DragEnter",this._listener.onDragEnter);g.addEventListener("DragOver",this._listener.onDragOver);g.addEventListener("Drop",this._listener.onDrop);g.addEventListener("Destroy",this._listener.onDestroy)}l.prototype={destroy:function(){var g=this._view;g&&(g.removeEventListener("DragStart",this._listener.onDragStart),g.removeEventListener("DragEnd",this._listener.onDragEnd),g.removeEventListener("DragEnter",this._listener.onDragEnter),g.removeEventListener("DragOver",
this._listener.onDragOver),g.removeEventListener("Drop",this._listener.onDrop),g.removeEventListener("Destroy",this._listener.onDestroy),this._view=null)},_onDestroy:function(g){this.destroy()},_onDragStart:function(g){var e=this._view,c=e.getSelection(),e=e.getModel();e.getBaseModel&&(c.start=e.mapOffset(c.start),c.end=e.mapOffset(c.end),e=e.getBaseModel());if(e=e.getText(c.start,c.end))this._dragSelection=c,g.event.dataTransfer.effectAllowed="copyMove",g.event.dataTransfer.setData("Text",e)},_onDragEnd:function(k){if(this._dragSelection){var e=
this._view,c=k.event.dataTransfer.dropEffect;if(!g.isFirefox&&("none"!==c||this._dropText))c=k.event.dataTransfer.dropEffect=this._dropEffect;this._undoStack&&this._undoStack.startCompoundChange();(k="move"===c)&&e.setText("",this._dragSelection.start,this._dragSelection.end);if(this._dropText){var c=this._dropText,h=this._dropOffset;k&&(h>=this._dragSelection.end?h-=this._dragSelection.end-this._dragSelection.start:h>=this._dragSelection.start&&(h=this._dragSelection.start));e.setText(c,h,h);e.setSelection(h,
h+c.length);this._dropText=null;this._dropOffset=-1}this._undoStack&&this._undoStack.endCompoundChange()}this._dragSelection=null},_onDragEnter:function(g){this._onDragOver(g)},_onDragOver:function(k){var e=k.event.dataTransfer.types,c=!this._view.getOptions("readonly");c&&e&&(c=e.contains?e.contains("text/plain")||e.contains("Text"):-1!==e.indexOf("text/plain")||-1!==e.indexOf("Text"));c?g.isFirefox||(this._dropEffect=k.event.dataTransfer.dropEffect=(g.isMac?k.event.altKey:k.event.ctrlKey)?"copy":
"move"):k.event.dataTransfer.dropEffect="none"},_onDrop:function(k){var e=this._view,c=k.event.dataTransfer.getData("Text");c&&(g.isFirefox||(k.event.dataTransfer.dropEffect=this._dropEffect),k=e.getOffsetAtLocation(k.x,k.y),this._dragSelection?(this._dropOffset=k,this._dropText=c):(e.setText(c,k,k),e.setSelection(k,k+c.length)))}};return{TextDND:l}});
define("orion/editor/templates",[],function(){function g(g,e,c,h){this.prefix=g;this.description=e;this.template=c;this.name=h;this._parse()}function l(g,e){this._keywords=g||[];this._templates=[];this.addTemplates(e||[])}g.prototype={getProposal:function(g,e,c){g=e-g.length;e={};var h,b=void 0!==c.delimiter?c.delimiter:"\n";c.indentation&&(b+=c.indentation);var f=void 0!==c.tab?c.tab:"\t",d=0,m=this.variables,a=this.segments;c=[];for(var l=0;l<a.length;l++){var p=a[l],t=m[p];if(void 0!==t)switch(p){case "${tab}":p=
f;break;case "${delimiter}":p=b;break;case "${cursor}":p="";h=d;break;default:var r=e[p];r||(r=e[p]={data:t.data,positions:[]});p=t.substitution;r.data&&r.data.values&&(p=r.data.values[0]);r.positions.push({offset:g+d,length:p.length})}c.push(p);d+=p.length}var b=[],s;for(s in e)e.hasOwnProperty(s)&&b.push(e[s]);c=c.join("");void 0===h&&(h=c.length);return{proposal:c,name:this.name,description:this.description,groups:b,escapePosition:g+h,style:"noemphasis"}},match:function(g){return 0===this.prefix.indexOf(g)},
_parse:function(){var g=this.template,e=[],c={},h,b=0,g=g.replace(/\n/g,"${delimiter}"),g=g.replace(/\t/g,"${tab}");g.replace(/\$\{((?:[^\\}]+|\\.))*\}/g,function(f,d,m){var a=f.substring(2,f.length-1);d=f;var l=a,p=null,t=l.indexOf(":");-1!==t&&(l=l.substring(0,t),d="${"+l+"}",p=JSON.parse(a.substring(t+1).replace("\\}","}").trim()));(a=c[d])||(a=c[d]={});a.substitution=l;p&&(a.data=p);(h=g.substring(b,m))&&e.push(h);e.push(d);b=m+f.length;return l});(h=g.substring(b,g.length))&&e.push(h);this.segments=
e;this.variables=c}};l.prototype={addTemplates:function(k){for(var e=this.getTemplates(),c=0;c<k.length;c++)e.push(new g(k[c].prefix,k[c].description,k[c].template,k[c].name))},computeProposals:function(g,e,c){var h=this.getPrefix(g,e,c),b=[];this.isValid(h,g,e,c)&&(b=b.concat(this.getTemplateProposals(h,e,c)),b=b.concat(this.getKeywordProposals(h)));return b},getKeywords:function(){return this._keywords},getKeywordProposals:function(g){var e=[],c=this.getKeywords();if(c){for(var h=0;h<c.length;h++)0===
c[h].indexOf(g)&&e.push({proposal:c[h].substring(g.length),description:c[h],style:"noemphasis_keyword"});0<e.length&&e.splice(0,0,{proposal:"",description:"Keywords",style:"noemphasis_title_keywords",unselectable:!0})}return e},getPrefix:function(g,e,c){return c.prefix},getTemplates:function(){return this._templates},getTemplateProposals:function(g,e,c){for(var h=[],b=this.getTemplates(),f=0;f<b.length;f++){var d=b[f];d.match(g)&&(d=d.getProposal(g,e,c),this.removePrefix(g,d),h.push(d))}0<h.length&&
(h.sort(function(b,a){return b.name<a.name?-1:b.name>a.name?1:0}),h.splice(0,0,{proposal:"",description:"Templates",style:"noemphasis_title",unselectable:!0}));return h},removePrefix:function(g,e){if(!(e.overwrite=e.proposal.substring(0,g.length)!==g))e.proposal=e.proposal.substring(g.length)},isValid:function(g,e,c,h){return!0}};return{Template:g,TemplateContentAssist:l}});
define("orion/editor/linkedMode","i18n!orion/editor/nls/messages orion/keyBinding orion/editor/keyModes orion/editor/annotations orion/editor/templates orion/objects orion/util".split(" "),function(g,l,k,e,c,h){function b(b,c,a){var e=b.getTextView();k.KeyMode.call(this,e);this.editor=b;this.undoStack=c;this.contentAssist=a;this.linkedModeModel=null;e.setAction("linkedModeEnter",function(){this.exitLinkedMode(!0);return!0}.bind(this));e.setAction("linkedModeCancel",function(){this.exitLinkedMode(!1);
return!0}.bind(this));e.setAction("linkedModeNextGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup((a.selectedGroupIndex+1)%a.groups.length);return!0}.bind(this));e.setAction("linkedModePreviousGroup",function(){var a=this.linkedModeModel;this.selectLinkedGroup(0<a.selectedGroupIndex?a.selectedGroupIndex-1:a.groups.length-1);return!0}.bind(this));this.linkedModeListener={onActivating:function(a){this._groupContentAssistProvider&&(this.contentAssist.setProviders([this._groupContentAssistProvider]),
this.contentAssist.setProgress(null))}.bind(this),onModelChanged:function(a){if(!this.ignoreVerify){for(var b=this.editor.mapOffset(a.start),d=this.linkedModeModel,c,e;d;)if(c=this._getPositionChanged(d,b,b+a.removedCharCount),e=c.position,void 0===e||e.model!==d)this.exitLinkedMode(!1),d=this.linkedModeModel;else break;if(d){d=0;a=a.addedCharCount-a.removedCharCount;c=c.positions;for(var f,g=0;g<c.length;++g){f=c[g];e=f.position;var h=e.offset<=b&&b<=e.offset+e.length;h&&!f.ansestor?(e.offset+=d,
e.length+=a,d+=a):(e.offset+=d,f.ansestor&&h&&(e.length+=a));f.escape&&(f.model.escapePosition=e.offset)}this._updateAnnotations(c)}}}.bind(this),onVerify:function(a){if(!this.ignoreVerify){for(var b=this.editor,d=b.mapOffset(a.start),c=this.editor.mapOffset(a.end),e=this.linkedModeModel,f,g;e;)if(f=this._getPositionChanged(e,d,c),g=f.position,void 0===g||g.model!==e)this.exitLinkedMode(!1),e=this.linkedModeModel;else break;if(e){var h=this._compoundChange;h?h.owner.model===e&&h.owner.group===g.group||
(this.endUndo(),this.startUndo()):this.startUndo();e.selectedGroupIndex=g.group;var h=0,m=a.text.length-(c-d);f=f.positions;for(var k,d=d-g.position.offset,l=c-g.position.offset,n=0;n<f.length;++n)k=f[n],c=k.position,k.oldOffset=c.offset,k.model===e&&k.group===g.group?(c.offset+=h,c.length+=m,h+=m):(c.offset+=h,k.ansestor&&(c.length+=g.count*m)),k.escape&&(k.model.escapePosition=c.offset);this.ignoreVerify=!0;for(n=f.length-1;0<=n;n--)k=f[n],k.model===e&&k.group===g.group&&b.setText(a.text,k.oldOffset+
d,k.oldOffset+l);this.ignoreVerify=!1;a.text=null;this._updateAnnotations(f)}}}.bind(this)}}var f={};b.prototype=new k.KeyMode;h.mixin(b.prototype,{createKeyBindings:function(){var b=l.KeyBinding,c=[];c.push({actionID:"linkedModeEnter",keyBinding:new b(13)});c.push({actionID:"linkedModeCancel",keyBinding:new b(27)});c.push({actionID:"linkedModeNextGroup",keyBinding:new b(9)});c.push({actionID:"linkedModePreviousGroup",keyBinding:new b(9,!1,!0)});return c},enterLinkedMode:function(b){if(!this.linkedModeModel){var c=
this.editor.getTextView();c.addKeyMode(this);c.addEventListener("Verify",this.linkedModeListener.onVerify);c.addEventListener("ModelChanged",this.linkedModeListener.onModelChanged);this.contentAssist.addEventListener("Activating",this.linkedModeListener.onActivating);this.editor.reportStatus(g.linkedModeEntered,null,!0)}this._sortedPositions=null;this.linkedModeModel&&(b.previousModel=this.linkedModeModel,b.parentGroup=this.linkedModeModel.selectedGroupIndex,this.linkedModeModel.nextModel=b);this.linkedModeModel=
b;this.selectLinkedGroup(0)},exitLinkedMode:function(b){if(this.isActive()){this._compoundChange&&(this.endUndo(),this._compoundChange=null);this._sortedPositions=null;var c=this.linkedModeModel;this.linkedModeModel=c.previousModel;c.parentGroup=c.previousModel=void 0;this.linkedModeModel&&(this.linkedModeModel.nextModel=void 0);if(!this.linkedModeModel){var a=this.editor,e=a.getTextView();e.removeKeyMode(this);e.removeEventListener("Verify",this.linkedModeListener.onVerify);e.removeEventListener("ModelChanged",
this.linkedModeListener.onModelChanged);e=this.contentAssist;e.removeEventListener("Activating",this.linkedModeListener.onActivating);e.offset=void 0;this.editor.reportStatus(g.linkedModeExited,null,!0);b&&a.setCaretOffset(c.escapePosition,!1)}this.selectLinkedGroup(0)}},startUndo:function(){if(this.undoStack){var b=this,c=this.linkedModeModel;this._compoundChange=this.undoStack.startCompoundChange({model:c,group:c.selectedGroupIndex,end:function(){b._compoundChange=null}})}},endUndo:function(){this.undoStack&&
this.undoStack.endCompoundChange()},isActive:function(){return!!this.linkedModeModel},isStatusActive:function(){return!!this.linkedModeModel},selectLinkedGroup:function(b){var e=this.linkedModeModel;if(e){e.selectedGroupIndex=b;b=e.groups[b];var a=b.positions[0],f=this.editor;f.setSelection(a.offset,a.offset+a.length);if(e=this.contentAssist)e.offset=void 0,b.data&&"link"===b.data.type&&b.data.values?((this._groupContentAssistProvider=new c.TemplateContentAssist(b.data.values)).getPrefix=function(){var b=
f.getSelection();return b.start===b.end&&(b=f.getCaretOffset(),a.offset<=b&&b<=a.offset+a.length)?f.getText(a.offset,b):""},e.offset=a.offset,e.deactivate(),e.activate()):this._groupContentAssistProvider&&(this._groupContentAssistProvider=null,e.deactivate())}this._updateAnnotations()},_getModelPositions:function(b,c,a){for(var e=c.groups,f=0;f<e.length;f++)for(var g=e[f].positions,h=0;h<g.length;h++){var k=g[h];a&&(k={offset:k.offset+a,length:k.length});k={index:h,group:f,count:g.length,model:c,
position:k};b.push(k);c.nextModel&&c.nextModel.parentGroup===f&&(k.ansestor=!0,this._getModelPositions(b,c.nextModel,(a||0)+g[h].offset-g[0].offset))}},_getSortedPositions:function(b){var c=this._sortedPositions;if(!c){for(c=[];b.previousModel;)b=b.previousModel;for(this._getModelPositions(c,b);b;)void 0!==b.escapePosition&&c.push({escape:!0,model:b,position:{offset:b.escapePosition,length:0}}),b=b.nextModel;c.sort(function(a,b){return a.position.offset-b.position.offset});this._sortedPositions=c}return c},
_getPositionChanged:function(b,c,a){var e;b=this._getSortedPositions(b);for(var f=b.length-1;0<=f;f--){var g=b[f].position;if(g.offset<=c&&a<=g.offset+g.length){e=b[f];break}}return{position:e,positions:b}},_updateAnnotations:function(b){var c=this.editor.getAnnotationModel();if(c){var a=[],f=[];c.getTextModel();for(var g=c.getAnnotations(),h;g.hasNext();)switch(h=g.next(),h.type){case e.AnnotationType.ANNOTATION_LINKED_GROUP:case e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP:case e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:a.push(h)}if(g=
this.linkedModeModel){b=b||this._getSortedPositions(g);for(var k=0;k<b.length;k++)if(h=b[k],h.model===g){var l=e.AnnotationType.ANNOTATION_LINKED_GROUP;h.group===g.selectedGroupIndex&&(l=0===h.index?e.AnnotationType.ANNOTATION_SELECTED_LINKED_GROUP:e.AnnotationType.ANNOTATION_CURRENT_LINKED_GROUP);h=h.position;h=e.AnnotationType.createAnnotation(l,h.offset,h.offset+h.length,"");f.push(h)}}c.replaceAnnotations(a,f)}}});f.LinkedMode=b;return f});
define("orion/editor/factories","orion/editor/actions orion/editor/undoStack orion/editor/rulers orion/editor/annotations orion/editor/textDND orion/editor/linkedMode".split(" "),function(g,l,k,e,c,h){function b(){}function f(){}function d(){}function m(){}function a(){}function n(){}var p={};b.prototype={createKeyBindings:function(a,b,d,c){c=new g.TextActions(a,b,c);var e=new h.LinkedMode(a,b,d);a=new g.SourceCodeActions(a,b,d,e);return{textActions:c,linkedMode:e,sourceCodeActions:a}}};p.KeyBindingsFactory=
b;f.prototype={createUndoStack:function(a){a=a.getTextView();return new l.UndoStack(a,200)}};p.UndoFactory=f;d.prototype={createLineNumberRuler:function(a){return new k.LineNumberRuler(a,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"})}};p.LineNumberRulerFactory=d;m.prototype={createFoldingRuler:function(a){return new k.FoldingRuler(a,"left",{styleClass:"ruler folding"})}};p.FoldingRulerFactory=m;a.prototype={createAnnotationModel:function(a){return new e.AnnotationModel(a)},
createAnnotationStyler:function(a,b){return new e.AnnotationStyler(a,b)},createAnnotationRulers:function(a){var b=new k.AnnotationRuler(a,"left",{styleClass:"ruler annotations"});a=new k.OverviewRuler(a,"right",{styleClass:"ruler overview"});return{annotationRuler:b,overviewRuler:a}}};p.AnnotationFactory=a;n.prototype={createTextDND:function(a,b){return new c.TextDND(a.getTextView(),b)}};p.TextDNDFactory=n;return p});
define("orion/editor/editorFeatures",["orion/editor/factories","orion/editor/actions","orion/editor/linkedMode","orion/objects"],function(g,l,k,e){return e.mixin({},g,l,k)});define("text!orion/compare/sideBySideTemplate.html",[],function(){return'\x3cdiv id\x3d"topWidget_id" style\x3d"height:100%;width:100%;position:relative"\x3e\n\t\x3cdiv class\x3d"leftPanelLayout "\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"left_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"left_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent" id\x3d"left_editor_id"\x3e\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"left_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\t\x3cdiv class\x3d"split compareSplitLayout"\x3e\x3c/div\x3e\n\t\x3cdiv class\x3d"rightPanelLayout"\x3e\n\t\t\x3cdiv class\x3d"titleActionContainer"\x3e\n\t\t\t\x3cdiv class\x3d"compareActionContainer" id\x3d"right_action_id"\x3e\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"titleContainer" id\x3d"right_title_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"compareEditorParent"  id\x3d"right_editor_wrapper_id"\x3e\n\t\t\t\x3cdiv class\x3d"canvasContainer"\x3e\n\t\t\t\t\x3ccanvas id\x3d"diff_canvas_id" class\x3d"compareCanvas" width\x3d"46" height\x3d"3000"\x3e\x3c/canvas\x3e\n\t\t\t\x3c/div\x3e\n\t\t\t\x3cdiv class\x3d"compareEditorParentWithCanvas" id\x3d"right_editor_id"\x3e\x3c/div\x3e\n\t\t\x3c/div\x3e\n\t\t\x3cdiv class\x3d"statusContainer" id\x3d"right_status_id"\x3e\x3c/div\x3e\n\t\x3c/div\x3e\n\x3c/div\x3e'});
define("orion/compare/compareUIFactory",["orion/webui/littlelib","orion/webui/splitter","text!orion/compare/sideBySideTemplate.html"],function(g,l,k){var e=e||{};e.TwoWayCompareUIFactory=function(){function c(c){this._parentDivID=c.parentDivID;this._commandSpanId=c.commandSpanId;this._showTitle=c.showTitle;this._leftTitle=c.leftTitle;this._rightTitle=c.rightTitle;this._showLineStatus=c.showLineStatus}c.prototype={_init:function(){var c=this._parentDivID+"_";this._topWidgetDiv=g.node("topWidget_id");
this._topWidgetDiv.id=c+"topWidget_id";this._leftEditorParentDiv=g.node("left_editor_id");this._leftEditorParentDiv.id=c+"left_editor_id";this._rightEditorParentDiv=g.node("right_editor_id");this._rightEditorParentDiv.id=c+"right_editor_id";this._rightEditorWrapperDiv=g.node("right_editor_wrapper_id");this._rightEditorWrapperDiv.id=c+"right_editor_wrapper_id";this._leftActionDiv=g.node("left_action_id");this._leftActionDiv.id=c+"left_action_id";this._rightActionDiv=g.node("right_action_id");this._rightActionDiv.id=
c+"right_action_id";this._leftTitleDiv=g.node("left_title_id");this._leftTitleDiv.id=c+"left_title_id";this._rightTitleDiv=g.node("right_title_id");this._rightTitleDiv.id=c+"right_title_id";this._leftStatusDiv=g.node("left_status_id");this._leftStatusDiv.id=c+"left_status_id";this._rightStatusDiv=g.node("right_status_id");this._rightStatusDiv.id=c+"right_status_id";this._diffCanvasDiv=g.node("diff_canvas_id");this._diffCanvasDiv.id=c+"diff_canvas_id";this._splitterId=c+"orion_splitter";this._showTitle||
this.disableTitle();this._showLineStatus||this.disableLineStatus()},_createSplitter:function(){var c=g.$(".split",this._topWidgetDiv);c.id=this._splitterId;var b=g.$(".leftPanelLayout",this._topWidgetDiv),e=g.$(".rightPanelLayout",this._topWidgetDiv);c&&b&&e&&(this._splitter=new l.Splitter({node:c,sidePanel:b,mainPanel:e}))},buildUI:function(){g.node(this._parentDivID).innerHTML=k;this._init();this._createSplitter()},destroy:function(){},getSplitter:function(){return this._splitter},isLeftPane:function(c){return g.$(".leftPanelLayout",
this._topWidgetDiv)===c},getEditorParentDiv:function(c){return c?this._leftEditorParentDiv:this._rightEditorParentDiv},getTitleDiv:function(c){return c?this._leftTitleDiv:this._rightTitleDiv},getActionDivId:function(c){return c?this._leftActionDiv.id:this._rightActionDiv.id},getStatusDiv:function(c){return c?this._leftStatusDiv:this._rightStatusDiv},getCommandSpanId:function(){return this._commandSpanId},getDiffCanvasDiv:function(){return this._diffCanvasDiv},disableTitle:function(){this._leftEditorParentDiv.style.top=
"0px";this._rightEditorWrapperDiv.style.top="0px";this._leftTitleDiv.style.height="0px";this._rightTitleDiv.style.height="0px"},disableLineStatus:function(){this._leftEditorParentDiv.style.marginBottom="0px";this._rightEditorWrapperDiv.style.marginBottom="0px";this._leftStatusDiv.style.height="0px";this._rightStatusDiv.style.height="0px"}};return c}();return e});
var JsDiff=function(){function g(b){for(var d=[],c=0;c<b.length;c++)b[c]&&d.push(b[c]);return d}function l(b){b=b.replace(/&/g,"\x26amp;");b=b.replace(/</g,"\x26lt;");b=b.replace(/>/g,"\x26gt;");return b.replace(/"/g,"\x26quot;")}var k=function(b){this.ignoreWhitespace=b};k.prototype={diff:function(b,d){if(d==b)return[{value:d}];if(!d)return[{value:b,removed:!0}];if(!b)return[{value:d,added:!0}];d=this.tokenize(d);b=this.tokenize(b);var c=d.length,a=b.length,e=c+a,g=[{newPos:-1,components:[]}],h=
this.extractCommon(g[0],d,b,0);if(g[0].newPos+1>=c&&h+1>=a)return g[0].components;for(var k=1;k<=e;k++)for(var l=-1*k;l<=k;l+=2){var w;w=g[l-1];var v=g[l+1],h=(v?v.newPos:0)-l;w&&(g[l-1]=void 0);var u=w&&w.newPos+1<c,y=v&&0<=h&&h<a;if(!u&&!y)g[l]=void 0;else{!u||y&&w.newPos<v.newPos?(w={newPos:v.newPos,components:v.components.slice(0)},this.pushComponent(w.components,b[h],void 0,!0)):(w={newPos:w.newPos,components:w.components.slice(0)},w.newPos++,this.pushComponent(w.components,d[w.newPos],!0,void 0));
h=this.extractCommon(w,d,b,l);if(w.newPos+1>=c&&h+1>=a)return w.components;g[l]=w}}},pushComponent:function(b,d,c,a){var e=b[b.length-1];e&&e.added===c&&e.removed===a?b[b.length-1]={value:this.join(e.value,d),added:c,removed:a}:b.push({value:d,added:c,removed:a})},extractCommon:function(b,d,c,a){var e=d.length,g=c.length,h=b.newPos;for(a=h-a;h+1<e&&a+1<g&&this.equals(d[h+1],c[a+1]);)h++,a++,this.pushComponent(b.components,d[h],void 0,void 0);b.newPos=h;return a},equals:function(b,d){var c=/\S/;return this.ignoreWhitespace&&
!c.test(b)&&!c.test(d)?!0:b==d},join:function(b,d){return b+d},tokenize:function(b){return b}};var e=new k,c=new k(!1);c.tokenize=function(b){return g(b.split(/(\s+|\b)/))};var h=new k(!0);h.tokenize=function(b){return g(b.split(/([{}:;,]|\s+)/))};var b=new k;b.tokenize=function(b){return b.split(/^/m)};return{diffChars:function(b,d){return e.diff(b,d)},diffWords:function(b,d){return c.diff(b,d)},diffLines:function(c,d){return b.diff(c,d)},diffCss:function(b,d){return h.diff(b,d)},createPatch:function(c,
d,e,a,g){var h=[];h.push("Index: "+c);h.push("\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d\x3d");h.push("--- "+c+"\t"+a);h.push("+++ "+c+"\t"+g);c=b.diff(d,e);c.push({value:"",lines:[]});e=d=0;a=[];for(var k=g=1,l=0;l<c.length;l++){var s=c[l],w=s.lines||s.value.replace(/\n$/,"").split("\n");
s.lines=w;if(s.added||s.removed){if(!d){var v=c[l-1];d=g;e=k;v&&(a.push.apply(a,v.lines.slice(-4).map(function(a){return" "+a})),d-=4,e-=4)}a.push.apply(a,w.map(function(a){return(s.added?"+":"-")+a}));s.added?k+=w.length:g+=w.length}else d&&(8>=w.length&&l<c.length-1?a.push.apply(a,w.map(function(a){return" "+a})):(v=Math.min(w.length,4),h.push("@@ -"+d+","+(g-d+v)+" +"+e+","+(k-e+v)+" @@"),h.push.apply(h,a),h.push.apply(h,w.slice(0,v).map(function(a){return" "+a})),e=d=0,a=[])),g+=w.length,k+=w.length}1<
c.length&&!/\n$/.test(c[c.length-2].value)&&h.push("\\ No newline at end of file\n");return h.join("\n")},convertChangesToXML:function(b){for(var d=[],c=0;c<b.length;c++){var a=b[c];a.added?d.push("\x3cins\x3e"):a.removed&&d.push("\x3cdel\x3e");d.push(l(a.value));a.added?d.push("\x3c/ins\x3e"):a.removed&&d.push("\x3c/del\x3e")}return d.join("")}}}();"undefined"!==typeof module&&(module.exports=JsDiff);"function"===typeof define&&define.amd&&define("jsdiff/diff",[],function(){return JsDiff});
define("orion/compare/jsdiffAdapter",["jsdiff/diff"],function(g){var l=l||{};l.JSDiffAdapter=function(){function k(){}k.prototype={_specialLine:function(e,c,g){return c.value===e&&g!==e},adapt:function(e,c,h){h||(h="\n");var b=e.split(h),f=c.split(h),d=""===b[b.length-1],f=""===f[f.length-1],m=g.diffLines(e,c);e=[];c=[];for(var a=0,k=0,l=-1,t=0,r=!0,s=h,w=0;w<m.length;w++){var v=m[w],u=v.lines||v.value.split(h),y=u.length,x=0;1<u.length&&""===u[u.length-1]&&y--;1<y&&!r&&""===u[0]&&(y--,x++);v.lines=
u;if(!v.added&&!v.removed){if(!this._specialLine(h,v,s)){if(a||k)e.push([a,k,l]),k=a=0,l=-1,t+=k;e.push([y,y,0]);t+=y}}else if(v.added){-1===l&&(l=c.length+1);a+=y;for(r=x;r<y+x;r++)c.push(v.lines[r])}else k+=y;r=!1;1<u.length&&""===u[u.length-1]&&(r=!0);s=v.value?v.value[v.value.length-1]:h}if(a||k)e.push([a,k,l]),t+=k;t<b.length&&1<b.length&&(h=e[e.length-1],0===h[2]?(h[0]+=1,h[1]+=1):-1===h[2]?e.push([1,1,0]):d===f?e.push([1,1,0]):(f&&(h[0]+=1),d&&(h[1]+=1)));return{mapper:e,changContents:{array:c,
index:0}}},adaptCharDiff:function(e,c,h){e=h?g.diffWords(e,c):g.diffChars(e,c);c=[];for(var b=h=0,f=0,d=0,m=0;m<e.length;m++){var a=e[m];if(!a.added&&!a.removed){if(0<f||0<d)c.push([b,b+f,h,h+d]),b+=f,h+=d,d=f=0;b+=a.value.length;h+=a.value.length}else a.added?f+=a.value.length:d+=a.value.length}(0<f||0<d)&&c.push([b,b+f,h,h+d]);return c}};return k}();return l});
define("orion/compare/diffTreeNavigator",["orion/treeModelIterator","orion/compare/compareUtils","orion/editor/annotations","orion/compare/jsdiffAdapter"],function(g,l,k,e){var c={},h,b,f,d,m,a,n,p,t,r,s,w,v,u,y,x;c.DiffTreeNavigator=function(){function c(a,b,d,e,f,g){this._root={type:"root",children:[]};this._initialized=!1;this.initAll(a,b,d,e,f,g)}h="orion.annotation.diff.addedBlock";b="orion.annotation.diff.currentAddedBlock";f="orion.annotation.diff.deletedBlock";d="orion.annotation.diff.currentDeletedBlock";
m="orion.annotation.diff.blockTop";a="orion.annotation.diff.currentBlockTop";n="orion.annotation.diff.blockConflict";p="orion.annotation.diff.currentBlockConflict";t="orion.annotation.diff.addedWord";r="orion.annotation.diff.currentAddedWord";s="orion.annotation.diff.deletedWord";w="orion.annotation.diff.currentDeletedWord";v="orion.annotation.diff.emptyDeletedWordLeft";u="orion.annotation.diff.emptyDeletedWordRight";y="orion.annotation.diff.emptyAddedWordLeft";x="orion.annotation.diff.emptyAddedWordRight";
k.AnnotationType.registerType(h,{title:"",html:"",lineStyle:{styleClass:"annotationLine addedBlockDiff"}});k.AnnotationType.registerType(b,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentAddedBlockDiff"}});k.AnnotationType.registerType(f,{title:"",html:"",lineStyle:{styleClass:"annotationLine deletedBlockDiff"}});k.AnnotationType.registerType(d,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentDeletedBlockDiff"}});k.AnnotationType.registerType(m,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffTopOnly"}});
k.AnnotationType.registerType(a,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffTopOnly"}});k.AnnotationType.registerType(n,{title:"",html:"",lineStyle:{styleClass:"annotationLine blockDiffConflict"}});k.AnnotationType.registerType(p,{title:"",html:"",lineStyle:{styleClass:"annotationLine currentBlockDiffConflict"}});k.AnnotationType.registerType(t,{title:"word added",html:"",rangeStyle:{styleClass:"annotationRange addedWordDiff"}});k.AnnotationType.registerType(r,{title:"",
html:"",rangeStyle:{styleClass:"annotationRange currentAddedWordDiff"}});k.AnnotationType.registerType(s,{title:"word deleted",html:"",rangeStyle:{styleClass:"annotationRange deletedWordDiff"}});k.AnnotationType.registerType(w,{title:"",html:"",rangeStyle:{styleClass:"annotationRange currentDeletedWordDiff"}});k.AnnotationType.registerType(v,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffLeft"}});k.AnnotationType.registerType(u,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyDeletedWordDiffRight"}});
k.AnnotationType.registerType(y,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffLeft"}});k.AnnotationType.registerType(x,{title:"",html:"",rangeStyle:{styleClass:"annotationRange emptyAddedWordDiffRight"}});c.prototype={initAll:function(a,b,d,c,e,f,g){this._charOrWordDiff=a?a:"word";b&&(this._initialized=!0);this.editorWrapper=[{editor:b,diffFeeder:c},{editor:d,diffFeeder:e}];this._curveRuler=g;(this._overviewRuler=f)&&this._overviewRuler.setDiffNavigator(this)},initMapper:function(a){if(a)for(var b=
0;b<this.editorWrapper.length;b++)this.editorWrapper[b].diffFeeder.init(this.editorWrapper[b].editor.getTextView().getModel(),a)},destroy:function(){this.initAll(this._charOrWordDiff)},renderAnnotations:function(){var a;for(a=0;a<this.editorWrapper.length;a++){this.editorWrapper[a].annoTypes=[];this.editorWrapper[a].diffFeeder.getBlockAnnoTypes(this.editorWrapper[a].annoTypes);this.editorWrapper[a].diffFeeder.getWordAnnoTypes(this.editorWrapper[a].annoTypes);for(var b=0;b<this.editorWrapper[a].annoTypes.length;b++)this.editorWrapper[a].annoTypes[b].current&&
this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].current),this.editorWrapper[a].annoTypes[b].normal&&this.editorWrapper[a].editor.getAnnotationStyler().addAnnotationType(this.editorWrapper[a].annoTypes[b].normal)}this._root.children=[];b=this.editorWrapper[0].diffFeeder.getDiffBlocks();if(!b||0===b.length)this.replaceAllAnnotations(!0,0,"block",!1,[]),this.replaceAllAnnotations(!0,1,"block",!1,[]),this.replaceAllAnnotations(!0,0,"word",!1,[]),
this.replaceAllAnnotations(!0,1,"word",!1,[]),this.replaceAllAnnotations(!0,0,"block",!0,[]),this.replaceAllAnnotations(!0,1,"block",!0,[]),this.replaceAllAnnotations(!0,0,"word",!0,[]),this.replaceAllAnnotations(!0,1,"word",!0,[]);else{var d=new e.JSDiffAdapter;for(a=0;a<b.length;a++){var c=this.generatePairBlockAnnotations(this._root,a);this._root.children.push(c);var f=this.generatePairWordAnnotations(c,a,d);f&&(c.children=f)}this.replaceAllAnnotations(!1,0,"block",!0);this.replaceAllAnnotations(!1,
1,"block",!0);this.replaceAllAnnotations(!1,0,"word",!0);this.replaceAllAnnotations(!1,1,"word",!0);this.iterator=new g.TreeModelIterator(this._root.children)}},replaceAllAnnotations:function(a,b,d,c,e){if(this.editorWrapper[b].annoTypes)for(var f=0;f<this.editorWrapper[b].annoTypes.length;f++)this.editorWrapper[b].annoTypes[f].type===d&&this.replaceDiffAnnotations(this.editorWrapper[b].editor,e?e:this.editorWrapper[b].annoTypes[f].list,c?this.editorWrapper[b].annoTypes[f].normal:this.editorWrapper[b].annoTypes[f].current,
a)},getMapper:function(){return this.editorWrapper[0].diffFeeder.getMapper()},getFeeder:function(a){return a?this.editorWrapper[1].diffFeeder:this.editorWrapper[0].diffFeeder},iterateOnBlock:function(a,b){this.iterator&&(this.iterator.iterateOnTop(a,b),this.updateCurrentAnnotation(!0))},iterateOnChange:function(a){if(!this.iterator)return null;var b=this.iterator.iterate(a);if(b){var d=this.iterator.cursor();"block"===d.type&&d.children&&0<d.children.length&&this.iterator.iterate(a);this.updateCurrentAnnotation(!0)}return b},
gotoBlock:function(a,b){if(this.iterator){if(0>a||a>=this._root.children.length||0===this._root.children.length)a=0;void 0!==b&&0<=b&&this._root.children[a].children&&b<this._root.children[a].children.length?this.iterator.setCursor(this._root.children[a].children[b]):this.iterator.setCursor(this._root.children[a]);this.updateCurrentAnnotation(!1);this._positionDiffBlock()}},_hitDiffAnnotation:function(a,b,d){if(d===this.editorWrapper[a].editor.getTextView()){for(var c=0;c<this._root.children.length;c++){d=
this._root.children[c];var e=0===a?d.oldA:d.newA;if(b>=e.start&&b<=e.end){c=d;if(d.children&&0<d.children.length)for(e=0;e<d.children.length;e++){var f=d.children[e],g=0===a?f.oldA:f.newA;if(b>=g.start&&b<=g.end){c=f;break}}return c}}return null}},gotoChange:function(a,b){for(var d=0;d<this.editorWrapper.length;d++){var c=this._hitDiffAnnotation(d,a,b);if(c)return this.iterator.setCursor(c),this.updateCurrentAnnotation(!1,b),!0}return!1},getCurrentBlockIndex:function(){if(!this.iterator)return-1;
var a=this.iterator.cursor();return!a?-1:"block"===a.type?a.index:a.parent.index},getCurrentPosition:function(){if(!this.iterator)return{};var a=this.iterator.cursor();return"block"===a.type?{block:a.index+1}:{block:a.parent.index+1,change:a.index+1}},getCurrentMapperIndex:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();if(!b||0===b.length)return-1;a>b.length-1&&(a=0);return b[a][1]},replaceDiffAnnotations:function(a,b,d,c){if(b&&d&&(a=a.getAnnotationModel())){for(var e=
a.getAnnotations(),f=[];c&&e.hasNext();){var g=e.next();g.type===d&&f.push(g)}a.replaceAnnotations(f,b)}},updateCurrentAnnotation:function(a,b){this.replaceAllAnnotations(!0,0,"block",!1,[]);this.replaceAllAnnotations(!0,1,"block",!1,[]);this.replaceAllAnnotations(!0,0,"word",!1,[]);this.replaceAllAnnotations(!0,1,"word",!1,[]);if(this.iterator){var d=this.iterator.cursor();if(d){var c,e,f={start:d.oldA.start,end:d.oldA.end},g={start:d.newA.start,end:d.newA.end};"word"===d.type?(c=this.editorWrapper[0].diffFeeder.getCurrentWordAnnoType(f,
this.editorWrapper[0].editor.getTextView().getModel()),e=this.editorWrapper[1].diffFeeder.getCurrentWordAnnoType(g,this.editorWrapper[1].editor.getTextView().getModel())):(c=this.editorWrapper[0].diffFeeder.getCurrentBlockAnnoType(d.index),e=this.editorWrapper[1].diffFeeder.getCurrentBlockAnnoType(d.index));c&&this.replaceDiffAnnotations(this.editorWrapper[0].editor,[new (k.AnnotationType.getType(c.current))(f.start,f.end)],c,!0);e&&this.replaceDiffAnnotations(this.editorWrapper[1].editor,[new (k.AnnotationType.getType(e.current))(g.start,
g.end)],e,!0);a?(this.autoSelecting=!0,this.editorWrapper[0].editor.setSelection(d.oldA.start,d.oldA.end,!0),this.editorWrapper[1].editor.setSelection(d.newA.start,d.newA.end,!0),this.autoSelecting=!1):b&&(this.autoSelecting=!0,b!==this.editorWrapper[0].editor.getTextView()&&this.editorWrapper[0].editor.setSelection(d.oldA.start,d.oldA.end,!0),b!==this.editorWrapper[1].editor.getTextView()&&this.editorWrapper[1].editor.setSelection(d.newA.start,d.newA.end,!0),this.autoSelecting=!1)}}},generatePairBlockAnnotations:function(a,
b){var d=this.generateBlockDiffAnnotations(0,b),c=this.generateBlockDiffAnnotations(1,b);return{parent:a,index:b,type:"block",oldA:d,newA:c}},generatePairWordAnnotations:function(a,b,d){var c=this.editorWrapper[0].diffFeeder.getTextOnBlock(b),e=this.editorWrapper[1].diffFeeder.getTextOnBlock(b),f=0,g=0;if(c&&e&&c.text&&e.text&&5E3>=c.text.length&&5E3>=e.text.length)b=d.adaptCharDiff(c.text,e.text,"word"===this._charOrWordDiff),g=e.start,f=c.start;else return null;d=[];c=[];this.generateWordDiffAnnotations(0,
d,f,b,2,3);this.generateWordDiffAnnotations(1,c,g,b,0,1);b=[];for(f=0;f<d.length;f++)b.push({parent:a,index:f,type:"word",oldA:d[f],newA:c[f]});return b},getAnnoModelList:function(a,b,d){for(var c=0;c<this.editorWrapper[a].annoTypes.length;c++)if(this.editorWrapper[a].annoTypes[c].type===b&&this.editorWrapper[a].annoTypes[c].normal===d)return this.editorWrapper[a].annoTypes[c].list;return null},generateBlockDiffAnnotations:function(a,b){var d=this.editorWrapper[a].diffFeeder.getCurrentBlockAnnoType(b),
c=this.getAnnoModelList(a,"block",d.normal),e=this.editorWrapper[a].diffFeeder.getCharRange(b),d=k.AnnotationType.createAnnotation(d.normal,e.start,e.end);c&&c.push(d);return d},generateWordDiffAnnotations:function(a,b,d,c,e,f){if(c){var g=this.editorWrapper[a].diffFeeder.getCurrentWordAnnoType({start:-1,end:-1});a=this.getAnnoModelList(a,"word",g.normal);for(var h=0;h<c.length;h++){var m=k.AnnotationType.createAnnotation(g.normal,c[h][e]+d,c[h][f]+d);a.push(m);b.push(m)}}},_updateOverviewRuler:function(){if(this._overviewRuler){var a=
this.editorWrapper[0].editor.getTextView().getTopIndex();this.editorWrapper[0].editor.getTextView().redrawLines(a,a+1,this._overviewRuler)}},_updateCurveRuler:function(){this._curveRuler&&this._curveRuler.render()},_setTextViewPosition:function(a,b){var d=a.getLineHeight(),c=a.getClientArea(),d=Math.floor(c.height/d/3);a.setTopIndex(0<b-d?b-d:0)},_positionDiffBlock:function(){var a=this.getCurrentBlockIndex();0>a&&(a=0);var b=this.getFeeder().getDiffBlocks();0!==b.length&&(this._setTextViewPosition(this.editorWrapper[0].editor.getTextView(),
b[a][0]),this.editorWrapper[0].editor!==this.editorWrapper[1].editor&&(a=l.lookUpLineIndex(this.getMapper(),0,b[a][1]),this._setTextViewPosition(this.editorWrapper[1].editor.getTextView(),a)),this._updateOverviewRuler(),this._updateCurveRuler())},matchPositionFromOverview:function(a){this._initialized&&(a=0>a?0:l.getAnnotationIndex(this.getFeeder().getDiffBlocks(),a),this.gotoBlock(a))},gotoDiff:function(a,b){this.gotoChange(a,b)&&(this._updateOverviewRuler(),this._updateCurveRuler())},nextDiff:function(){this.iterateOnBlock(!0,
!0);this._positionDiffBlock()},prevDiff:function(){this.iterateOnBlock(!1,!0);this._positionDiffBlock()},nextChange:function(){var a=this.iterateOnChange(!0);this._positionDiffBlock();return a},prevChange:function(){this.iterateOnChange(!1);this._positionDiffBlock()}};return c}();c.DiffBlockFeeder=function(){function a(){}a.prototype={_isAddedSide:function(){return 0===this._mapperColumnIndex},getWordAnnoTypes:function(a){this._isAddedSide()?a.push({type:"word",current:r,normal:t,list:[]}):a.push({type:"word",
current:w,normal:s,list:[]});a.push({type:"word",current:v});a.push({type:"word",current:u});a.push({type:"word",current:y});a.push({type:"word",current:x})},getCurrentWordAnnoType:function(a,b){return a.start===a.end&&b?this._isAddedSide()?{current:this._repositionEmptyWord(a,b),normal:t}:{current:this._repositionEmptyWord(a,b),normal:s}:this._isAddedSide()?{current:r,normal:t}:{current:w,normal:s}},_repositionEmptyWord:function(a,b){var d=b.getLineAtOffset(a.start),c=b.getLineStart(d),e=b.getLineEnd(d);
if(c!==e){if(a.start===e)return a.start--,this._isAddedSide()?x:u;a.end++}else if(0<d&&(d--,c=b.getLineStart(d),e=b.getLineEnd(d),c!==e))return a.start=e-1,a.end=e,this._isAddedSide()?x:u;return this._isAddedSide()?y:v},getMapper:function(){return this._mapper},getDiffBlocks:function(){return this._diffBlocks},getDiffBlockH:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return-1===a?0:this._mapper[a][this._mapperColumnIndex]},getOverviewLineCount:function(){return this._textModel.getLineCount()},
getLineNumber:function(a){return a},getCharRange:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;var b=this._diffBlocks[a][0],d=b+this._mapper[this._diffBlocks[a][1]][this._mapperColumnIndex]-1;a=this._textModel.getLineStart(b);if(d<b)return{start:a,end:a};b=this._textModel.getLineEnd(d,!0);return{start:a,end:b}},getTextOnBlock:function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;a=this.getCharRange(a);return{start:a.start,text:this._textModel.getText(a.start,
a.end)}},isMapperEmpty:function(){return 0===this._mapper.length}};return a}();c.TwoWayDiffBlockFeeder=function(){function e(a,b,d,c){this._mapperColumnIndex=d;this._reverseAnnotation=c;this.init(a,b)}e.prototype=new c.DiffBlockFeeder;e.prototype._isAddedSide=function(){return this._reverseAnnotation?0!==this._mapperColumnIndex:0===this._mapperColumnIndex};e.prototype.init=function(a,b){this._textModel=a;this._diffBlocks=void 0;if(b){this._mapper=b;this._diffBlocks=[];for(var d=0,c=0;c<this._mapper.length;c++)0!==
this._mapper[c][2]&&this._diffBlocks.push([d,c]),d+=this._mapper[c][this._mapperColumnIndex]}};e.prototype.getBlockAnnoTypes=function(c){this._isAddedSide()?c.push({type:"block",normal:h,current:b,list:[]}):c.push({type:"block",normal:f,current:d,list:[]});c.push({type:"block",normal:m,current:a,list:[]});c.push({type:"block",normal:n,current:p,list:[]})};e.prototype.getCurrentBlockAnnoType=function(c){if(!this._diffBlocks||0===this._diffBlocks.length||this._diffBlocks.length<=c)return null;c=this._diffBlocks[c][1];
return 0===this._mapper[c][this._mapperColumnIndex]?{normal:m,current:a}:l.isMapperConflict(this.getMapper(),c)?{normal:n,current:p}:this._isAddedSide()?{type:"block",normal:h,current:b,list:[]}:{type:"block",normal:f,current:d,list:[]}};return e}();c.inlineDiffBlockFeeder=function(){function a(b,d){this._mapperColumnIndex=d;this.init(b)}a.prototype=new c.DiffBlockFeeder;a.prototype.setModel=function(a){this._textModel=a};a.prototype.init=function(a){this._diffBlocks=void 0;if(a){this._mapper=a;this._diffBlocks=
[];this._gapBlocks=[];for(var b=a=0,d=0;d<this._mapper.length;d++){if(0!==this._mapper[d][2]){if(this._isAddedSide()){var c=a+this._mapper[d][1];this._diffBlocks.push([c,d]);this._gapBlocks.push([c,c+this._mapper[d][0],b])}else this._diffBlocks.push([a,d]),this._gapBlocks.push([a,a+this._mapper[d][1],b]);a+=this._mapper[d][0]+this._mapper[d][1]}else this._gapBlocks.push([a,a+this._mapper[d][this._mapperColumnIndex],b]),a+=this._mapper[d][this._mapperColumnIndex];b+=this._mapper[d][this._mapperColumnIndex]}}};
a.prototype.getBlockAnnoTypes=function(a){this._isAddedSide()?a.push({type:"block",normal:h,current:b,list:[]}):a.push({type:"block",normal:f,current:d,list:[]});a.push({type:"block",normal:n,current:p,list:[]})};a.prototype.getCurrentBlockAnnoType=function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return null;a=this._diffBlocks[a][1];return 0===this._mapper[a][this._mapperColumnIndex]?{current:r,normal:t}:l.isMapperConflict(this.getMapper(),a)?{normal:n,current:p}:this._isAddedSide()?
{type:"block",normal:h,current:b,list:[]}:{type:"block",normal:f,current:d,list:[]}};a.prototype.getDiffBlockH=function(a){if(!this._diffBlocks||0===this._diffBlocks.length)return-1;a=this._diffBlocks[a][1];return this._mapper[a][0]+this._mapper[a][1]};a.prototype.getLineNumber=function(a){for(var b=0;b<this._gapBlocks.length;b++)if(this._gapBlocks[b][0]!==this._gapBlocks[b][1]&&a>=this._gapBlocks[b][0]&&a<this._gapBlocks[b][1])return a-this._gapBlocks[b][0]+this._gapBlocks[b][2];return-1};return a}();
return c});
define("orion/compare/compareView","i18n!orion/compare/nls/messages orion/Deferred orion/webui/littlelib orion/compare/diffParser orion/compare/compareRulers orion/editor/editor orion/editor/editorFeatures orion/keyBinding orion/editor/textView orion/compare/compareUIFactory orion/compare/compareUtils orion/compare/jsdiffAdapter orion/compare/diffTreeNavigator".split(" "),function(g,l,k,e,c,h,b,f,d,m,a,n,p,t,r,s){var w={};w.CompareView=function(){function a(){this._diffParser=new e.DiffParser}a.prototype=
{_clearOptions:function(){this.options={};this.options.blockNumber=1;this.options.changeNumber=0},_getLineDelim:function(a,b){return"\n"},_generateMapper:function(a,b,d,c,e){var f=this._getLineDelim(a,d);this._diffParser.setLineDelim(f);if(this.options.mapper&&this.options.toggler)return{delim:f,mapper:this.options.mapper,output:this.options.newFile.Content,diffArray:this.options.diffArray};if("string"===typeof b&&"string"===typeof a)return a=(new n.JSDiffAdapter).adapt(a,b,f),this.options.toggler&&
(this.options.mapper=a.mapper,this.options.newFile.Content=b,this.options.diffArray=a.changContents),{delim:f,mapper:a.mapper,output:b,diffArray:a.changContents};b=this._diffParser.parse(a,d,c,e);a=this._diffParser.getDiffArray();this.options.toggler&&(this.options.mapper=b.mapper,this.options.newFile.Content=b.outPutFile,this.options.diffArray=a);return{delim:f,mapper:b.mapper,output:b.outPutFile,diffArray:a}},_loadImageFile:function(a,b,d){var c=document.createElement("img");c.src=a;var e=new l;
c.onload=function(){b.appendChild(c);if(d){var a=document.createElement("hr");b.appendChild(a)}e.resolve(c.height)};c.onerror=function(){e.resolve(0)};return e},_initSyntaxHighlighter:function(a){this._syntaxHighlighters=null;if(this.options.highlighters&&0<this.options.highlighters.length&&!(1>a.length||2<a.length))this._syntaxHighlighters=[{highlighter:this.options.highlighters[0],target:a[0]}],2===a.length&&2===this.options.highlighters.length&&this._syntaxHighlighters.push({highlighter:this.options.highlighters[1],
target:a[1]})},_highlightSyntax:function(){if(this._syntaxHighlighters){var a=[];this._syntaxHighlighters.forEach(function(b){a.push(b.highlighter.highlight(b.target.fileName,b.target.contentType,b.target.editor))}.bind(this));l.all(a,function(a){return{_error:a}}).then(function(a){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1)}.bind(this))}else window.setTimeout(function(){this._diffNavigator.renderAnnotations();this._diffNavigator.gotoBlock(this.options.blockNumber-
1,this.options.changeNumber-1)}.bind(this),50)},setOptions:function(a,b){b&&this._clearOptions();this.options||(this.options={});a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this));if(a.newFileOnRight){var d=this.options.newFile;this.options.newFile=this.options.oldFile;this.options.oldFile=d}},getOptions:function(){return this.options},getCurrentDiffPos:function(){return this._diffNavigator.getCurrentPosition()},initDiffNav:function(){this._diffNavigator.gotoBlock(0,0)},nextDiff:function(){this._diffNavigator.nextDiff()},
prevDiff:function(){this._diffNavigator.prevDiff()},nextChange:function(){return this._diffNavigator.nextChange()},prevChange:function(){this._diffNavigator.prevChange()},getWidget:function(){return this},startup:function(){this.initEditors();this.refresh(!0)},initEditors:function(a){},initImageMode:function(){}};return a}();w.TwoWayCompareView=function(){function a(b){this.setOptions(b,!0);this._diffNavigator=new p.DiffTreeNavigator("word");this.type="twoWay";(this._uiFactory=this.options.uiFactory)||
(this._uiFactory=new m.TwoWayCompareUIFactory({parentDivID:this.options.parentDivId,showTitle:this.options.showTitle?this.options.showTitle:!1,showLineStatus:this.options.showLineStatus?this.options.showLineStatus:!1}),this._uiFactory.buildUI());this._viewLoadedCounter=0;this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._curveRuler=new c.CompareCurveRuler(this._uiFactory.getDiffCanvasDiv())}a.prototype=new w.CompareView;a.prototype.initEditors=function(a){this._editors=
[];this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!1),this._uiFactory.getStatusDiv(!1),this.options.oldFile));this._editors.push(this._createEditor(a,this._uiFactory.getEditorParentDiv(!0),this._uiFactory.getStatusDiv(!0),this.options.newFile,!0));this._overviewRuler=new c.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));window.onbeforeunload=function(){if(this._editors&&this._editors.some(function(a){return a.isDirty()}))return g["There are unsaved changes."]}.bind(this)};
a.prototype.initImageMode=function(){this._editors&&(this._editors.forEach(function(a){a.destroy()}),this._editors=null);this._uiFactory.getEditorParentDiv(!0).classList.add("compareEditorParentImageMode");this._uiFactory.getEditorParentDiv().classList.add("compareEditorParentImageMode");this._uiFactory.disableTitle();this._uiFactory.disableLineStatus();this._imageMode=!0};a.prototype.getImageMode=function(){return this._imageMode};a.prototype.getEditors=function(){return this._editors};a.prototype.gotoDiff=
function(a,b,d){d=d?this._editors[1].getTextView():this._editors[0].getTextView();a=d.getModel().getLineStart(a)+b;this._diffNavigator.gotoDiff(a,d)};a.prototype.copyToLeft=function(){this._curveRuler.copyTo(!0)};a.prototype.copyToRight=function(){this._curveRuler.copyTo(!1)};a.prototype.resizeEditors=function(){this._editors.forEach(function(a){a.getTextView().resize()})};a.prototype.getSplitter=function(){return this._uiFactory.getSplitter()};a.prototype._createEditor=function(a,c,e,f,m){var k=
"undefined"===typeof f.readonly?!0:f.readonly,l=function(){var a=new d.TextView({parent:c,readonly:k,tabSize:4});this._viewLoadedCounter++;2===this._viewLoadedCounter&&this._diffNavigator.matchPositionFromOverview(-1);if(this.onLoad)this.onLoad();var b=this.getSplitter();b&&b.addResizeListener(function(b){b&&(this._uiFactory.isLeftPane(b)?m:!m)&&a.resize()}.bind(this));return a}.bind(this),n=f.keyBindingFactory;n||(n=new b.KeyBindingsFactory);var p=null;if(e)var t="",p=function(a,b){e&&(t=b?g["ERROR: "]+
a:a,e.textContent=""+t)};l=new h.Editor({textViewFactory:l,undoStackFactory:new b.UndoFactory,annotationFactory:new b.AnnotationFactory,keyBindingFactory:n,statusReporter:p,domNode:c});l.installTextView();l.setInput(null,null,f.Content?f.Content:a);l.setOverviewRulerVisible(!1);var r=l.getTextView();r.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&(a=r.getCaretOffset(),
this._diffNavigator.gotoDiff(a,r))}.bind(this));r.getModel().addEventListener("Changed",function(a){this._curveRuler.onChanged(a,!m)||(this.options.mapper=null)}.bind(this));m?r.addEventListener("Scroll",function(a){this._curveRuler&&(this._curveRuler.matchPositionFrom(!0),this._curveRuler.render());if(this.onScroll)this.onScroll()}.bind(this)):r.addEventListener("Scroll",function(a){this._curveRuler&&this._curveRuler.render()}.bind(this));return l};a.prototype.destroy=function(){this._editors&&(this._diffNavigator.destroy(),
this._editors.forEach(function(a){a.destroy()}),this._uiFactory.destroy())};a.prototype.addRulers=function(){if(this._editors&&!this._hasRuler){var a=new c.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"}),b=new c.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._editors[1].getTextView().addRuler(a);this._editors[0].getTextView().addRuler(b);
this._editors[0].getTextView().addRuler(this._overviewRuler);this._hasRuler=!0}};a.prototype.refresh=function(a){if(this._imageMode){this.options.commandProvider&&this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,this._uiFactory.getEditorParentDiv(!0)).then(function(a){return b._loadImageFile(b.options.oldFile.URL,b._uiFactory.getEditorParentDiv()).then(function(b){return(new l).resolve(a>b?a:b)})})}var d=this.options.oldFile.Content,
c=this.options.newFile.Content,e=this.options.diffContent;"string"===typeof c?e=this._generateMapper(d,c,e,this.options.hasConflicts):(e=this._generateMapper(d,c,e,this.options.hasConflicts),c=e.output);var f=new p.TwoWayDiffBlockFeeder(this._editors[0].getTextView().getModel(),e.mapper,1,this.options.newFileOnRight),g=new p.TwoWayDiffBlockFeeder(this._editors[1].getTextView().getModel(),e.mapper,0,this.options.newFileOnRight);this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editors[0],
this._editors[1],f,g,this._overviewRuler,this._curveRuler);this._curveRuler.init(e.mapper,this._editors[1],this._editors[0],this._diffNavigator);a&&(this._editors[1].setInput(this.options.newFile.Name,null,c),this._editors[0].setInput(this.options.oldFile.Name,null,d));this._initSyntaxHighlighter([{fileName:this.options.newFile.Name,contentType:this.options.newFile.Type,editor:this._editors[1]},{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,editor:this._editors[0]}]);this._highlightSyntax();
this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();2===this._viewLoadedCounter&&this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);this.refreshTitle(0);this.refreshTitle(1);a=this._editors[1].getTextView().getModel().getLineCount()*this._editors[1].getTextView().getLineHeight()+5;d=this._editors[0].getTextView().getModel().getLineCount()*this._editors[0].getTextView().getLineHeight()+5;return a>d?a:d};a.prototype.refreshTitle=
function(a,b){if(1===a){var d=this._uiFactory.getTitleDiv(!0);d&&(k.empty(d),d.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.newFile.Name+"*":this.options.newFile.Name)))}else if(d=this._uiFactory.getTitleDiv(!1))k.empty(d),d.appendChild(document.createTextNode(b||this._editors[a].isDirty()?this.options.oldFile.Name+"*":this.options.oldFile.Name))};return a}();w.InlineCompareView=function(){function e(a){this.setOptions(a,!0);this._diffNavigator=new p.DiffTreeNavigator("word");
this.type="inline";this.options.commandProvider&&this.options.commandProvider.initCommands(this);this._editorDiv=this.options.parentDivId}e.prototype=new w.CompareView;e.prototype.addRulers=function(){this._textView&&!this._hasRuler&&(this._textView.addRuler(this._rulerOrigin),this._textView.addRuler(this._rulerNew),this._textView.addRuler(this._overviewRuler),this._hasRuler=!0)};e.prototype.removeRulers=function(){this._textView&&this._hasRuler&&(this._textView.removeRuler(this._rulerOrigin),this._textView.removeRuler(this._rulerNew),
this._textView.removeRuler(this._overviewRuler),this._hasRuler=!1)};e.prototype.destroyEditor=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.setText(""),this.removeRulers())};e.prototype.destroy=function(){this._textView&&(this._diffNavigator.destroy(),this._textView.destroy())};e.prototype.initEditors=function(a){var e=k.node(this._editorDiv),f=function(){return new d.TextView({parent:e,readonly:!0,tabSize:4})}.bind(this);this._editor=new h.Editor({textViewFactory:f,undoStackFactory:new b.UndoFactory,
annotationFactory:new b.AnnotationFactory,domNode:e});this._editor.installTextView();this._editor.setInput(null,null,a);this._editor.setOverviewRulerVisible(!1);this._editor.setAnnotationRulerVisible(!1);this._textView=this._editor.getTextView();this._rulerOrigin=new c.LineNumberCompareRuler(this._diffNavigator,1,"left",{styleClass:"ruler lines inlineRulerLeft"},{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._rulerNew=new c.LineNumberCompareRuler(this._diffNavigator,0,"left",{styleClass:"ruler lines"},
{styleClass:"rulerLines odd"},{styleClass:"rulerLines even"});this._overviewRuler=new c.CompareOverviewRuler("right",{styleClass:"ruler overview"},null,function(a,b){this._diffNavigator.matchPositionFromOverview(a)}.bind(this));this._textView.addEventListener("Selection",function(a){!(a.newValue&&a.newValue.start!==a.newValue.end)&&!this._diffNavigator.autoSelecting&&this._diffNavigator.editorWrapper[0].diffFeeder&&(a=this._textView.getCaretOffset(),this._diffNavigator.gotoDiff(a,this._textView))}.bind(this))};
e.prototype.initImageMode=function(){this._editor&&(this._editor.destroy(),this._editor=null);k.node(this._editorDiv).classList.add("compareEditorParentImageMode");this._imageMode=!0};e.prototype.getImageMode=function(){return this._imageMode};e.prototype._initDiffPosition=function(a){var b=a.getModel();if(b&&b.getAnnotations&&(b=b.getAnnotations(),0<b.length)){var b=b[0][0],d=a.getLineHeight(),c=a.getClientArea(),d=Math.floor(c.height/d/3);a.setTopIndex(0<b-d?b-d:0)}};e.prototype.refresh=function(){if(this._imageMode){this.options.commandProvider&&
this.options.commandProvider.renderCommands(this);var b=this;return this._loadImageFile(this.options.newFile.URL,k.node(this._editorDiv),!0).then(function(a){return b._loadImageFile(b.options.oldFile.URL,k.node(b._editorDiv)).then(function(b){return(new l).resolve(a+b+20)})})}var d=this.options.oldFile.Content,c=this.options.newFile.Content,e=this._generateMapper(d,c,this.options.diffContent,this.options.hasConflicts,!this.options.toggler);"string"!==typeof c&&(c=e.output);this._textView.getModel().setText(d);
d=new p.inlineDiffBlockFeeder(e.mapper,1);c=new p.inlineDiffBlockFeeder(e.mapper,0);a.mergeDiffBlocks(this._textView.getModel(),c.getDiffBlocks(),e.mapper,e.diffArray.array,e.diffArray.index,this._diffParser._lineDelimiter);d.setModel(this._textView.getModel());c.setModel(this._textView.getModel());this._diffNavigator.initAll(this.options.charDiff?"char":"word",this._editor,this._editor,d,c,this._overviewRuler);this._initSyntaxHighlighter([{fileName:this.options.oldFile.Name,contentType:this.options.oldFile.Type,
editor:this._editor}]);this._highlightSyntax();this.options.commandProvider&&this.options.commandProvider.renderCommands(this);this.addRulers();e=this._textView.getTopIndex();this._textView.redrawLines(e,e+1,this._overviewRuler);this._textView.redrawLines(e,e+1,this._rulerOrigin);this._textView.redrawLines(e,e+1,this._rulerNew);this._diffNavigator.gotoBlock(this.options.blockNumber-1,this.options.changeNumber-1);return this._textView.getLineHeight()*this._textView.getModel().getLineCount()+5};e.prototype.setConflicting=
function(a){this._conflcit=a};return e}();w.toggleableCompareView=function(){function a(b,d){d&&(d.toggler=this);this._widget="inline"===b?new w.InlineCompareView(d):new w.TwoWayCompareView(d)}a.prototype={startup:function(){this._widget.startup()},initImageMode:function(){this._imageMode=!0;this._widget.initImageMode()},toggle:function(){var a=this._widget.options;if(!this._imageMode){var b=this._widget.getCurrentDiffPos();a.blockNumber=b.block;a.changeNumber=b.change}this._widget.destroy();k.empty(k.node(a.parentDivId));
this._widget="inline"===this._widget.type?new w.TwoWayCompareView(a):new w.InlineCompareView(a);this._imageMode?this._widget.initImageMode():this._widget.initEditors();this._widget.refresh(!0)},getWidget:function(){return this._widget}};return a}();return w});
define("orion/editor/stylers/lib/syntax",[],function(){return{id:"orion.lib",grammars:[{id:"orion.lib",repository:{brace_open:{match:"{",name:"punctuation.section.block.begin"},brace_close:{match:"}",name:"punctuation.section.block.end"},bracket_open:{match:"\\[",name:"punctuation.section.bracket.begin"},bracket_close:{match:"\\]",name:"punctuation.section.bracket.end"},parenthesis_open:{match:"\\(",name:"punctuation.section.parens.begin"},parenthesis_close:{match:"\\)",name:"punctuation.section.parens.end"},
doc_block:{begin:{match:"/\\*\\*",literal:"/**"},end:{match:"\\*/",literal:"*/"},name:"comment.block.documentation",patterns:[{match:"@(?:(?!\\*/)\\S)*",name:"keyword.other.documentation.tag"},{match:"\\\x3c\\S*\\\x3e",name:"keyword.other.documentation.markup"},{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]},number_decimal:{match:"\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:[eE][+-]?\\d+)?\\b",name:"constant.numeric.number"},
number_hex:{match:"\\b0[xX][0-9A-Fa-f]+\\b",name:"constant.numeric.hex"},string_doubleQuote:{match:'"(?:\\\\.|[^"])*"?',name:"string.quoted.double"},string_singleQuote:{match:"'(?:\\\\.|[^'])*'?",name:"string.quoted.single"},todo_comment_singleLine:{match:"(\\b)(TODO)(\\b)(.*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.line"}}}}},{id:"orion.c-like",repository:{comment_singleLine:{match:{match:"//.*",literal:"//"},name:"comment.line.double-slash",
patterns:[{include:"orion.lib#todo_comment_singleLine"}]},comment_block:{begin:{match:"/\\*",literal:"/*"},end:{match:"\\*/",literal:"*/"},name:"comment.block",patterns:[{match:"(\\b)(TODO)(\\b)(((?!\\*/).)*)",name:"meta.annotation.task.todo",captures:{2:{name:"keyword.other.documentation.task"},4:{name:"comment.block"}}}]}}}],keywords:[]}});
define("orion/editor/stylers/application_javascript/syntax",["orion/editor/stylers/lib/syntax"],function(g){var l="break case class catch continue const debugger default delete do else enum export extends false finally for function if implements import in instanceof interface let new null package private protected public return static super switch this throw true try typeof undefined var void while with yield".split(" ");g=g.grammars;g.push({id:"orion.js",contentTypes:["application/javascript"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",
end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.js"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.js"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{match:"/(?![\\s\\*])(?:\\\\.|[^/])+/(?:[gim]{0,3})",name:"string.regexp.js"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},
{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+l.join("|")+")\\b",name:"keyword.control.js"}]});return{id:g[g.length-1].id,grammars:g,keywords:l}});
define("orion/editor/stylers/text_x-java-source/syntax",["orion/editor/stylers/lib/syntax"],function(g){var l="abstract boolean break byte case catch char class continue default do double else extends false final finally float for if implements import instanceof int interface long native new null package private protected public return short static super switch synchronized this throw throws transient true try void volatile while".split(" ");g=g.grammars;g.push({id:"orion.java",contentTypes:["text/x-java-source"],
patterns:[{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_singleLine"},{include:"orion.lib#doc_block"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"orion.lib#number_hex"},{match:"\\b(?:"+
l.join("|")+")\\b",name:"keyword.control.java"}],repository:{string_singleQuote:{}}});return{id:g[g.length-1].id,grammars:g,keywords:l}});
define("orion/editor/stylers/text_css/syntax",["orion/editor/stylers/lib/syntax"],function(g){var l="alignment-adjust alignment-baseline animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function animation appearance azimuth backface-visibility background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size background baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-bottom border-collapse border-color border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-image border-left-color border-left-style border-left-width border-left border-radius border-right-color border-right-style border-right-width border-right border-spacing border-style border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-top border-width border bottom box-align box-decoration-break box-direction box-flex-group box-flex box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing break-after break-before break-inside caption-side clear clip color-profile color column-count column-fill column-gap column-rule-color column-rule-style column-rule-width column-rule column-span column-width columns content counter-increment counter-reset crop cue-after cue-before cue cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit-position fit flex-align flex-flow flex-inline-pack flex-order flex-pack float-offset float font-family font-size font-size-adjust font-stretch font-style font-variant font-weight font grid-columns grid-rows hanging-punctuation height hyphenate-after hyphenate-before hyphenate-character hyphenate-lines hyphenate-resource hyphens icon image-orientation image-rendering image-resolution inline-box-align left letter-spacing line-height line-stacking-ruby line-stacking-shift line-stacking-strategy line-stacking list-style-image list-style-position list-style-type list-style margin-bottom margin-left margin-right margin-top margin mark-after mark-before mark marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity orphans outline-color outline-offset outline-style outline-width outline overflow-style overflow-x overflow-y overflow padding-bottom padding-left padding-right padding-top padding page-break-after page-break-before page-break-inside page-policy page pause-after pause-before pause perspective-origin perspective phonemes pitch-range pitch play-during position presentation-level punctuation-trim quotes rendering-intent resize rest-after rest-before rest richness right rotation-point rotation ruby-align ruby-overhang ruby-position ruby-span size speak-header speak-numeral speak-punctuation speak speech-rate stress string-set table-layout target-name target-new target-position target text-align-last text-align text-decoration text-emphasis text-height text-indent text-justify text-outline text-shadow text-transform text-wrap top transform-origin transform-style transform transition-delay transition-duration transition-property transition-timing-function transition unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch-range voice-pitch voice-rate voice-stress voice-volume volume white-space-collapse white-space widows width word-break word-spacing word-wrap z-index".split(" ");g=
g.grammars;g.push({id:"orion.css",contentTypes:["text/css"],patterns:[{begin:"'(?:\\\\.|[^\\\\'])*\\\\$",end:"^(?:$|(?:\\\\.|[^\\\\'])*('|[^\\\\]$))",name:"string.quoted.single.css"},{begin:'"(?:\\\\.|[^\\\\"])*\\\\$',end:'^(?:$|(?:\\\\.|[^\\\\"])*("|[^\\\\]$))',name:"string.quoted.double.css"},{include:"orion.lib#string_doubleQuote"},{include:"orion.lib#string_singleQuote"},{include:"orion.c-like#comment_block"},{include:"orion.lib#brace_open"},{include:"orion.lib#brace_close"},{include:"orion.lib#bracket_open"},
{include:"orion.lib#bracket_close"},{include:"orion.lib#parenthesis_open"},{include:"orion.lib#parenthesis_close"},{include:"orion.lib#number_decimal"},{include:"#number_hex"},{match:"(?i)\\b-?(?:\\.\\d+|\\d+\\.?\\d*)(?:%|em|ex|ch|rem|vw|vh|vmin|vmax|in|cm|mm|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?\\b",name:"constant.numeric.value.css"},{match:"(?:-webkit-|-moz-|-ms-|\\b)(?:"+l.join("|")+")\\b",name:"keyword.control.css"}],repository:{number_hex:{match:"#[0-9A-Fa-f]+\\b",name:"constant.numeric.hex.css"}}});
return{id:g[g.length-1].id,grammars:g,keywords:l}});
define("examples/editor/textStyler",["orion/editor/annotations","orion/editor/stylers/application_javascript/syntax","orion/editor/stylers/text_x-java-source/syntax","orion/editor/stylers/text_css/syntax"],function(g,l,k,e){function c(a,b){this.keywords=a;this.whitespacesVisible=b;this.setText("")}function h(){c.call(this,null,!0)}function b(a){c.call(this,null,a)}function f(){c.call(this,null,!1)}function d(d,e,g){this.commentStart="/*";this.commentEnd="*/";var k=[];switch(e){case "java":k=a;break;
case "js":k=m;break;case "css":k=n}this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectHyperlinks=!0;this.highlightCaretLine=!1;this.detectTasks=this.foldingEnabled=!0;this._scanner=new c(k,this.whitespacesVisible);this._firstScanner=new f;this._commentScanner=new b(this.whitespacesVisible);this._whitespaceScanner=new h;"css"===e&&(this._scanner.isCSS=!0,this._firstScanner.isCSS=!0);this.view=d;this.annotationModel=g;this._bracketAnnotations=void 0;var l=this;this._listener=
{onChanged:function(a){l._onModelChanged(a)},onDestroy:function(a){l._onDestroy(a)},onLineStyle:function(a){l._onLineStyle(a)},onMouseDown:function(a){l._onMouseDown(a)},onSelection:function(a){l._onSelection(a)}};e=d.getModel();e.getBaseModel&&(e=e.getBaseModel());e.addEventListener("Changed",this._listener.onChanged);d.addEventListener("MouseDown",this._listener.onMouseDown);d.addEventListener("Selection",this._listener.onSelection);d.addEventListener("Destroy",this._listener.onDestroy);d.addEventListener("LineStyle",
this._listener.onLineStyle);this._computeComments();this._computeFolding();d.redrawLines()}var m=l.keywords,a=k.keywords,n=e.keywords,p={styleClass:"comment"},t={styleClass:"comment"},r={styleClass:"comment block documentation"},s={styleClass:"keyword other documentation markup"},w={styleClass:"keyword other documentation task"},v={styleClass:"keyword other documentation tag"},u={styleClass:"string"},y={styleClass:"constant numeric"},x={styleClass:"keyword"},z={styleClass:"punctuation separator space",
unmergeable:!0},q={styleClass:"punctuation separator tab",unmergeable:!0},A={styleClass:"meta annotation currentLine"};c.prototype={getOffset:function(){return this.offset},getStartOffset:function(){return this.startOffset},getData:function(){return this.text.substring(this.startOffset,this.offset)},getDataLength:function(){return this.offset-this.startOffset},_default:function(a){switch(a){case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);
return 9;case 123:case 125:case 40:case 41:case 91:case 93:case 60:case 62:return a;default:var b=this.isCSS,d=this.offset-1;if(!b&&48<=a&&57>=a){var c=b=!1,e=!1,f=a;do if(a=this._read(),46===a&&!b)b=!0;else if(101===a&&!c)b=c=!0,a=this._read(),45!==a&&this._unread(a);else if(120===a&&48===f&&2===this.offset-d)b=c=e=!0;else if(!(48<=a&&57>=a||e&&(65<=a&&70>=a||97<=a&&102>=a)))break;while(1);this._unread(a);return 3}if(97<=a&&122>=a||65<=a&&90>=a||95===a||45===a&&b){do a=this._read();while(97<=a&&
122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a||45===a&&b);this._unread(a);a=this.keywords;if(0<a.length){d=this.text.substring(d,this.offset);for(b=0;b<a.length;b++)if(this.keywords[b]===d)return 2}}return 1}},_read:function(){return this.offset<this.text.length?this.text.charCodeAt(this.offset++):-1},_unread:function(a){-1!==a&&this.offset--},nextToken:function(){for(this.startOffset=this.offset;;){var a=this._read(),b;switch(a){case -1:return null;case 47:a=this._read();if(!this.isCSS&&47===a)for(;;)if(a=
this._read(),-1===a||10===a||13===a)return this._unread(a),6;if(42===a){a=this._read();b=7;for(42===a&&(b=8);;){for(;42===a;)if(a=this._read(),47===a)return b;if(-1===a)return this._unread(a),b;a=this._read()}}this._unread(a);return 1;case 39:for(b=4;;)switch(a=this._read(),a){case 39:return b;case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;case 34:for(b=4;;)switch(a=this._read(),a){case 34:return b;
case 13:case 10:case -1:return this._unread(a),b;case 92:switch(a=this._read(),a){case 10:b=5;break;case 13:b=5,a=this._read(),10!==a&&this._unread(a)}}break;default:return this._default(a)}}},setText:function(a){this.text=a;this.startOffset=this.offset=0}};h.prototype=new c(null);h.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:return 11;case 9:return 10;default:do a=this._read();while(!(32===a||9===a||-1===a));this._unread(a);
return 1}}};b.prototype=new c(null);b.prototype.setType=function(a){this._type=a};b.prototype.nextToken=function(){for(this.startOffset=this.offset;;){var a=this._read();switch(a){case -1:return null;case 32:case 9:if(this.whitespacesVisible)return 32===a?11:10;do a=this._read();while(32===a||9===a);this._unread(a);return 9;case 60:if(8===this._type){do a=this._read();while(!(62===a||-1===a));if(62===a)return 12}return 1;case 64:if(8===this._type){do a=this._read();while(97<=a&&122>=a||65<=a&&90>=
a||95===a||48<=a&&57>=a);this._unread(a);return 13}return 1;case 84:if(79===(a=this._read()))if(68===(a=this._read()))if(79===(a=this._read()))if(a=this._read(),!(97<=a&&122>=a||65<=a&&90>=a||95===a||48<=a&&57>=a))return this._unread(a),14;this._unread(a);default:do a=this._read();while(!(32===a||9===a||-1===a||60===a||64===a||84===a));this._unread(a);return 1}}};f.prototype=new c(null);f.prototype._default=function(a){for(;;)switch(a=this._read(),a){case 47:case 34:case 39:case -1:return this._unread(a),
1}};d.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,
b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,this._scanner.whitespacesVisible=a,this._commentScanner.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){this.detectHyperlinks=
a},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,d,c,e){var f;void 0===c&&(c=-1);for(void 0===e&&(e=a.length);1<e-c;)if(f=Math.floor((e+c)/2),b<=a[f].start)e=f;else if(d&&b<a[f].end){e=f;break}else c=f;return e},_computeComments:function(){var a=this.view.getModel();a.getBaseModel&&(a=a.getBaseModel());this.comments=this._findComments(a.getText())},_computeFolding:function(){if(this.foldingEnabled){var a=this.view.getModel();
if(a.getBaseModel){var b=this.annotationModel;if(b){b.removeAnnotations(g.AnnotationType.ANNOTATION_FOLDING);for(var d=[],c=a.getBaseModel(),e=this.comments,f=0;f<e.length;f++){var h=e[f];(h=this._createFoldingAnnotation(a,c,h.start,h.end))&&d.push(h)}b.replaceAnnotations(null,d)}}}},_createFoldingAnnotation:function(a,b,d,c){var e=b.getLineAtOffset(d);b=b.getLineAtOffset(c);return e===b?null:new (g.AnnotationType.getType(g.AnnotationType.ANNOTATION_FOLDING))(d,c,a)},_computeTasks:function(a,b,d){if(this.detectTasks){var c=
this.annotationModel;if(c){var e=this.view.getModel(),f=e;e.getBaseModel&&(f=e.getBaseModel());for(var h=c.getAnnotations(b,d),e=[],m=g.AnnotationType.ANNOTATION_TASK;h.hasNext();){var k=h.next();k.type===m&&e.push(k)}h=[];k=this._commentScanner;k.setText(f.getText(b,d));for(var l;l=k.nextToken();){var n=k.getStartOffset()+b;14===l&&(l=f.getLineEnd(f.getLineAtOffset(n)),6!==a&&(l=Math.min(l,d-this.commentEnd.length)),h.push(g.AnnotationType.createAnnotation(m,n,l,f.getText(n,l))))}c.replaceAnnotations(e,
h)}}},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,d=b.getModel(),b=b.getSelection();if(b.start===b.end&&d.getLineAtOffset(b.start)===a)return A}return null},_getStyles:function(a,b,d){a.getBaseModel&&(d=a.mapOffset(d));for(var c=d+b.length,e=[],f=d,g=this.comments,h=this._binarySearch(g,d,!0);h<g.length&&!(g[h].start>=c);h++){var m=g[h].start,k=g[h].end;f<m&&this._parse(b.substring(f-d,m-d),f,e);var l=g[h].type,n;switch(l){case 8:n=r;break;case 7:n=t;break;case 5:n=u}f=Math.max(f,
m);m=Math.min(c,k);(8===l||7===l)&&(this.whitespacesVisible||this.detectHyperlinks)?this._parseComment(b.substring(f-d,m-d),f,e,n,l):5===l&&this.whitespacesVisible?this._parseString(b.substring(f-d,m-d),f,e,u):e.push({start:f,end:m,style:n});f=k}f<c&&this._parse(b.substring(f-d,c-d),f,e);if(a.getBaseModel)for(b=0;b<e.length;b++)d=e[b].end-e[b].start,e[b].start=a.mapOffset(e[b].start,!0),e[b].end=e[b].start+d;return e},_parse:function(a,b,d){var c=this._scanner;for(c.setText(a);a=c.nextToken();){var e=
c.getStartOffset()+b,f=null;switch(a){case 2:f=x;break;case 3:f=y;break;case 5:case 4:if(this.whitespacesVisible){this._parseString(c.getData(),e,d,u);continue}else f=u;break;case 8:this._parseComment(c.getData(),e,d,r,a);continue;case 6:this._parseComment(c.getData(),e,d,p,a);continue;case 7:this._parseComment(c.getData(),e,d,t,a);continue;case 10:this.whitespacesVisible&&this.tabsVisible&&(f=q);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(f=z)}d.push({start:e,end:c.getOffset()+b,
style:f})}},_parseComment:function(a,b,d,c,e){var f=this._commentScanner;f.setText(a);for(f.setType(e);a=f.nextToken();){e=f.getStartOffset()+b;var g=c;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=q);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=z);break;case 12:g=s;break;case 13:g=v;break;case 14:g=w;break;default:this.detectHyperlinks&&(g=this._detectHyperlinks(f.getData(),e,d,g))}g&&d.push({start:e,end:f.getOffset()+b,style:g})}},_parseString:function(a,b,d,c){var e=
this._whitespaceScanner;for(e.setText(a);a=e.nextToken();){var f=e.getStartOffset()+b,g=c;switch(a){case 10:this.whitespacesVisible&&this.tabsVisible&&(g=q);break;case 11:this.whitespacesVisible&&this.spacesVisible&&(g=z)}g&&d.push({start:f,end:e.getOffset()+b,style:g})}},_detectHyperlinks:function(a,b,d,c){var e=null,f;if(0<(f=a.indexOf("://"))){for(var e=a,g=f;0<g;){f=e.charCodeAt(g-1);if(!(97<=f&&122>=f||65<=f&&90>=f||45===f||48<=f&&57>=f))break;g--}if(0<g&&(f="\"\"''(){}[]\x3c\x3e".indexOf(e.substring(g-
1,g)),-1!==f&&0===(f&1)&&-1!==(f=e.lastIndexOf("\"\"''(){}[]\x3c\x3e".substring(f+1,f+2))))){var h=f;f=this._clone(c);f.tagName="a";f.attributes={href:e.substring(g,h)};d.push({start:b,end:b+g,style:c});d.push({start:b+g,end:b+h,style:f});d.push({start:b+h,end:b+a.length,style:c});return null}}else 0===a.toLowerCase().indexOf("bug#")&&(e="https://bugs.eclipse.org/bugs/show_bug.cgi?id\x3d"+parseInt(a.substring(4),10));return e?(f=this._clone(c),f.tagName="a",f.attributes={href:e},f):c},_clone:function(a){if(!a)return a;
var b={},d;for(d in a)a.hasOwnProperty(d)&&(b[d]=a[d]);return b},_findComments:function(a,b){b=b||0;var d=this._firstScanner,c;d.setText(a);for(var e=[];c=d.nextToken();)(7===c||8===c||5===c)&&e.push({start:d.getStartOffset()+b,end:d.getOffset()+b,type:c}),(6===c||7===c||8===c)&&this._computeTasks(c,d.getStartOffset()+b,d.getOffset()+b);return e},_findMatchingBracket:function(a,b){var d="{}()[]\x3c\x3e",c=a.getText(b,b+1),e=d.indexOf(c,0);if(-1===e)return-1;var f;f=e&1?d.substring(e-1,e):d.substring(e+
1,e+2);for(var g=a.getLineAtOffset(b),d=a.getLine(g),h=a.getLineStart(g),m=a.getLineEnd(g),d=this._findBrackets(c,f,d,h,h,m),m=0;m<d.length;m++)if(h=0<=d[m]?1:-1,d[m]*h-1===b){var k=1;if(e&1){for(m--;0<=m;m--)if(h=0<=d[m]?1:-1,k+=h,0===k)return d[m]*h-1;for(g-=1;0<=g;){d=a.getLine(g);h=a.getLineStart(g);m=a.getLineEnd(g);d=this._findBrackets(c,f,d,h,h,m);for(e=d.length-1;0<=e;e--)if(h=0<=d[e]?1:-1,k+=h,0===k)return d[e]*h-1;g--}}else{for(m++;m<d.length;m++)if(h=0<=d[m]?1:-1,k+=h,0===k)return d[m]*
h-1;g+=1;for(e=a.getLineCount();g<e;){d=a.getLine(g);h=a.getLineStart(g);m=a.getLineEnd(g);d=this._findBrackets(c,f,d,h,h,m);for(m=0;m<d.length;m++)if(h=0<=d[m]?1:-1,k+=h,0===k)return d[m]*h-1;g++}}break}return-1},_findBrackets:function(a,b,d,c,e,f){var g=[];a=a.charCodeAt(0);b=b.charCodeAt(0);for(var h=e,m=this._scanner,k,l=this.comments,n=this._binarySearch(l,e,!0);n<l.length&&!(l[n].start>=f);n++){k=l[n].start;var q=l[n].end;if(h<k)for(m.setText(d.substring(h-e,k-e));k=m.nextToken();)k===a?g.push(m.getStartOffset()+
h-e+c+1):k===b&&g.push(-(m.getStartOffset()+h-e+c+1));h=q}if(h<f)for(m.setText(d.substring(h-e,f-e));k=m.nextToken();)k===a?g.push(m.getStartOffset()+h-e+c+1):k===b&&g.push(-(m.getStartOffset()+h-e+c+1));return g},_onDestroy:function(a){this.destroy()},_onLineStyle:function(a){a.textView===this.view&&(a.style=this._getLineStyle(a.lineIndex));a.ranges=this._getStyles(a.textView.getModel(),a.lineText,a.lineStart)},_onSelection:function(a){var b=a.oldValue,d=a.newValue,c=this.view;a=c.getModel();var e;
if(this.highlightCaretLine){var f=a.getLineAtOffset(b.start);e=a.getLineAtOffset(d.start);var h=d.start===d.end,b=b.start===b.end;f===e&&b&&h||(b&&c.redrawLines(f,f+1),(f!==e||!b)&&h&&c.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,m,k;if(d.start===d.end&&0<(k=c.getCaretOffset()))k-=1,a.getBaseModel&&(k=a.mapOffset(k),a=a.getBaseModel()),a=this._findMatchingBracket(a,k),-1!==a&&(m=[g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,a+1),
g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_CURRENT_BRACKET,k,k+1)]);this._bracketAnnotations=m;this.annotationModel.replaceAnnotations(b,m)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,d=b.getModel(),c=b.getOffsetAtLocation(a.x,a.y);if(0<c){var e=c-1,f=d;d.getBaseModel&&(e=d.mapOffset(e),f=d.getBaseModel());e=this._findMatchingBracket(f,e);-1!==e&&(a.preventDefault(),a=e,d.getBaseModel&&(a=d.mapOffset(a,!0)),c>a&&(c--,a++),b.setSelection(a,c))}}},_onModelChanged:function(a){var b=
a.start,d=a.removedCharCount,c=a.addedCharCount-d,e=this.view;a=e.getModel();var f=a.getBaseModel?a.getBaseModel():a,d=b+d,h=f.getCharCount(),m=this.comments.length,k=f.getLineStart(f.getLineAtOffset(b)),l=this._binarySearch(this.comments,k,!0),n=this._binarySearch(this.comments,d,!1,l-1,m);l<m&&this.comments[l].start<=k&&k<this.comments[l].end?(k=this.comments[l].start,k>b&&(k+=c)):k=l===m&&0<m&&h-c===this.comments[m-1].end?this.comments[m-1].start:k;var q;n<m?(q=this.comments[n].end,q>b&&(q+=c),
n+=1):(n=m,q=h);for(var h=f.getText(k,q),p,h=this._findComments(h,k),m=l;m<this.comments.length;m++)p=this.comments[m],p.start>b&&(p.start+=c),p.start>b&&(p.end+=c);var A=n-l!==h.length;if(!A)for(m=0;m<h.length;m++){p=this.comments[l+m];var x=h[m];if(p.start!==x.start||p.end!==x.end||p.type!==x.type){A=!0;break}}m=[l,n-l].concat(h);Array.prototype.splice.apply(this.comments,m);A&&(m=k,p=q,a!==f&&(m=a.mapOffset(m,!0),p=a.mapOffset(p,!0)),e.redrawRange(m,p));if(this.foldingEnabled&&f!==a&&this.annotationModel){e=
this.annotationModel;l=e.getAnnotations(k,q);k=[];for(q=[];l.hasNext();)if(p=l.next(),p.type===g.AnnotationType.ANNOTATION_FOLDING){q.push(p);for(m=0;m<h.length&&!(p.start===h[m].start&&p.end===h[m].end);m++);m===h.length?(k.push(p),p.expand()):(m=p.start,n=p.end,m>b&&(m-=c),n>b&&(n-=c),m<=b&&b<n&&m<=d&&d<n&&(m=f.getLineAtOffset(p.start),n=f.getLineAtOffset(p.end),m!==n?p.expanded||p.expand():e.removeAnnotation(p)))}b=[];for(m=0;m<h.length;m++){p=h[m];for(c=0;c<q.length&&!(q[c].start===p.start&&q[c].end===
p.end);c++);c===q.length&&(p=this._createFoldingAnnotation(a,f,p.start,p.end))&&b.push(p)}e.replaceAnnotations(k,b)}}};return{TextStyler:d}});
define("orion/editor/textStyler",["orion/editor/annotations"],function(g){function l(a,b){this._unnamedCounter=0;this._patterns=[];this._rootId=b;a.forEach(function(a){this._addRepositoryPatterns(a.repository||{},a.id);this._addPatterns(a.patterns||[],a.id)}.bind(this))}function k(a,b,d,c,e){this.start=a.start;this.end=a.end;this.contentStart=a.contentStart;this.contentEnd=a.contentEnd;this.pattern=b;this._styler=d;this._parent=e;this._linePatterns=[];this._blockPatterns=[];this._enclosurePatterns=
{};c&&(this._initPatterns(),this._subBlocks=u(c,c.getText(this.start,this.end),this,this.start))}function e(a){this._styler=a}function c(a,b,d,c){this.highlightCaretLine=this.whitespacesVisible=this.spacesVisible=this.tabsVisible=!1;this.detectTasks=this.foldingEnabled=!0;this.view=a;this.annotationModel=b;this.patternManager=new l(d,c);this._accessor=new e(this);this._bracketAnnotations=void 0;var f=this;this._listener={onChanged:function(a){f._onModelChanged(a)},onDestroy:function(a){f._onDestroy(a)},
onLineStyle:function(a){f._onLineStyle(a)},onMouseDown:function(a){f._onMouseDown(a)},onSelection:function(a){f._onSelection(a)}};d=a.getModel();d.getBaseModel&&(d=d.getBaseModel());d.addEventListener("Changed",this._listener.onChanged);a.addEventListener("MouseDown",this._listener.onMouseDown);a.addEventListener("Selection",this._listener.onSelection);a.addEventListener("Destroy",this._listener.onDestroy);a.addEventListener("LineStyle",this._listener.onLineStyle);c=d.getCharCount();this._rootBlock=
new k({start:0,contentStart:0,end:c,contentEnd:c},null,this,d);this._computeFolding(this._rootBlock.getBlocks());b&&this.detectTasks&&(c=[],y(this._rootBlock,d,c),b.replaceAnnotations([],c));a.redrawLines()}var h={styleClass:"meta annotation currentLine"},b=/$/,f=/\\(\d)/g,d=/^\(\?i\)\s*/,m=/(.*)(?:[\r\n]|$)/g,a={regex:/[ ]/g,style:{styleClass:"punctuation separator space",unmergeable:!0}},n={regex:/\t/g,style:{styleClass:"punctuation separator tab",unmergeable:!0}},p=function(a,b,d,c){var e=d,f=
a.lastIndex;m.lastIndex=d;d=m.exec(b);var g,h;a.lastIndex=0;if(d){for(h=d.index;0<=--h&&!(g=b.charAt(h),"\n"===g||"\r"===g););g=b.substring(h+1,d.index+d[1].length);a.lastIndex=h=d.index-h-1}for(;d&&d.index<b.length;){var k;if(c){var l=a.lastIndex;a.test(g)&&(a.lastIndex=l,k=a.exec(g))}else k=a.exec(g);if(k)return k.index+=e,k.index-=h,a.lastIndex=f,k;h=0;e+=d[0].length;if(d=m.exec(b))g=d[1],a.lastIndex=0}a.lastIndex=f;return null},t=function(a,b){var d=a.toString();f.lastIndex=0;if(!f.test(d))return a;
f.lastIndex=0;for(var c=f.exec(d);c;)d=d.replace(c[0],b[c[1]]||""),f.lastIndex=0,c=f.exec(d);return RegExp(d.substring(1,d.length-1-1),"g")},r=function(a,b,d,c){if(b=p(a.pattern.regex?a.pattern.regex:a.pattern.regexBegin,b,c,!0)){a.result=b;for(c=0;c<d.length;c++)if(b.index<d[c].result.index||b.index===d[c].result.index&&a.pattern.pattern.index<d[c].pattern.pattern.index){d.splice(c,0,a);return}d.push(a)}},s=function(a,b,d,c){if(b[0])c.push({start:d,end:d+a[0].length,style:b[0].name});else for(var e=
0,f=1;f<a.length;f++)if(a[f]){var g=b[f];if(g){var h=d+e;c.push({start:h,end:h+a[f].length,style:g.name})}e+=a[f].length}},w=function(a,b,d){var c=a.start;b.forEach(function(b){c<=b.start&&d.push({start:c,end:b.start,style:a.style});d.push(b);c=b.end});c<a.end&&d.push({start:c,end:a.end,style:a.style})},v=function(a,d,c,e,f){if(a&&(c=c.getLinePatterns())){var g=[];c.forEach(function(b){var d=b.regex||b.regexBegin;d.oldLastIndex=d.lastIndex;(d=p(d,a,0))&&g.push({result:d,pattern:b})});g.sort(function(a,
b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0;0<g.length;){var m=g[0];g.splice(0,1);if(!(m.result.index<h)){var k=m.result.index,l,n=[];if(m.pattern.regex){h=m.result;l=k+h[0].length;l={start:d+k,end:d+l,style:m.pattern.pattern.name};if(!f){m.pattern.pattern.captures&&s(h,m.pattern.pattern.captures,d+k,n);n.sort(function(a,b){return a.start<b.start?-1:a.start>b.start?1:0});for(k=0;k<n.length-1;k++)if(n[k+
1].start<n[k].end){var v={start:n[k+1].end,end:n[k].end,style:n[k].style};n[k].end=n[k+1].start;n.splice(k+2,0,v)}}w(l,n,e)}else h=m.pattern.regexEnd,h=t(h,m.result),(h=p(h,a,m.result.index+m.result[0].length))||(b.lastIndex=0,h=b.exec(a)),l=h.index+h[0].length,e.push({start:d+k,end:d+l,style:m.pattern.pattern.name});h=h.index+h[0].length}r(m,a,g,h)}c.forEach(function(a){a=a.regex||a.regexBegin;a.lastIndex=a.oldLastIndex})}},u=function(a,d,c,e){if(!d)return[];var f=[],g=[];c.getBlockPatterns().forEach(function(a){var b=
p(a.regexBegin||a.regex,d,0);b&&g.push({result:b,pattern:a})}.bind(this));if(!g.length)return f;g.sort(function(a,b){return a.result.index<b.result.index?-1:a.result.index>b.result.index?1:a.pattern.pattern.index<b.pattern.pattern.index?-1:1});for(var h=0;0<g.length;){var m=g[0];g.splice(0,1);if(!(m.result.index<h)){var h=e+m.result.index,l=m.result.index,n=null,s=m.pattern.regexEnd;if(s){var l=l+m.result[0].length,w=m.pattern,G=t(s,m.result);G!==s&&(w={pattern:w.pattern,regexBegin:w.regexBegin,regexEnd:G},
s=G);for(G=l;!n;){(G=p(s,d,G))||(b.lastIndex=0,G=b.exec(d));var v=new k({start:h,end:e+G.index+G[0].length,contentStart:e+l,contentEnd:e+G.index},w,c.getStyler(),a,c),u=v.getBlocks();if(!u.length||u[u.length-1].end<=G.index+e)n=v;G=G.index+G[0].length}}else n=new k({start:h,end:h+m.result[0].length,contentStart:h,contentEnd:h+m.result[0].length},m.pattern,c.getStyler(),a,c);f.push(n);h=n.end-e}r(m,d,g,h)}return f},y=function(a,b,d){if(a.getAnnotationModel()){var c=g.AnnotationType.ANNOTATION_TASK;
if(a.getLinePatterns().length&&a.pattern&&a.pattern.pattern.name&&0===a.pattern.pattern.name.indexOf("comment")){var e=[];v(b.getText(a.contentStart,a.end),a.contentStart,a,e,!0);for(var f=0;f<e.length;f++)"meta.annotation.task.todo"===e[f].style&&d.push(g.AnnotationType.createAnnotation(c,e[f].start,e[f].end,b.getText(e[f].start,e[f].end)))}a.getBlocks().forEach(function(a){y(a,b,d)}.bind(this))}};l.prototype={getPatterns:function(a){a?(a="string"===typeof a?a:a.qualifiedId,a+="#"):a=this._rootId+
"#"+this._NO_ID;var b=[0],d={},c=RegExp("^"+a+"[^#]+$");this._patterns.forEach(function(a){c.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,d):(a.index=b[0]++,d[a.id]=a))}.bind(this));var e=[];Object.keys(d).forEach(function(a){e.push(d[a])});return e},_addPatterns:function(a,b){a.forEach(function(a){this._addPattern(a,this._NO_ID+this._unnamedCounter++,b)}.bind(this))},_addRepositoryPatterns:function(a,b){Object.keys(a).forEach(function(d){this._addPattern(a[d],d,b)}.bind(this))},_addPattern:function(a,
b,d){a.parentId=d;a.id=b;a.qualifiedId=a.parentId+"#"+a.id;this._patterns.push(a);a.patterns&&!a.include&&this._addPatterns(a.patterns,a.qualifiedId)},_processInclude:function(a,b,d){var c,e=a.include.indexOf("#");c=0===e?RegExp("^"+a.qualifiedId.substring(0,a.qualifiedId.indexOf("#"))+a.include+"$"):-1===e?RegExp("^"+a.include+"#"+this._NO_ID+"[^#]+$"):RegExp("^"+a.include+"$");this._patterns.forEach(function(a){c.test(a.qualifiedId)&&(a.include?this._processInclude(a,b,d):d[a.id]||(a.index=b[0]++,
d[a.id]=a))}.bind(this))},_NO_ID:"NoID"};k.prototype={adjustEnd:function(a){this.end+=a;this.contentEnd+=a;this._subBlocks.forEach(function(b){b.adjustEnd(a)})},adjustStart:function(a){this.start+=a;this.contentStart+=a;this._subBlocks.forEach(function(b){b.adjustStart(a)})},computeStyle:function(a,b){if(!this.pattern||!(this.start<=b&&b<this.end))return null;var d={start:this.start,end:this.end,style:this.pattern.pattern.name};if(this.contentStart<=b&&b<this.contentEnd)return this.pattern.pattern.contentName?
{start:this.contentStart,end:this.contentEnd,style:this.pattern.pattern.contentName}:d;var c,e,f,g;if(b<this.contentStart){e=this.pattern.pattern.beginCaptures||this.pattern.pattern.captures;if(!e)return d;c=this.pattern.regexBegin;f=a.getText(this.start,this.contentStart);g=this.start}else{e=this.pattern.pattern.endCaptures||this.pattern.pattern.captures;if(!e)return d;c=this.pattern.regexEnd;f=a.getText(this.contentEnd,this.end);g=this.contentEnd}c.lastIndex=0;if(f=c.exec(f)){c=[];s(f,e,g,c);for(e=
0;e<c.length;e++)if(c[e].start<=b&&b<c[e].end)return c[e]}return d},getAnnotationModel:function(){return this._styler._getAnnotationModel()},getBlockPatterns:function(){return this._blockPatterns},getBlocks:function(){return this._subBlocks},getEnclosurePatterns:function(){return this._enclosurePatterns},getLinePatterns:function(){return this._linePatterns},getParent:function(){return this._parent},getPatternManager:function(){return this._styler._getPatternManager()},getPatterns:function(){return this.getLinePatterns()},
getStyler:function(){return this._styler},isRenderingWhitespace:function(){return this._styler._isRenderingWhitespace()},_initPatterns:function(){if(this.pattern&&this.pattern.pattern._linePatterns)this._linePatterns=this.pattern.pattern._linePatterns,this._blockPatterns=this.pattern.pattern._blockPatterns,this._enclosurePatterns=this.pattern.pattern._enclosurePatterns;else{var a=function(a){a="string"===typeof a?a:a.match;var b=d.exec(a),c="g";b&&(a=a.substring(b[0].length),c+="i");return RegExp(a,
c)},b=-1,c=0;this.getPatternManager().getPatterns(this.pattern?this.pattern.pattern:null).forEach(function(d){var e;if(d.match&&!d.begin&&!d.end){if(e={regex:a(d.match),pattern:d},this._linePatterns.push(e),d.name&&0===d.name.indexOf("punctuation.section")&&(-1!==d.name.indexOf(".begin")||-1!==d.name.indexOf(".end")))this._enclosurePatterns[d.name]=e}else!d.match&&d.begin&&d.end&&(b=c,e={regexBegin:a(d.begin),regexEnd:a(d.end),pattern:d},this._linePatterns.push(e));c++}.bind(this));this._blockPatterns=
this._linePatterns.slice(0,b+1);this.pattern&&(this.pattern.pattern._enclosurePatterns=this._enclosurePatterns,this.pattern.pattern._linePatterns=this._linePatterns,this.pattern.pattern._blockPatterns=this._blockPatterns)}}};e.prototype={getPatterns:function(a){return this._styler.getPatterns(a)},getStyles:function(a){return this._styler.getStyles(a)}};c.prototype={destroy:function(){var a=this.view;if(a){var b=a.getModel();b.getBaseModel&&(b=b.getBaseModel());b.removeEventListener("Changed",this._listener.onChanged);
a.removeEventListener("MouseDown",this._listener.onMouseDown);a.removeEventListener("Selection",this._listener.onSelection);a.removeEventListener("Destroy",this._listener.onDestroy);a.removeEventListener("LineStyle",this._listener.onLineStyle);this.view=null}},getPatterns:function(a){return this._findBlock(this._rootBlock,a).getPatterns()},getStyleAccessor:function(){return this._accessor},getStyles:function(a){var b=[],d=this.view.getModel();d.getBaseModel&&(d=d.getBaseModel());var c=this._findBlock(this._rootBlock,
a),e=d.getLineAtOffset(a),f=d.getLine(e),g=[];v(f,d.getLineStart(e),c,g);for(e=0;e<g.length&&!(a<g[e].start);e++)if(g[e].start<=a&&a<g[e].end){b.push(g[e]);break}for(;c;)(g=c.computeStyle(d,a))&&b.splice(0,0,g),c=c.getParent();return b},setHighlightCaretLine:function(a){this.highlightCaretLine=a},setWhitespacesVisible:function(a,b){this.whitespacesVisible!==a&&(this.whitespacesVisible=a,b&&this.view.redraw())},setTabsVisible:function(a){this.tabsVisible!==a&&(this.tabsVisible=a,this.setWhitespacesVisible(this.tabsVisible||
this.spacesVisible,!1),this.view.redraw())},setSpacesVisible:function(a){this.spacesVisible!==a&&(this.spacesVisible=a,this.setWhitespacesVisible(this.tabsVisible||this.spacesVisible,!1),this.view.redraw())},setDetectHyperlinks:function(a){},setFoldingEnabled:function(a){this.foldingEnabled=a},setDetectTasks:function(a){this.detectTasks=a},_binarySearch:function(a,b,d,c,e){var f;void 0===c&&(c=-1);for(void 0===e&&(e=a.length);1<e-c;)if(f=Math.floor((e+c)/2),b<=a[f].start)e=f;else if(d&&b<a[f].end){e=
f;break}else c=f;return e},_computeFolding:function(a){if(this.foldingEnabled){var b=this.view.getModel();if(b.getBaseModel){var d=this.annotationModel;if(d){d.removeAnnotations(g.AnnotationType.ANNOTATION_FOLDING);for(var c=[],e=b.getBaseModel(),f=0;f<a.length;f++){var h=a[f];(h=this._createFoldingAnnotation(b,e,h.start,h.end))&&c.push(h)}d.replaceAnnotations(null,c)}}}},_createFoldingAnnotation:function(a,b,d,c){var e=b.getLineAtOffset(d);b=b.getLineAtOffset(c);return e===b?null:new (g.AnnotationType.getType(g.AnnotationType.ANNOTATION_FOLDING))(d,
c,a)},_findBlock:function(a,b){var d=a.getBlocks();if(!d.length)return a;var c=this._binarySearch(d,b,!0);return c<d.length&&d[c].start<=b&&b<d[c].end?this._findBlock(d[c],b):a},_findBrackets:function(a,b,d,c,e,f){for(var g=[],h=[],m=e,k=d.getBlocks(),l=this._binarySearch(k,e,!0);l<k.length&&!(k[l].start>=f);l++){var n=k[l].start,p=k[l].end;m<n&&(v(c.substring(m-e,n-e),m,d,h),h.forEach(function(d){0===d.style.indexOf(a.pattern.name)?g.push(d.start+1):0===d.style.indexOf(b.pattern.name)&&g.push(-(d.start+
1))}),h=[]);m=p}m<f&&(v(c.substring(m-e,f-e),m,d,h),h.forEach(function(d){0===d.style.indexOf(a.pattern.name)?g.push(d.start+1):0===d.style.indexOf(b.pattern.name)&&g.push(-(d.start+1))}));return g},_findMatchingBracket:function(a,b,d){for(var c=a.getLineAtOffset(d),e=a.getLineEnd(c),f=a.getText(d,e),g,h=b.getEnclosurePatterns(),m=Object.keys(h),k=0;k<m.length;k++){var l=h[m[k]],n=p(l.regex,f,0);if(n&&0===n.index){g=l;break}}if(!g)return-1;f=!1;-1!==g.pattern.name.indexOf(".begin")?(f=!0,k=g.pattern.name.replace(".begin",
".end")):k=g.pattern.name.replace(".end",".begin");h=h[k];if(!h)return-1;m=a.getLine(c);l=a.getLineStart(c);e=this._findBrackets(g,h,b,m,l,e);for(k=0;k<e.length;k++)if(m=0<=e[k]?1:-1,e[k]*m-1===d){d=1;if(f){for(k++;k<e.length;k++)if(m=0<=e[k]?1:-1,d+=m,0===d)return e[k]*m-1;c+=1;for(k=a.getLineCount();c<k;){m=a.getLine(c);l=a.getLineStart(c);e=a.getLineEnd(c);e=this._findBrackets(g,h,b,m,l,e);for(f=0;f<e.length;f++)if(m=0<=e[f]?1:-1,d+=m,0===d)return e[f]*m-1;c++}}else{for(k--;0<=k;k--)if(m=0<=e[k]?
1:-1,d+=m,0===d)return e[k]*m-1;for(c-=1;0<=c;){m=a.getLine(c);l=a.getLineStart(c);e=a.getLineEnd(c);e=this._findBrackets(g,h,b,m,l,e);for(k=e.length-1;0<=k;k--)if(m=0<=e[k]?1:-1,d+=m,0===d)return e[k]*m-1;c--}}break}return-1},_getAnnotationModel:function(){return this.annotationModel},_getLineStyle:function(a){if(this.highlightCaretLine){var b=this.view,d=b.getModel(),b=b.getSelection();if(b.start===b.end&&d.getLineAtOffset(b.start)===a)return h}return null},_getPatternManager:function(){return this.patternManager},
_getStyles:function(a,b,d,c){b.getBaseModel&&(c=b.mapOffset(c));for(var e=c+d.length,f=[],g=c,h=a.getBlocks(),m=this._binarySearch(h,c,!0);m<h.length&&!(h[m].start>=e);m++){var k=h[m].start,l=h[m].end;g<k&&v(d.substring(g-c,k-c),g,a,f);var n=Math.max(g,k);if(n===k&&h[m].pattern.regexBegin){var t=p(h[m].pattern.regexBegin,d.substring(n-c),0);if(t){var r=h[m].pattern.pattern.beginCaptures||h[m].pattern.pattern.captures;r?s(t,r,n,f):f.push({start:n,end:n+t[0].length,style:h[m].pattern.pattern.name});
n+=t[0].length}}var k=Math.min(e,l),w=[];if(k===l&&h[m].pattern.regexEnd&&(g=d.substring(k-g-(h[m].end-h[m].contentEnd)),t=p(h[m].pattern.regexEnd,g,0)))(r=h[m].pattern.pattern.endCaptures||h[m].pattern.pattern.captures)?s(t,r,k-t[0].length,w):h[m].pattern.pattern.name&&w.push({start:k-t[0].length,end:k,style:h[m].pattern.pattern.name}),k-=t[0].length;var g=this._getStyles(h[m],b,d.substring(n-c,k-c),n),u=h[m].pattern.pattern.contentName||h[m].pattern.pattern.name;if(u){var y=n;g.forEach(function(a){a.start-
y&&f.push({start:y,end:a.start,style:u});f.push(a);y=a.end});k-y&&f.push({start:y,end:k,style:u})}else f=f.concat(g);f=f.concat(w);g=l}g<e&&v(d.substring(g-c,e-c),g,a,f);if(b.getBaseModel)for(a=0;a<f.length;a++)d=f[a].end-f[a].start,f[a].start=b.mapOffset(f[a].start,!0),f[a].end=f[a].start+d;return f},_isRenderingWhitespace:function(){return this.whitespacesVisible&&(this.tabsVisible||this.spacesVisible)},_onDestroy:function(a){this.destroy()},_onLineStyle:function(b){b.textView===this.view&&(b.style=
this._getLineStyle(b.lineIndex));b.ranges=this._getStyles(this._rootBlock,b.textView.getModel(),b.lineText,b.lineStart);b.ranges.forEach(function(a){a.style&&(a.style={styleClass:a.style.replace(/\./g," ")})});this._isRenderingWhitespace()&&(this.spacesVisible&&this._spliceStyles(a,b.ranges,b.lineText,b.lineStart),this.tabsVisible&&this._spliceStyles(n,b.ranges,b.lineText,b.lineStart))},_onSelection:function(a){var b=a.oldValue,d=a.newValue,c=this.view;a=c.getModel();var e;if(this.highlightCaretLine){var f=
a.getLineAtOffset(b.start);e=a.getLineAtOffset(d.start);var h=d.start===d.end,b=b.start===b.end;f===e&&b&&h||(b&&c.redrawLines(f,f+1),(f!==e||!b)&&h&&c.redrawLines(e,e+1))}if(this.annotationModel){var b=this._bracketAnnotations,m,k;if(d.start===d.end&&0<(k=c.getCaretOffset()))k-=1,a.getBaseModel&&(k=a.mapOffset(k),a=a.getBaseModel()),d=this._findBlock(this._rootBlock,k),a=this._findMatchingBracket(a,d,k),-1!==a&&(m=[g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_MATCHING_BRACKET,a,
a+1),g.AnnotationType.createAnnotation(g.AnnotationType.ANNOTATION_CURRENT_BRACKET,k,k+1)]);this._bracketAnnotations=m;this.annotationModel.replaceAnnotations(b,m)}},_onMouseDown:function(a){if(2===a.clickCount){var b=this.view,d=b.getModel(),c=b.getOffsetAtLocation(a.x,a.y);if(0<c){var e=c-1,f=d;d.getBaseModel&&(e=d.mapOffset(e),f=d.getBaseModel());var g=this._findBlock(this._rootBlock,e),e=this._findMatchingBracket(f,g,e);-1!==e&&(a.preventDefault(),a=e,d.getBaseModel&&(a=d.mapOffset(a,!0)),c>a&&
(c--,a++),b.setSelection(a,c))}}},_onModelChanged:function(a){var b=a.start,d=a.removedCharCount;a=a.addedCharCount-d;var c=this.view,e=c.getModel(),f=e.getBaseModel?e.getBaseModel():e,d=b+d,h=f.getCharCount(),m=this._rootBlock.getBlocks(),k=m.length,l=f.getLineStart(f.getLineAtOffset(b)),n=this._binarySearch(m,l,!0),p=this._binarySearch(m,d,!1,n-1,k),t;n<k&&m[n].start<=l&&l<m[n].end?(t=m[n].start,t>b&&(t+=a)):t=n===k&&0<k&&h-a===m[k-1].end?m[k-1].start:l;var r;do p<k?(r=m[p].end,r>b&&(r+=a),p+=1):
(p=k,r=h),l=f.getText(t,r),l=u(f,l,this._rootBlock,t);while(l.length&&m.length&&p<k&&l[l.length-1].pattern.pattern.id!==m[p-1].pattern.pattern.id);for(h=n;h<m.length;h++)k=m[h],k.start>b&&k.adjustStart(a),k.start>b&&k.adjustEnd(a);var s=p-n!==l.length;if(!s)for(h=0;h<l.length;h++){var k=m[n+h],w=l[h];if(k.start!==w.start||k.end!==w.end||k.type!==w.type){s=!0;break}}h=[n,p-n].concat(l);Array.prototype.splice.apply(m,h);s&&(h=t,k=r,e!==f&&(h=e.mapOffset(h,!0),k=e.mapOffset(k,!0)),c.redrawRange(h,k));
if(this.annotationModel){c=[];m=[];n=[];t=this.annotationModel.getAnnotations(t,r);for(r=this.foldingEnabled&&f!==e;t.hasNext();)if(k=t.next(),r&&k.type===g.AnnotationType.ANNOTATION_FOLDING){n.push(k);for(h=0;h<l.length&&!(k.start===l[h].start&&k.end===l[h].end);h++);h===l.length?(c.push(k),k.expand()):(h=k.start,p=k.end,h>b&&(h-=a),p>b&&(p-=a),h<=b&&b<p&&h<=d&&d<p&&(h=f.getLineAtOffset(k.start),p=f.getLineAtOffset(k.end),h!==p?k.expanded||k.expand():this.annotationModel.removeAnnotation(k)));for(h=
0;h<l.length;h++){k=l[h];for(p=0;p<n.length&&!(n[p].start===k.start&&n[p].end===k.end);p++);p===n.length&&(k=this._createFoldingAnnotation(e,f,k.start,k.end))&&m.push(k)}}else k.type===g.AnnotationType.ANNOTATION_TASK&&c.push(k);if(this.detectTasks)for(h=0;h<l.length;h++)y(l[h],f,m);this.annotationModel.replaceAnnotations(c,m)}},_spliceStyles:function(a,b,d,c){for(var e=a.regex,f=e.lastIndex=0,g=e.exec(d);g;){for(g=c+g.index;f<b.length&&!(g<b[f].end);)f++;var h={start:g,end:g+1,style:a.style};if(f<
b.length&&b[f].start<=g){var m={start:g+1,end:b[f].end,style:b[f].style};b[f].end=g;b.splice(f+1,0,m);b.splice(f+1,0,h);f+=2}else b.splice(f,0,h),f++;g=e.exec(d)}}};return{TextStyler:c}});
define("orion/editor/textMateStyler",["orion/regex"],function(g){function l(c){var e;if(c instanceof Array){e=Array(c.length);for(var b=0;b<c.length;b++)e[b]=l(c[b])}else for(b in e={},c)if(Object.prototype.hasOwnProperty.call(c,b)){var f=c[b];e[b]="object"===typeof f&&null!==f?l(f):f}return e}function k(c,e,b){this.initialize(c);this.grammar=l(e);this.externalGrammars=b?l(b):[];this._styles={};this._tree=null;this._allGrammars={};this.preprocess(this.grammar)}var e={unsupported:[{regex:/\(\?[ims\-]:/,
func:function(c){return"option on/off for subexp"}},{regex:/\(\?<([=!])/,func:function(c){return"\x3d"===c[1]?"lookbehind":"negative lookbehind"}},{regex:/\(\?>/,func:function(c){return"atomic group"}}],toRegExp:function(c){function g(b,a){throw Error('Unsupported regex feature "'+b+'": "'+a[0]+'" at index: '+a.index+" in "+a.input);}var b="",f;c=e.processGlobalFlag("x",c,function(b){for(var a="",d=!1,c=b.length,e=0;e<c;){var f=b.charAt(e);if(!d&&"#"===f)for(;e<c&&"\r"!==f&&"\n"!==f;)f=b.charAt(++e);
else if(!d&&/\s/.test(f))for(;e<c&&/\s/.test(f);)f=b.charAt(++e);else"\\"===f?(a+=f,/\s/.test(b.charAt(e+1))||(a+=b.charAt(e+1),e+=1)):("["===f?d=!0:"]"===f&&(d=!1),a+=f),e+=1}return a});c=e.processGlobalFlag("i",c,function(d){b+="i";return d});for(f=0;f<this.unsupported.length;f++){var d;(d=this.unsupported[f].regex.exec(c))&&g(this.unsupported[f].func(d),d)}return RegExp(c,b)},processGlobalFlag:function(c,e,b){var f="(?"+c+")";c="(?"+c+":";if(e.substring(0,f.length)===f)return b(e.substring(f.length));
if(e.substring(0,c.length)===c){for(var f=0,d=e.length,g=-1,a=0;a<d&&-1===g;a++)switch(e.charAt(a)){case "\\":a++;break;case "(":f++;break;case ")":f--,0===f&&(g=a)}f=g;if(f<e.length-1)throw Error("Only a "+c+") group that encloses the entire regex is supported in: "+e);return b(e.substring(c.length,f))}return e},hasBackReference:function(c){return/\\\d+/.test(c.source)},getSubstitutedRegex:function(c,e,b){b="undefined"===typeof b?!0:!1;c=c.source.split(/(\\\d+)/g);for(var f=[],d=0;d<c.length;d++){var m=
c[d],a=/\\(\d+)/.exec(m);a?(m=e[a[1]]||"",f.push(b?g.escape(m):m)):f.push(m)}return RegExp(f.join(""))},groupify:function(c,e){for(var b=c.source,f=b.length,d=[],g=0,a=[],k=1,l=1,t=[],r={},s={},w=0;w<f;w++){var v=d[d.length-1],u=b.charAt(w);switch(u){case "(":4===v&&(d.pop(),t.push(")"),a[a.length-1].end=w);var y=w+2<f?b.charAt(w+1)+""+b.charAt(w+2):null;if("?:"===y||"?\x3d"===y||"?!"===y){var x;"?:"===y?x=1:(x=3,g++);d.push(x);a.push({start:w,end:-1,type:x});t.push(u);t.push(y);w+=y.length}else d.push(2),
a.push({start:w,end:-1,type:2,oldNum:k,num:l}),t.push(u),0===g&&(s[l]=null),r[k]=l,k++,l++;break;case ")":v=d.pop();3===v&&g--;a[a.length-1].end=w;t.push(u);break;case "*":case "+":case "?":case "}":var z=u,q=b.charAt(w-1),y=w-1;if("}"===u){for(x=w-1;"{"!==b.charAt(x)&&0<=x;x--);q=b.charAt(x-1);y=x-1;z=b.substring(x,w+1)}x=a[a.length-1];if(")"===q&&(2===x.type||4===x.type)){t.splice(x.start,0,"(");t.push(z);t.push(")");u={start:x.start,end:t.length-1,type:4,num:x.num};for(q=0;q<a.length;q++)if(v=
a[q],(2===v.type||4===v.type)&&v.start>=x.start&&v.end<=y)v.start+=1,v.end+=1,v.num+=1,2===v.type&&(r[v.oldNum]=v.num);a.push(u);l++;break}default:"|"!==u&&2!==v&&4!==v&&0===g&&(d.push(4),a.push({start:w,end:-1,type:4,num:l}),t.push("("),s[l]=null,l++),t.push(u),"\\"===u&&(u=b.charAt(w+1),t.push(u),w+=1)}}for(;d.length;)d.pop(),t.push(")");b=RegExp(t.join(""));f={};e=e||r;for(var A in e)e.hasOwnProperty(A)&&(f[A]="\\"+e[A]);b=this.getSubstitutedRegex(b,f,!1);return[b,r,s]},complexCaptures:function(c){if(!c)return!1;
for(var e in c)if(c.hasOwnProperty(e)&&"0"!==e)return!0;return!1}};k.prototype={initialize:function(c){this.textView=c;this.textView.stylerOptions=this;var e=this;this._listener={onModelChanged:function(b){e.onModelChanged(b)},onDestroy:function(b){e.onDestroy(b)},onLineStyle:function(b){e.onLineStyle(b)},onStorage:function(b){e.onStorage(b)}};c.addEventListener("ModelChanged",this._listener.onModelChanged);c.addEventListener("Destroy",this._listener.onDestroy);c.addEventListener("LineStyle",this._listener.onLineStyle);
c.redrawLines()},onDestroy:function(c){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanged",this._listener.onModelChanged),this.textView.removeEventListener("Destroy",this._listener.onDestroy),this.textView.removeEventListener("LineStyle",this._listener.onLineStyle),this.textView=null);this._listener=this._tree=this._styles=this.grammar=null},preprocess:function(c){for(c=[c];0!==c.length;){var e=c.pop();if(!e._resolvedRule||!e._typedRule)if(e._resolvedRule=
this._resolve(e),e._typedRule=this._createTypedRule(e),this.addStyles(e.name),this.addStyles(e.contentName),this.addStylesForCaptures(e.captures),this.addStylesForCaptures(e.beginCaptures),this.addStylesForCaptures(e.endCaptures),e._resolvedRule!==e&&c.push(e._resolvedRule),e.patterns)for(var b=0;b<e.patterns.length;b++)c.push(e.patterns[b])}},addStyles:function(c){if(c&&!this._styles[c]){this._styles[c]=[];for(var e=c.split("."),b=0;b<e.length;b++)this._styles[c].push(e.slice(0,b+1).join("-"))}},
addStylesForCaptures:function(c){for(var e in c)c.hasOwnProperty(e)&&this.addStyles(c[e].name)},ContainerRule:function(){function c(c){this.rule=c;this.subrules=c.patterns}c.prototype.valueOf=function(){return"aa"};return c}(),BeginEndRule:function(){function c(c){this.rule=c;this.beginRegex=e.toRegExp(c.begin);this.endRegex=e.toRegExp(c.end);this.subrules=c.patterns||[];this.endRegexHasBackRef=e.hasBackReference(this.endRegex);var b=e.complexCaptures(c.captures);c=e.complexCaptures(c.beginCaptures)||
e.complexCaptures(c.endCaptures);if(this.isComplex=b||c)b=e.groupify(this.beginRegex),this.beginRegex=b[0],this.beginOld2New=b[1],this.beginConsuming=b[2],b=e.groupify(this.endRegex,this.beginOld2New),this.endRegex=b[0],this.endOld2New=b[1],this.endConsuming=b[2]}c.prototype.valueOf=function(){return this.beginRegex};return c}(),MatchRule:function(){function c(c){this.rule=c;this.matchRegex=e.toRegExp(c.match);if(this.isComplex=e.complexCaptures(c.captures))c=e.groupify(this.matchRegex),this.matchRegex=
c[0],this.matchOld2New=c[1],this.matchConsuming=c[2]}c.prototype.valueOf=function(){return this.matchRegex};return c}(),_createTypedRule:function(c){return c.match?new this.MatchRule(c):c.begin?new this.BeginEndRule(c):new this.ContainerRule(c)},_resolve:function(c){var e=c;if(c.include){if(c.begin||c.end||c.match)throw Error('Unexpected regex pattern in "include" rule '+c.include);c=c.include;if("#"===c.charAt(0)){if(e=this.grammar.repository&&this.grammar.repository[c.substring(1)],!e)throw Error("Couldn't find included rule "+
c+" in grammar repository");}else if("$self"===c)e=this.grammar;else{if("$base"===c)throw Error('Include "$base" is not supported');e=this._allGrammars[c];if(!e)for(var b=0;b<this.externalGrammars.length;b++){var f=this.externalGrammars[b];if(f.scopeName===c){this.preprocess(f);e=this._allGrammars[c]=f;break}}}}return e},ContainerNode:function(){function c(c,b){this.parent=c;this.rule=b;this.children=[];this.end=this.start=null}c.prototype.addChild=function(c){this.children.push(c)};c.prototype.valueOf=
function(){var c=this.rule;return"ContainerNode { "+(c.include||"")+" "+(c.name||"")+(c.comment||"")+"}"};return c}(),BeginEndNode:function(){function c(c,b,f){this.parent=c;this.rule=b;this.children=[];this.setStart(f);this.endMatch=this.end=null;this.endRegexSubstituted=b.endRegexHasBackRef?e.getSubstitutedRegex(b.endRegex,f):null}c.prototype.addChild=function(c){this.children.push(c)};c.prototype.getIndexInParent=function(c){return this.parent?this.parent.children.indexOf(this):-1};c.prototype.setStart=
function(c){this.start=c.index;this.beginMatch=c};c.prototype.setEnd=function(c){c&&"object"===typeof c?(this.endMatch=c,this.end=c.index+c[0].length):(this.endMatch=null,this.end=c)};c.prototype.shiftStart=function(c){this.start+=c;this.beginMatch.index+=c};c.prototype.shiftEnd=function(c){this.end+=c;this.endMatch&&(this.endMatch.index+=c)};c.prototype.valueOf=function(){return"{"+this.rule.beginRegex+" range\x3d"+this.start+".."+this.end+"}"};return c}(),push:function(c,e){if(e)for(var b=e.length;0<
b;)c.push(e[--b])},exec:function(c,e,b){if(e=c.exec(e))e.index+=b;c.lastIndex=0;return e},afterMatch:function(c){return c.index+c[0].length},getEndMatch:function(c,e,b){if(c instanceof this.BeginEndNode){var f=c.rule;c=c.endRegexSubstituted||f.endRegex;return!c?null:this.exec(c,e,b)}return null},initialParse:function(){this.textView.getModel().getCharCount();this._tree=new this.ContainerNode(null,this.grammar._typedRule);this.parse(this._tree,!1,0)},onModelChanged:function(c){var e=c.addedCharCount,
b=c.removedCharCount;c=c.start;if(this._tree){var f=this.textView.getModel(),d=f.getCharCount(),f=f.getLineEnd(f.getLineAtOffset(c)-1),g=this.getFirstDamaged(f,f),f=-1===f?0:f,e=g?this.parse(g,!0,f,c,e,b):d;this.textView.redrawRange(f,e)}else this.initialParse()},getFirstDamaged:function(c,e){if(0>c)return this._tree;for(var b=[this._tree],f=null;b.length;){var d=b.pop();if(!d.parent||this.isDamaged(d,c,e)){d instanceof this.BeginEndNode&&(f=d);for(var g=0;g<d.children.length;g++)b.push(d.children[g])}}return f||
this._tree},isDamaged:function(c,e,b){return c.start<=b&&c.end>e},parse:function(c,e,b,f,d,g){var a=this.textView.getModel(),k=a.getLineStart(a.getLineCount()-1),l=a.getCharCount(),t=this.getInitialExpected(c,b),r=-1;e&&(c.repaired=!0,c.endNeedsUpdate=!0,r=(r=c.children[c.children.length-1])?a.getLineEnd(a.getLineAtOffset(r.end+(d-g))):-1,f=a.getLineEnd(a.getLineAtOffset(f+g)),r=Math.max(r,f));r=-1===r?l:r;f=t;for(var s=c,w=!1,v=b,u=-1;s&&(!e||v<r);){var y=this.getNextMatch(a,s,v);y||(v=v>=k?l:a.getLineStart(a.getLineAtOffset(v)+
1));var x=y&&y.match,z=y&&y.rule,q=y&&y.isEnd;if(y&&y.isSub)v=this.afterMatch(x),z instanceof this.BeginEndRule&&(w=!0,e&&z===f.rule&&s===f.parent?(s=f,s.setStart(x),s.repaired=!0,s.endNeedsUpdate=!0,f=this.getNextExpected(f,"begin")):(e&&(this.prune(s,f),e=!1),x=new this.BeginEndNode(s,z,x),s.addChild(x),s=x));else if(q||v===l)s instanceof this.BeginEndNode&&(x?(w=!0,u=Math.max(u,s.end),s.setEnd(x),v=this.afterMatch(x),e&&s===f&&s.parent===f.parent?(s.repaired=!0,delete s.endNeedsUpdate,f=this.getNextExpected(f,
"end")):e&&(this.prune(s,f),e=!1)):(s.setEnd(l),delete s.endNeedsUpdate)),s=s.parent;e&&v>=r&&!w&&(this.prune(c,t),e=!1)}this.removeUnrepairedChildren(c,e,b);this.cleanup(e,c,b,r,l,d,g);return e?Math.max(u,v):v},removeUnrepairedChildren:function(c,e,b){if(e){e=c.children;for(var f=-1,d=0;d<e.length;d++){var g=e[d];if(!g.repaired&&this.isDamaged(g,b,Number.MAX_VALUE)){f=d;break}}-1!==f&&(c.children.length=f)}},cleanup:function(c,e,b,f,d,g,a){if(c){c=g-a;d=this.getIntersecting(f-c+1,d);e=this.getIntersecting(b,
f);for(b=0;b<d.length;b++)f=d[b],!f.repaired&&f instanceof this.BeginEndNode&&(f.shiftEnd(c),f.shiftStart(c));for(b=0;b<e.length;b++)f=e[b],f.repaired&&f.endNeedsUpdate&&f.shiftEnd(c),delete f.endNeedsUpdate,delete f.repaired}else{e=this.getIntersecting(b,f);for(b=0;b<e.length;b++)delete e[b].repaired}},getNextMatch:function(c,e,b,f){var d=c.getLineAtOffset(b),d=c.getLineEnd(d),g=c.getText(b,d),a=[],k=[];c=[];d=[];for(this.push(a,e.rule.subrules);a.length;){var l=a.length?a.pop():null,l=l&&l._resolvedRule._typedRule;
if(l instanceof this.ContainerRule&&-1===k.indexOf(l))k.push(l),this.push(a,l.subrules);else if(!l||!f||l.matchRegex){var t=l&&this.exec(l.matchRegex||l.beginRegex,g,b);t&&(c.push(t),d.push(l))}}a=Number.MAX_VALUE;k=-1;for(l=0;l<c.length;l++)t=c[l],t.index<a&&(a=t.index,k=l);if(!f&&(b=this.getEndMatch(e,g,b)))if(f=e.rule.applyEndPatternLast,-1===k||b.index<a||!f&&b.index===a)return{isEnd:!0,rule:e.rule,match:b};return-1===k?null:{isSub:!0,rule:d[k],match:c[k]}},getInitialExpected:function(c,e){var b,
f;if(c===this._tree)for(b=0;b<c.children.length;b++){if(f=c.children[b],f.start>=e)return f}else if(c instanceof this.BeginEndNode&&c.endMatch){var d=c.endMatch.index;for(b=0;b<c.children.length&&!(f=c.children[b],f.start>=e);b++);if(f&&f.start<d)return f}return c},getNextExpected:function(c,e){if("begin"===e){var b=c.children[0];return b?b:c}if("end"===e&&(b=c.parent)){var f=b.children[b.children.indexOf(c)+1];return f?f:b}return null},prune:function(c,e){e.parent===c?c.children.length=e.getIndexInParent():
c instanceof this.BeginEndNode&&(c.endMatch=null,c.end=null);c.parent&&(c.parent.children.length=c.getIndexInParent()+1)},onLineStyle:function(c){this._tree||this.initialParse();var e=c.lineStart,b=this.textView.getModel(),f=b.getLineEnd(c.lineIndex),d=b.getLineEnd(b.getLineAtOffset(e)-1),d=this.getFirstDamaged(d,d),e=this.getLineScope(b,d,e,f);c.ranges=this.toStyleRanges(e);c.ranges.sort(function(b,a){return b.start-a.start})},getLineScope:function(c,e,b,f){for(var d=b,g=this.getInitialExpected(e,
b),a=[],k=[];e&&d<f;){var l=this.getNextMatch(c,e,d);if(!l)break;var t=l&&l.match,r=l&&l.rule,s=l&&l.isSub,l=l&&l.isEnd;t.index!==d&&k.push({start:d,end:t.index,node:e});s?(d=this.afterMatch(t),r instanceof this.BeginEndRule?(this.addBeginScope(a,t,r),e=g,g=this.getNextExpected(g,"begin")):this.addMatchScope(a,t,r)):l&&(d=this.afterMatch(t),this.addEndScope(a,t,r),g=this.getNextExpected(g,"end"),e=e.parent)}d<f&&k.push({start:d,end:f,node:e});c=this.getInheritedLineScope(k,b,f);return a.concat(c)},
getInheritedLineScope:function(c,e,b){e=[];for(b=0;b<c.length;b++)for(var f=c[b],d=f.node;d;){var g=d.rule.rule,a=g.name;if(g=g.contentName||a){this.addScopeRange(e,f.start,f.end,g);break}d=d.parent}return e},addBeginScope:function(c,e,b){var f=b.rule;this.addCapturesScope(c,e,f.beginCaptures||f.captures,b.isComplex,b.beginOld2New,b.beginConsuming)},addEndScope:function(c,e,b){var f=b.rule;this.addCapturesScope(c,e,f.endCaptures||f.captures,b.isComplex,b.endOld2New,b.endConsuming)},addMatchScope:function(c,
e,b){var f=b.rule,d=f.name;(f=f.captures)?this.addCapturesScope(c,e,f,b.isComplex,b.matchOld2New,b.matchConsuming):this.addScope(c,e,d)},addScope:function(c,e,b){b&&c.push({start:e.index,end:this.afterMatch(e),scope:b})},addScopeRange:function(c,e,b,f){f&&c.push({start:e,end:b,scope:f})},addCapturesScope:function(c,e,b,f,d,g){if(b)if(f){f={1:0};for(var a=0,k=1;void 0!==e[k];k++)void 0!==g[k]&&(a+=e[k].length),void 0!==e[k+1]&&(f[k+1]=a);g=e.index;for(a=1;b[a];a++){var k=b[a].name,l=d[a],t=g+f[l];
"undefined"!==typeof e[l]&&this.addScopeRange(c,t,t+e[l].length,k)}}else this.addScope(c,e,b[0]&&b[0].name)},getIntersecting:function(c,e){for(var b=[],f=this._tree?[this._tree]:[];f.length;){var d=f.pop(),g=!1;d instanceof this.ContainerNode?g=!0:this.isDamaged(d,c,e)&&(g=!0,b.push(d));if(g)for(var g=d.children.length,a=0;a<g;a++)f.push(d.children[a])}return b.reverse()},toStyleRanges:function(c){for(var e=[],b=0;b<c.length;b++){var f=c[b],d=this._styles[f.scope];if(!d)throw Error("styles not found for "+
f.scope);d=d.join(" ");e.push({start:f.start,end:f.end,style:{styleClass:d}})}return e}};return{RegexUtil:e,TextMateStyler:k}});
define("orion/editor/AsyncStyler",["i18n!orion/editor/nls/messages","orion/editor/annotations"],function(g,l){function k(b){return-1!==b.getProperty("objectClass").indexOf(c)&&"highlighter"===b.getProperty("type")}function e(b,c,d){this.initialize(b,c,d);this.lineStyles=[]}var c="orion.edit.highlighter",h=c+" service must be an event emitter";l.AnnotationType.registerType("orion.annotation.highlightError",{title:g.syntaxError,html:"\x3cdiv class\x3d'annotationHTML error'\x3e\x3c/div\x3e",rangeStyle:{styleClass:"annotationRange error"}});
e.prototype={initialize:function(b,e,d){this.textView=b;this.serviceRegistry=e;this.annotationModel=d;this.services=[];var g=this;this.listener={onModelChanging:function(a){g.onModelChanging(a)},onModelChanged:function(a){g.onModelChanged(a)},onDestroy:function(a){g.onDestroy(a)},onLineStyle:function(a){g.onLineStyle(a)},onStyleReady:function(a){g.onStyleReady(a)},onServiceAdded:function(a){g.onServiceAdded(a.serviceReference,g.serviceRegistry.getService(a.serviceReference))},onServiceRemoved:function(a){g.onServiceRemoved(a.serviceReference,
g.serviceRegistry.getService(a.serviceReference))}};b.addEventListener("ModelChanging",this.listener.onModelChanging);b.addEventListener("ModelChanged",this.listener.onModelChanged);b.addEventListener("Destroy",this.listener.onDestroy);b.addEventListener("LineStyle",this.listener.onLineStyle);e.addEventListener("registered",this.listener.onServiceAdded);e.addEventListener("unregistering",this.listener.onServiceRemoved);b=e.getServiceReferences(c);for(d=0;d<b.length;d++){var a=b[d];k(a)&&this.addServiceListener(e.getService(a))}},
onDestroy:function(b){this.destroy()},destroy:function(){this.textView&&(this.textView.removeEventListener("ModelChanging",this.listener.onModelChanging),this.textView.removeEventListener("ModelChanged",this.listener.onModelChanged),this.textView.removeEventListener("Destroy",this.listener.onDestroy),this.textView.removeEventListener("LineStyle",this.listener.onLineStyle),this.textView=null);if(this.services){for(var b=0;b<this.services.length;b++)this.removeServiceListener(this.services[b]);this.services=
null}this.serviceRegistry&&(this.serviceRegistry.removeEventListener("registered",this.listener.onServiceAdded),this.serviceRegistry.removeEventListener("unregistering",this.listener.onServiceRemoved),this.serviceRegistry=null);this.lineStyles=this.listener=null},onModelChanging:function(b){this.startLine=this.textView.getModel().getLineAtOffset(b.start)},onModelChanged:function(b){var c=this.startLine;(b.addedLineCount||b.removedLineCount)&&Array.prototype.splice.apply(this.lineStyles,[c,b.removedLineCount].concat(this._getEmptyStyle(b.addedLineCount)))},
onStyleReady:function(b){var c=b.lineStyles||b.style;b=Number.MAX_VALUE;var d=-1,e=this.textView.getModel(),a;for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&(this.lineStyles[a]=c[a],b=Math.min(b,a),d=Math.max(d,a));b=Math.max(b,0);d=Math.min(d,e.getLineCount());if(c=this.annotationModel){for(var g=c.getAnnotations(e.getLineStart(b),e.getLineEnd(d)),h=[];g.hasNext();){var k=g.next();"orion.annotation.highlightError"===k.type&&h.push(k)}g=[];for(k=b;k<=d;k++){a=k;var r=this.lineStyles[a],r=r&&
r.errors;a=e.getLineStart(a);if(r)for(var s=0;s<r.length;s++){var w=r[s];g.push(l.AnnotationType.createAnnotation("orion.annotation.highlightError",w.start+a,w.end+a))}}c.replaceAnnotations(h,g)}this.textView.redrawLines(b,d+1)},onLineStyle:function(b){var c=this.lineStyles[b.lineIndex];if(c)if(c.ranges){for(var c=c.ranges,d=b.lineStart,e=c.length,a=[],g=0;g<e;g++){var h=c[g];a.push({start:h.start+d,end:h.end+d,style:h.style})}b.ranges=a}else c.style&&(b.style=c.style)},_getEmptyStyle:function(b){for(var c=
[],d=0;d<b;d++)c.push(null);return c},setContentType:function(b){this.contentType=b;if(this.services)for(b=0;b<this.services.length;b++){var c=this.services[b];if(c.setContentType){var d=this.serviceRegistry.getService("orion.page.progress");d?d.progress(c.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):c.setContentType(this.contentType)}}},onServiceAdded:function(b,c){k(b)&&this.addServiceListener(c)},onServiceRemoved:function(b,
c){-1!==this.services.indexOf(c)&&this.removeServiceListener(c)},addServiceListener:function(b){if("function"===typeof b.addEventListener){if(b.addEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),this.services.push(b),b.setContentType&&this.contentType){var c=this.serviceRegistry.getService("orion.page.progress");c?c.progress(b.setContentType(this.contentType),"Styling content type: "+this.contentType.id?this.contentType.id:this.contentType):b.setContentType(this.contentType)}}else"undefined"!==
typeof console&&console.log(Error(h))},removeServiceListener:function(b){"function"===typeof b.removeEventListener?(b.removeEventListener("orion.edit.highlighter.styleReady",this.listener.onStyleReady),b=this.services.indexOf(b),-1!==b&&this.services.splice(b,1)):"undefined"!==typeof console&&console.log(Error(h))}};return e});
define("orion/highlight",["examples/editor/textStyler","orion/editor/textStyler","orion/editor/textMateStyler","orion/editor/AsyncStyler","orion/Deferred"],function(g,l,k,e,c){function h(b,h,a,n,p,t,r){function s(b,d){var e=b.getProperty("contentType")||b.getProperty("contentTypes"),f=b.getProperty("fileTypes");return e?c.when(h.isSomeExtensionOf(a,e)).then(function(a){return a?b:null}):d&&f&&-1!==f.indexOf(d)?(e=new c,e.resolve(b),e):null}function w(a){var b=null;switch(a&&a.id){case "application/javascript":case "application/json":b=
new g.TextStyler(n,"js",p);break;case "text/x-java-source":b=new g.TextStyler(n,"java",p);break;case "text/css":b=new g.TextStyler(n,"css",p)}return b}if(!f){var v=w(a);if(v)return t=new c,t.resolve(v),t}f&&!this.orionGrammars&&(this.orionGrammars={});v=t&&t.split(".").pop().toLowerCase();t=b.getServiceReferences("orion.edit.highlighter");for(var u=[],y=[],x=0;x<t.length;x++){var z=t[x],q=z.getProperty("type");"grammar"===q||!f&&"undefined"===typeof q?u.push(z.getProperty("grammar")):"highlighter"!==
q&&(q=z.getProperty("id"))&&!this.orionGrammars[q]&&(this.orionGrammars[q]={id:q,contentTypes:z.getProperty("contentTypes"),patterns:z.getProperty("patterns"),repository:z.getProperty("repository")});(z=s(z,v))&&y.push(z)}return c.all(y,function(a){return{_error:a}}).then(function(c){for(var g,h=c.length-1;0<=h;h--){var m=c[h];if(m&&!m._error&&(r||"highlighter"!==m.getProperty("type"))){g=m;break}}var q;if(g)if(c=g.getProperty("type"),"highlighter"===c)q=new e(n,b,p),q.setContentType(a);else if("grammar"===
c||!f&&"undefined"===typeof c)g=g.getProperty("grammar"),q=new k.TextMateStyler(n,g,u);else if(f){q=[];for(var t in this.orionGrammars)q.push(this.orionGrammars[t]);q=new l.TextStyler(n,p,q,g.getProperty("id"))}return q})}function b(b,c){this.serviceRegistry=b;this.contentTypeService=c;this.styler=null}var f=1;b.prototype={setup:function(b,c,a,e,f){f="undefined"===typeof f?!0:f;this.styler&&(this.styler.destroy&&this.styler.destroy(),this.styler=null);var g=this;return h(this.serviceRegistry,this.contentTypeService?
this.contentTypeService:this.serviceRegistry.getService("orion.core.contentTypeRegistry"),b,c,a,e,f).then(function(a){return g.styler=a})},getStyler:function(){return this.styler}};return{createStyler:h,SyntaxHighlighter:b}});
define("orion/inputCompletion/inputCompletion",["orion/EventTarget"],function(g){function l(k,e,c){g.attach(this);this._binderFunc=e;this.setInputField(k);(k=c?c.group:null)||(k=this._inputField&&this._inputField.id?this._inputField.id:"default__input__group");this._completionIdPrefix=k+"__completion__";this._proposeFromStart=c?c.proposeFromStart:!1;this._extendedProvider=c?c.extendedProvider:null;this._serviceRegistry=c?c.serviceRegistry:null;this._onDelete=c?c.onDelete:null;this._deleteToolTips=
c?c.deleteToolTips:"";this._proposalIndex=-1;this._dismissed=!0;this._mouseDown=!1;this._dataList=[];this._initUI();this._listeners=[];c=function(c){this._binderFunc&&this._binderFunc(function(b){this._bind(b);c.deleting&&(this._proposeOn(this._inputField.value),this._selectProposal(this._proposalIndex,!0))}.bind(this))}.bind(this);this.addEventListener("inputDataListChanged",c);this._listeners.push({evtTarget:this,type:"inputDataListChanged",handler:c});c=function(c){this._mouseDown=!0}.bind(this);
this._completionUIContainer.addEventListener("mousedown",c);this._listeners.push({evtTarget:this._completionUIContainer,type:"mousedown",handler:c});c=function(c){this._mouseDown=!1}.bind(this);this._completionUIContainer.addEventListener("mouseup",c);this._listeners.push({evtTarget:this._completionUIContainer,type:"mouseup",handler:c})}l.prototype._removeListeners=function(g){g&&g.forEach(function(e){e.evtTarget.removeEventListener(e.type,e.handler,!1)})};l.prototype.destroy=function(){this._removeListeners(this._inputFieldListeners);
this._removeListeners(this.listeners)};l.prototype.hasValueOf=function(g){return this._dataList.some(function(e){return e.value===g})};l.prototype.setInputField=function(g){this._inputField&&this._inputFieldListeners&&this._removeListeners(this._inputFieldListeners);this._inputFieldListeners=[];this._inputField=g;"string"===typeof this._inputField&&(this._inputField=document.getElementById(this._inputField));g=function(e){this._mouseDown?window.setTimeout(function(){this._inputField.focus()}.bind(this),
200):this._dismiss()}.bind(this);this._inputField.addEventListener("blur",g);this._inputFieldListeners.push({evtTarget:this._inputField,type:"blur",handler:g});g=function(e){this.onKeyDown(e)}.bind(this);this._inputField.addEventListener("keydown",g);this._inputFieldListeners.push({evtTarget:this._inputField,type:"keydown",handler:g});g=function(e){this._proposeOn(this._inputField.value)}.bind(this);this._inputField.addEventListener("input",g);this._inputFieldListeners.push({evtTarget:this._inputField,
type:"input",handler:g});g=function(e){this._dismissed&&this._binderFunc&&(this._dismissing?this._dismissing=!1:this._binderFunc&&this._binderFunc(function(c){this._bind(c)}.bind(this)))}.bind(this);this._inputField.addEventListener("focus",g);this._inputFieldListeners.push({evtTarget:this._inputField,type:"focus",handler:g})};l.prototype.onKeyDown=function(g){if(this._dismissed)return!0;var e=g.charCode||g.keyCode;if(13===e){if(this._proposalList&&0<this._proposalList.length&&0<=this._proposalIndex&&
this._proposalIndex<this._proposalList.length)return g.preventDefault(),this._dismiss(this._proposalList[this._proposalIndex].item.value,g.ctrlKey),g.stopPropagation(),!1}else{if((40===e||38===e)&&this._proposalList&&0<this._proposalList.length)return g.preventDefault(),this._walk(40===e),g.stopPropagation(),!1;if(27===e)return g.preventDefault(),this._dismiss(),!1;if(46===e&&-1<this._proposalIndex&&this._onDelete)return g.preventDefault(),this._onDelete(this._proposalList[this._proposalIndex].item.value,
this),this._resetIndexAfterDeletion(),g.stopPropagation(),!1}return!0};l.prototype._resetIndexAfterDeletion=function(){1>=this._proposalList.length?this._proposalIndex=-1:this._proposalIndex===this._proposalList.length-1&&(this._proposalIndex=this._proposalList.length-2)};l.prototype._bind=function(g){this._dataList=g};l.prototype._getUIContainerID=function(){return this._completionIdPrefix+"UIContainer"};l.prototype._getUIProposalListId=function(){return this._completionIdPrefix+"UIProposalList"};
l.prototype._initUI=function(){(this._completionUIContainer=document.getElementById(this._getUIContainerID()))||(this._completionUIContainer=document.createElement("div"),this._completionUIContainer.id=this._getUIContainerID(),this._completionUIContainer.style.display="none",this._completionUIContainer.className="inputCompletionContainer",this._completionUIContainer.setAttribute("role","list"),this._completionUIContainer.setAttribute("aria-atomic","true"),this._completionUIContainer.setAttribute("aria-live",
"assertive"),document.body.appendChild(this._completionUIContainer));this._completionUIContainer.textContent="";(this._completionUL=document.getElementById(this._getUIProposalListId()))||(this._completionUL=document.createElement("ul"),this._completionUL.id=this._getUIProposalListId(),this._completionUL.className="inputCompletionUL");this._completionUL.textContent="";this._completionUIContainer.appendChild(this._completionUL)};l.prototype._createProposalLink=function(g,e,c,h){var b=document.createElement("a");
b.href=require.toUrl(e);b.appendChild(this._createBoldText(g,c,h));return b};l.prototype._createBoldText=function(g,e,c,h){if(0>e)return document.createTextNode(g);h=h?h:document.createElement("span");var b;0!==e&&(b=document.createTextNode(g.substring(0,e)),h.appendChild(b));var f=document.createElement("b");h.appendChild(f);b=document.createTextNode(g.substring(e,e+c));f.appendChild(b);e+c<g.length&&(b=document.createTextNode(g.substring(e+c)),h.appendChild(b));return h};l.prototype._proposeOnCategory=
function(g,e){if(0!==e.length){var c;if(g){c=document.createElement("li");c.className="inputCompletionLICategory";var h=document.createTextNode(g);c.appendChild(h);this._completionUL.appendChild(c)}e.forEach(function(b){c=document.createElement("li");c.onmouseover=function(a){this._selectProposal(a.currentTarget)}.bind(this);c.onclick=function(a){this._dismiss(a.currentTarget.completionItem.value)}.bind(this);c.className="inputCompletionLINormal";c.completionItem=b.item;var e;if("string"===typeof b.item.value){var d=
document.createElement("table");d.style.width="100%";d.style.tableLayout="fixed";d.style.borderSpacing="0";var g=document.createElement("tr");g.style.width=this._inputField.offsetWidth+"px";d.appendChild(g);var a=document.createElement("td");a.classList.add("inputCompletionLILeftTD");var h=this._createBoldText(b.item.value,b.boldIndex,b.boldLength);a.appendChild(h);a.style.overflow="hidden";g.appendChild(a);this._onDelete&&(e=document.createElement("button"),e.classList.add("inputCompletionDismissButton"),
e.classList.add("layoutRight"),e.classList.add("core-sprite-close"),e.classList.add("imageSprite"),e.style.display="none",e.style.margin="0 0 0",e.title=this._deleteToolTips,e.onclick=function(a){a.stopPropagation();this._onDelete(b.item.value,this);this._resetIndexAfterDeletion()}.bind(this),a=document.createElement("td"),a.classList.add("inputCompletionLIRightTD"),a.appendChild(e),g.appendChild(a));c.appendChild(d)}else b.item.value.name&&"link"===b.item.value.type&&c.appendChild(this._createProposalLink(b.item.value.name,
b.item.value.value,b.boldIndex,b.boldLength));this._completionUL.appendChild(c);this._proposalList.push({item:b.item,domNode:c,deleteBtn:e})}.bind(this))}};l.prototype._domNode2Index=function(g){if(this._proposalList)for(var e=0;e<this._proposalList.length;e++)if(this._proposalList[e].domNode===g)return e;return-1};l.prototype._highlight=function(g,e){var c=g,h,b=!1;isNaN(c)||(b=!0,this._proposalList&&0<=g&&g<this._proposalList.length?(c=this._proposalList[g].domNode,h=this._proposalList[g].deleteBtn):
c=null);c&&(c.className=e?"inputCompletionLISelected":"inputCompletionLINormal",h&&(h.style.display=e?"":"none"),e&&b&&(c.offsetTop<this._completionUIContainer.scrollTop?c.scrollIntoView(!0):c.offsetTop+c.offsetHeight>this._completionUIContainer.scrollTop+this._completionUIContainer.clientHeight&&c.scrollIntoView(!1)))};l.prototype._selectProposal=function(g,e){var c=g;isNaN(c)&&(c=this._domNode2Index(g));if(c!==this._proposalIndex||e)this._highlight(this._proposalIndex,!1),this._proposalIndex=c,
this._highlight(this._proposalIndex,!0)};l.prototype._dismiss=function(g,e){this._mouseDown||(this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,"string"===typeof g?(this._inputField.value=g,this._dismissing=!0,this._inputField.focus()):g&&g.name&&"link"===g.type&&(e?window.open(g.value):window.location.href=g.value),window.setTimeout(function(){this._completionUIContainer.style.display="none"}.bind(this),200))};l.prototype._show=function(){if(this._proposalList&&0<this._proposalList.length){for(var g=
0,e=0,c=this._inputField;c;)g+=c.offsetLeft,e+=c.offsetTop,c=c.offsetParent;this._completionUIContainer.style.display="block";this._completionUIContainer.style.top=e+this._inputField.offsetHeight+2+"px";this._completionUIContainer.style.left=g+"px";this._completionUIContainer.style.width=this._inputField.offsetWidth+"px";this._dismissed=this._mouseDown=!1}else this._dismissed=!0,this._proposalList=null,this._proposalIndex=-1,this._completionUIContainer.style.display="none"};l.prototype._walk=function(g){g=
this._proposalIndex+(g?1:-1);-1>g?g=this._proposalList.length-1:g>=this._proposalList.length&&(g=-1);this._selectProposal(g)};l.prototype._proposeOnList=function(g,e,c){var h="",b=[],f=e?e.length:0;g.forEach(function(d){if("category"===d.type)this._proposeOnCategory(h,b),h=d.label,b=[];else{var g=!0,a=-1;if(e&&c){var k;"string"===typeof d.value?k=d.value.toLowerCase():d.value.name&&(k=d.value.name.toLowerCase());a=k.indexOf(e);0>a?g=!1:this._proposeFromStart&&(g=0===a)}g&&b.push({item:d,boldIndex:a,
boldLength:f})}}.bind(this));this._proposeOnCategory(h,b)};l.prototype._proposeOn=function(g){this._completionUL.textContent="";var e=g?g.toLowerCase():null;this._proposalList=[];this._proposeOnList(this._dataList,e,!0);this._extendedProvider&&e?this._extendedProvider(g,function(c){c&&c.forEach(function(c){this._proposeOnList(c.proposals,c.filterForMe?e:g,c.filterForMe)}.bind(this));this._show()}.bind(this),[]):this._show()};l.prototype.constructor=l;return{InputCompletion:l}});
define("orion/searchAndReplace/textSearcher","i18n!orion/search/nls/messages orion/editor/find orion/commands orion/objects orion/searchUtils orion/inputCompletion/inputCompletion orion/webui/littlelib".split(" "),function(g,l,k,e,c,h,b){function f(b,c,a,e,f){l.Find.call(this,b,e,f);this._serviceRegistry=c;this._commandService=a}f.prototype=new l.Find;e.mixin(f.prototype,{getFindString:function(){var b=document.getElementById("localSearchFindWith");return!b?l.Find.prototype.getFindString.call(this):
b.value},getReplaceString:function(){var b=document.getElementById("localSearchReplaceWith");return!b?l.Find.prototype.getReplaceString(this):b.value},hide:function(){var b=this.isVisible();l.Find.prototype.hide.call(this);b&&this._commandService.closeParameterCollector()},show:function(b){l.Find.prototype.show.call(this,b);var c=b.findString;this._addRecentfind(c);b=b.replaceString;var a=document.getElementById("localSearchFindWith");a||(this._createActionTable(),a=document.getElementById("localSearchFindWith"));
c&&(a.value=c);b&&(document.getElementById("localSearchReplaceWith").value=b);window.setTimeout(function(){a.select();a.focus()},10)},_showReplaceInfo:function(){this._regex?(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAMQAAMzX6cbT5kh4qFiIuKC40FCIuGSXwmWZw2SaxGacxmadxmWcxbPM4GigyJW92JzC26DI0P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAAHAAgAAAUmoEQUQkFI0PBEz5A2yII0w9AwkUPbRpTsjUNEQUsFIgCXiGSShAAAOw\x3d\x3d",this._replaceInfo.title=g["Regular expression is on. You can click here or use options to turn it off - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]):
(this._replaceInfo.src="data:image/gif;base64,R0lGODlhBwAIAEAAACH5BAEAABIALAAAAAAHAAgAhwAAAAAAMwAAZgAAmQAAzAAA/wArAAArMwArZgArmQArzAAr/wBVAABVMwBVZgBVmQBVzABV/wCAAACAMwCAZgCAmQCAzACA/wCqAACqMwCqZgCqmQCqzACq/wDVAADVMwDVZgDVmQDVzADV/wD/AAD/MwD/ZgD/mQD/zAD//zMAADMAMzMAZjMAmTMAzDMA/zMrADMrMzMrZjMrmTMrzDMr/zNVADNVMzNVZjNVmTNVzDNV/zOAADOAMzOAZjOAmTOAzDOA/zOqADOqMzOqZjOqmTOqzDOq/zPVADPVMzPVZjPVmTPVzDPV/zP/ADP/MzP/ZjP/mTP/zDP//2YAAGYAM2YAZmYAmWYAzGYA/2YrAGYrM2YrZmYrmWYrzGYr/2ZVAGZVM2ZVZmZVmWZVzGZV/2aAAGaAM2aAZmaAmWaAzGaA/2aqAGaqM2aqZmaqmWaqzGaq/2bVAGbVM2bVZmbVmWbVzGbV/2b/AGb/M2b/Zmb/mWb/zGb//5kAAJkAM5kAZpkAmZkAzJkA/5krAJkrM5krZpkrmZkrzJkr/5lVAJlVM5lVZplVmZlVzJlV/5mAAJmAM5mAZpmAmZmAzJmA/5mqAJmqM5mqZpmqmZmqzJmq/5nVAJnVM5nVZpnVmZnVzJnV/5n/AJn/M5n/Zpn/mZn/zJn//8wAAMwAM8wAZswAmcwAzMwA/8wrAMwrM8wrZswrmcwrzMwr/8xVAMxVM8xVZsxVmcxVzMxV/8yAAMyAM8yAZsyAmcyAzMyA/8yqAMyqM8yqZsyqmcyqzMyq/8zVAMzVM8zVZszVmczVzMzV/8z/AMz/M8z/Zsz/mcz/zMz///8AAP8AM/8AZv8Amf8AzP8A//8rAP8rM/8rZv8rmf8rzP8r//9VAP9VM/9VZv9Vmf9VzP9V//+AAP+AM/+AZv+Amf+AzP+A//+qAP+qM/+qZv+qmf+qzP+q///VAP/VM//VZv/Vmf/VzP/V////AP//M///Zv//mf//zP///wAAAAAAAAAAAAAAAAgsAPcpQzMJjbJ9xNAQQ6hwUqaHDws+3PeQoMN9DiUuzFRQ2ZiDyyYdHFhwYUAAOw\x3d\x3d",
this._replaceInfo.title=g["Regular expression is off. You can click here or use options to turn it on for replacement - e.g. when the option is on you can replace \x3ctd([\\s\\S]*?)\x3c/td\x3e with \x3cspan$1\x3c/span\x3e."]);this._replaceInfo.style.display=""},_createActionTable:function(){var b=this;this._commandService.openParameterCollector("pageNavigationActions",function(c){var a=document.createElement("input");a.type="text";a.name=g["Find:"];a.className="parameterInput";a.id="localSearchFindWith";
a.placeholder=g["Find With"];a.oninput=function(a){return b._handleInput(a)};a.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(a);b._initCompletion(a);b._createButton(g.Next,c,function(){b._addRecentfind(b.getFindString());b.find(!0)});b._createButton(g.Previous,c,function(){b._addRecentfind(b.getFindString());b.find(!1)});var e=b._editor.getTextView().getOptions("readonly");if(!e){var f=document.createElement("input");f.type="text";f.name=g["ReplaceWith:"];f.className="parameterInput";
f.id="localSearchReplaceWith";f.placeholder=g["Replace With"];f.onkeydown=function(a){return b._handleKeyDown(a)};c.appendChild(f);b._replaceInfo=b._createInfoImage(null,c,null);b._showReplaceInfo();b._createButton(g.Replace,c,function(){b.replace()});b._createButton(g["Replace All"],c,function(){b.replaceAll()})}f=document.createElement("div");c.appendChild(f);f.classList.add("findOptionsDiv");var h=k.createDropdownMenu(f,g.Options,null,"dismissButton",null,!0);h.menuButton.classList.add("parameterInlineButton");
k.createCheckedMenuItem(h.menu,g["Show all"],b._showAll,function(a){b.setOptions({showAll:a.target.checked});h.dropdown.close(!0)});k.createCheckedMenuItem(h.menu,g["Case sensitive"],!b._caseInsensitive,function(a){b.setOptions({caseInsensitive:!a.target.checked});h.dropdown.close(!0);b.find(!0)});k.createCheckedMenuItem(h.menu,g["Wrap search"],b._wrap,function(a){b.setOptions({wrap:a.target.checked});h.dropdown.close(!0)});k.createCheckedMenuItem(h.menu,g["Incremental search"],b._incremental,function(a){b.setOptions({incremental:a.target.checked});
h.dropdown.close(!0)});k.createCheckedMenuItem(h.menu,g["Whole Word"],b._wholeWord,function(a){b.setOptions({wholeWord:a.target.checked});h.dropdown.close(!0);b.find(!0)});b._regExBox=k.createCheckedMenuItem(h.menu,g["Regular expression"],b._regex,function(a){b.setOptions({regex:a.target.checked});h.dropdown.close(!0);b.find(!0);b._showReplaceInfo()});e||k.createCheckedMenuItem(h.menu,g["Find after replace"],b._findAfterReplace,function(a){b.setOptions({findAfterReplace:a.target.checked});h.dropdown.close(!0)});
return a},function(){b.hide()})},_storeRecentFind:function(b,c,a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(e){e.put("recentFind",b);c&&window.setTimeout(function(){c.dispatchEvent({type:"inputDataListChanged",deleting:a})}.bind(this),20)})},_addRecentfind:function(b){"string"===typeof b&&b&&(!this._completion||!this._completion.hasValueOf(b))&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(c){var a;
c=c.get("recentFind");"string"===typeof c&&(c=JSON.parse(c));if(c){for(a in c)if(c[a].name===b)return;30<=c.length&&c.splice(29,c.length-30+1)}else c=[];c.splice(0,0,{name:b});this._storeRecentFind(c,this._completion)}.bind(this))},_removeRecentSearch:function(b,c){"string"===typeof b&&b&&this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(a){var e;a=a.get("recentFind");"string"===typeof a&&(a=JSON.parse(a));if(a)for(e in a)if(a[e].name===b){a.splice(e,
1);this._storeRecentFind(a,c,!0);break}}.bind(this))},_initCompletion:function(b){if(this._completion)this._completion.setInputField(b);else{var c=function(a){this._serviceRegistry.getService("orion.core.preference").getPreferences("/window/favorites").then(function(b){b=b.get("recentFind");"string"===typeof b&&(b=JSON.parse(b));if(b){var d=[];b.forEach(function(a){d.push({type:"proposal",label:a.name,value:a.name})});a(d)}})}.bind(this);this._completion=new h.InputCompletion(b,c,{serviceRegistry:this._serviceRegistry,
group:"localSearch",onDelete:function(a,b){this._removeRecentSearch(a,b)}.bind(this),deleteToolTips:g["Click or use delete key to delete the search term"]})}},_createButton:function(d,c,a){var e=document.createElement("button");e.addEventListener("click",a.bind(this),!1);var f=this;e.addEventListener("keydown",function(a){a.keyCode===b.KEY.ESCAPE&&f.hide()});e.appendChild(document.createTextNode(d));e.className="dismissButton parameterInlineButton";c.appendChild(e)},_createInfoImage:function(b,c,
a){b=document.createElement("img");b.classList.add("replaceInfo");b.addEventListener("click",function(a){this._regExBox.checked=!this._regex;this.setOptions({regex:!this._regex});this.find(!0);this._showReplaceInfo()}.bind(this));c.appendChild(b);return b},_handleInput:function(b){this._incremental&&this.find(!0,null,!0);return!0},_handleKeyDown:function(b){var c=(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&!b.shiftKey;return c&&70===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=
!0,!1):(this.isMac?b.metaKey:b.ctrlKey)&&!b.altKey&&75===b.keyCode||13===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this._addRecentfind(this.getFindString()),13===b.keyCode?this.find(this._reverse?b.shiftKey:!b.shiftKey):this.find(!b.shiftKey),!1):c&&82===b.keyCode?(b.stopPropagation&&b.stopPropagation(),b.cancelBubble=!0,this.replace(),!1):27===b.keyCode?(this.hide(),!1):!0}});return{TextSearcher:f}});
define("orion/edit/editorContext",[],function(){return{getEditorContext:function(g){var l=Object.create(null);g.getServiceReferences("orion.edit.context").forEach(function(k){var e=g.getService(k);Object.keys(e).forEach(function(c){"function"===typeof e[c]&&(l[c]=e[c].bind(e))})});return l},getOptions:function(g){var l=Object.create(null);g.getServiceReferences("orion.edit.context").forEach(function(g){g.getPropertyKeys().forEach(function(e){"service.id"!==e&&"service.names"!==e&&"objectClass"!==
e&&(l[e]=g.getProperty(e))})});return l}}});
define("orion/blamer",["orion/extensionCommands","orion/PageLinks","orion/URITemplate","orion/edit/editorContext"],function(g,l,k,e){function c(c,b){for(var e=b.getFileMetadata(),d=c.getServiceReferences("orion.edit.blamer"),m=0;m<d.length;m++){var a=d[m],k={};k.validationProperties=a.getProperty("validationProperties");k.forceSingleItem=!0;k=g._makeValidator(k,c);if(k.validationFunction.bind(k)(e))return c.getService(a)}return null}return{isVisible:function(e,b){return!!c(e,b)&&!!e.getService("orion.core.blame")},
getBlame:function(g,b){var f=c(g,b);if(f){var d=function(a){for(var b=l.getOrionHome(),d=0;d<a.length;d++){var c=a[d],e=new k(c.CommitLink),f={};f.OrionHome=b;c.CommitLink=e.expand(f)}g.getService("orion.core.blame")._setAnnotations(a)};if(f.computeBlame){var m={metadata:b.getFileMetadata()};f.computeBlame(e.getEditorContext(g),m).then(d)}else f.doBlame(b.getInput()).then(d)}}}});
define("orion/editorCommands","i18n!orion/edit/nls/messages orion/i18nUtil orion/webui/littlelib orion/webui/dialogs/OpenResourceDialog orion/widgets/input/DropDownMenu orion/Deferred orion/URITemplate orion/commands orion/keyBinding orion/commandRegistry orion/extensionCommands orion/contentTypes orion/searchUtils orion/PageUtil orion/PageLinks orion/editor/annotations orion/blamer orion/regex orion/util orion/edit/editorContext".split(" "),function(g,l,k,e,c,h,b,f,d,m,a,n,p,t,r,s,w,v,u,y){function x(a){var d=
new b(a.uriTemplate),c=a.params||{};c.OrionHome=c.OrionHome||r.getOrionHome();var d=d.expand(c),e=document.createElement("div"),f=document.createElement("iframe");f.id=a.id;f.name=a.id;f.type="text/html";f.sandbox="allow-scripts allow-same-origin";f.frameborder=void 0!==a.border?a.border:1;f.src=d;f.className="delegatedUI";a.width&&(e.style.width=a.width,f.style.width=a.width);a.height&&(e.style.height=a.height,f.style.height=a.height);f.style.visibility="hidden";null!==a.parent&&(a.parent||window.document.body).appendChild(e);
e.appendChild(f);f.style.left=a.left||(window.innerWidth-parseInt(f.clientWidth,10))/2+"px";f.style.top=a.top||(window.innerHeight-parseInt(f.clientHeight,10))/2+"px";f.style.visibility="";window.addEventListener("message",function D(b){if(b.source===f.contentWindow&&"string"===typeof b.data&&(b=JSON.parse(b.data),"orion.page.delegatedUI"===b.pageService&&b.source===a.id)){if(b.cancelled)a.cancelled&&a.cancelled();else if(b.result)a.done&&a.done(b.result);else if(b.Status||b.status)a.status&&a.status(b.Status||
b.status);window.removeEventListener("message",D,!1);e.parentNode&&e.parentNode.removeChild(e)}},!1);return e}function z(a){this.serviceRegistry=a.serviceRegistry;this.commandService=a.commandRegistry;this.fileClient=a.fileClient;this.inputManager=a.inputManager;this.toolbarId=a.toolbarId;this.saveToolbarId=a.saveToolbarId;this.editToolbarId=a.editToolbarId;this.pageNavId=a.navToolbarId;this.isReadOnly=a.readonly;this._localSearcher=a.textSearcher;this._searcher=a.searcher;this.editorSettings=a.editorSettings;
this.localSettings=a.localSettings}var q={},A=null;q.createDelegatedUI=x;z.prototype={generateSimpleEditorCommands:function(a,b){this.isReadOnly||(this._generateUndoStackCommands(a),this._generateSaveCommand(a,b));this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a)},generateEditorCommands:function(a){this.generateBaseEditorCommands(a);this.generateExtraEditorCommands(a)},generateBaseEditorCommands:function(a){this.isReadOnly||(this._generateUndoStackCommands(a),
this._generateSaveCommand(a),this._generateEditCommands(a))},generateExtraEditorCommands:function(a){this._generateSettingsCommand(a);this._generateSearchFilesCommand(a);this._generateGotoLineCommnand(a);this._generateFindCommnand(a);this._generateBlame(a)},_generateSettingsCommand:function(a){var b=this,e=new f.Command({imageClass:"core-sprite-wrench",tooltip:g.LocalEditorSettings,id:"orion.edit.settings",visibleWhen:function(){return a.installed},callback:function(d){var f=e.settingsDropDown;if(!f||
f.isDestroyed())f=e.settingsDropDown=new c(d.domNode.parentNode,d.domNode,{noClick:!0,selectionClass:"dropdownSelection",onShow:function(){f.focus()},onHide:function(){a.focus()}}),f.updateContent=b.localSettings.show.bind(b.localSettings),d=f.getContentNode(),d.tabIndex=d.style.marginTop=0;f.click()}});this.commandService.addCommand(e);this.commandService.registerCommandContribution("settingsActions","orion.edit.settings",1,null,!1,new d.KeyBinding("s",!0,!0))},_generateUndoStackCommands:function(a){var b=
new f.Command({name:g.Undo,id:"orion.undo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().undo()}});this.commandService.addCommand(b);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.undo",400,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,new d.KeyBinding("z",!0));b=new f.Command({name:g.Redo,id:"orion.redo",visibleWhen:function(){return a.installed},callback:function(b){a.getUndoStack().redo()}});
this.commandService.addCommand(b);this.commandService.registerCommandContribution(this.editToolbarId||this.toolbarId,"orion.redo",401,this.editToolbarId?"orion.menuBarEditGroup/orion.undoGroup":null,!this.editToolbarId,u.isMac?new d.KeyBinding("z",!0,!0):new d.KeyBinding("y",!0))},_generateSearchFilesCommand:function(a){var b=this;if(b._searcher){var c=!1,h=new f.Command({name:g.searchFiles,tooltip:g.searchFiles,id:"orion.searchFiles",visibleWhen:function(){return a.installed},callback:function(d){if(!c){d=
a.getSelection();d=a.getText(d.start,d.end);var f=b.serviceRegistry.getService("orion.page.progress"),h=new e.OpenResourceDialog({searcher:b._searcher,progress:f,searchRenderer:b._searcher.defaultRenderer,nameSearch:!1,title:g.searchFiles,message:g.searchTerm,initialText:d,onHide:function(){c=!1;a.focus()}});window.setTimeout(function(){c=!0;h.show(k.node(b.toolbarId))},0)}}});this.commandService.addCommand(h);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.searchFiles",
1,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("h",!0))}},_generateSaveCommand:function(a,b){var c=this,e=b?b:"orion.save",h=new f.Command({name:g.Save,tooltip:g.saveFile,id:e,visibleWhen:function(){return!a.installed||c.inputManager.getReadOnly()?!1:!0},callback:function(a){c.inputManager.save();return!0}});this.commandService.addCommand(h);this.commandService.registerCommandContribution(this.saveToolbarId||this.toolbarId,e,1,this.saveToolbarId?
"orion.menuBarFileGroup/orion.saveGroup":null,!1,new d.KeyBinding("s",!0));a.getTextView&&a.getTextView()&&(a.getTextView().setKeyBinding(new d.KeyBinding("s",!0),"save"),a.getTextView().setAction("save",h.callback,h))},_generateGotoLineCommnand:function(a){var b=this,c=new m.ParametersDescription([new m.CommandParameter("line","number","Line:")],{hasOptionalParameters:!1},function(){var b=a.getModel().getLineAtOffset(a.getCaretOffset())+1;return[new m.CommandParameter("line","number","Line:",b.toString())]}),
c=new f.Command({name:g.gotoLine,tooltip:g.gotoLineTooltip,id:"orion.gotoLine",visibleWhen:function(){return a.installed},parameters:c,callback:function(b){var d=a.getModel();b.parameters&&b.parameters.valueFor("line")?b=b.parameters.valueFor("line"):(b=d.getLineAtOffset(a.getCaretOffset()),(b=prompt(g.gotoLinePrompt,b+1))&&(b=parseInt(b,10)));if(b)a.onGotoLine(b-1,0)}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.gotoLine",
3,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("l",!u.isMac,!1,!1,u.isMac),new m.URLBinding("gotoLine","line"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("gotoLine",function(d){if(d)return a.onGotoLine(d.line-1,0,void 0,d.callback),!0;b.commandService.runCommand("orion.gotoLine");return!0},c)},_generateFindCommnand:function(a){var b=this,c=new m.ParametersDescription([new m.CommandParameter("find","text","Find:")],{clientCollect:!0},
function(){var d=a.getSelection(),c="";d.end>d.start&&(c=a.getModel().getText(d.start,d.end),b._localSearcher&&b._localSearcher.getOptions().regex&&(c=v.escape(c)));return[new m.CommandParameter("find","text","Find:",c)]}),c=new f.Command({name:g.Find,tooltip:g.Find,id:"orion.editor.find",visibleWhen:function(){return a.installed},parameters:c,callback:function(d){if(b._localSearcher){var c="",e=null,f=a.getSelection();f.end>f.start&&d.parameters.valueFor("useEditorSelection")?(c=a.getModel().getText(f.start,
f.end),b._localSearcher.getOptions().regex&&(c=v.escape(c))):d.parameters&&d.parameters.valueFor("find")&&(c=d.parameters.valueFor("find"),e=t.matchResourceParameters(),p.convertFindURLBinding(e));e?(b._localSearcher.setOptions({regex:e.regEx,caseInsensitive:!e.caseSensitive}),d={},e.atLine&&(d.start=a.getModel().getLineStart(e.atLine-1)),b._localSearcher.show({findString:c,replaceString:e.replaceWith}),b._localSearcher.find(!0,d)):b._localSearcher.show({findString:c});return!0}return!1}});this.commandService.addCommand(c);
this.commandService.registerCommandContribution(this.editToolbarId||this.pageNavId,"orion.editor.find",0,this.editToolbarId?"orion.menuBarEditGroup/orion.findGroup":null,!this.editToolbarId,new d.KeyBinding("f",!0),new m.URLBinding("find","find"));a.getTextView&&a.getTextView()&&a.getTextView().setAction("find",function(a){if(a)return b._localSearcher.show(a),!0;b.commandService.runCommand("orion.editor.find",null,null,new m.ParametersDescription([new m.CommandParameter("useEditorSelection","text",
"","true")],{clientCollect:!0}));return!0},c)},_generateBlame:function(a){var b=this,c=new f.Command({name:g.Blame,tooltip:g.BlameTooltip,id:"orion.edit.blame",parameters:new m.ParametersDescription([new m.CommandParameter("blame","boolean")],{clientCollect:!0}),visibleWhen:function(){return!a.installed?!1:w.isVisible(b.serviceRegistry,b.inputManager)},callback:function(d){for(var c=!1,e=a.getAnnotationModel().getAnnotations();e.hasNext();)if(e.next().type===s.AnnotationType.ANNOTATION_BLAME){c=!0;
break}c=!c;d.parameters&&d.parameters.valueFor("blame")&&(c="true"===d.parameters.valueFor("blame"));c?w.getBlame(b.serviceRegistry,b.inputManager):a.showBlame([])}});this.commandService.addCommand(c);this.commandService.registerCommandContribution(this.toolbarId,"orion.edit.blame",1,"orion.menuBarToolsGroup",!1,new d.KeyBinding("b",!0,!0),new m.URLBinding("blame","blame"))},_generateEditCommands:function(b){function c(a){if(!a)return null;var b=new d.KeyBinding;d.KeyBinding.apply(b,a);return b}function e(a,
b){!b&&a&&"undefined"!==typeof a.HTML&&delete a.HTML;var d=m.serviceRegistry.getService("orion.page.message");d?d.setProgressResult(a):window.console.log(a)}var m=this,p=this.toolbarId,q=this.serviceRegistry,t=q.getServiceReferences("orion.edit.command"),r=this.inputManager,s=q.getService("orion.page.progress"),w=function(a,d,c){var h=c.visibleWhen;c.visibleWhen=function(a){return!b.installed||m.inputManager.getReadOnly()?!1:!h||h(a)};c.callback=function(c){b=this;var f=b.getSelection?b.getSelection():
{start:0,end:0};c=b.getModel();var h=function(a){"object"===typeof a&&a?(a.text&&b.setText(a.text),a.selection&&(b.setSelection&&b.setSelection(a.selection.start,a.selection.end,!0),b.focus())):"string"===typeof a&&(b.setText(a,f.start,f.end,!0),b.setSelection&&b.setSelection(f.start,f.start+a.length),b.focus())},m;d.execute?(c={contentType:r.getContentType(),input:r.getInput()},m=y.getEditorContext(q),m.openDelegatedUI=x,m.setStatus=e,c=d.execute(m,c),m=null):(c=d.run(c.getText(f.start,f.end),c.getText(),
f,r.getInput()),m=function(b){if(b&&b.uriTemplate){var d={};d.uriTemplate=b.uriTemplate;d.params=r.getFileMetadata();d.id=a.id;d.width=b.width;d.height=b.height;d.done=h;d.status=e;x(d)}else b&&(b.Status||b.status)?e(b.Status||b.status):h(b)});s.showWhile(c,l.formatMessage(g.running,a.name)).then(m);return!0};c.callback=c.callback.bind(b);return new f.Command(c)};h.when(function(a){if(A)return A;var b=a.getService("orion.core.contentTypeRegistry");b||(b=new n.ContentTypeRegistry(a),b=a.getService("orion.core.contentTypeRegistry"));
return b.getContentTypes().then(function(a){return A=a})}(this.serviceRegistry),function(){var d=[],e=100;t.forEach(function(f){var g=f.getProperty("editor");if(!g||!(b.id&&g!==b.id)){for(var h=m.serviceRegistry.getService(f),k={},g=f.getPropertyKeys(),l=0;l<g.length;l++)k[g[l]]=f.getProperty(g[l]);k.forceSingleItem=!0;f=a._createCommandOptions(k,f,m.serviceRegistry,A,!1,function(a){return r.getFileMetadata()});d.push(f);f.then(function(a){a=w(k,h,a);m.commandService.addCommand(a);m.commandService.registerCommandContribution(m.toolbarId,
a.id,e,"orion.menuBarToolsGroup",!1,c(k.key))});e++}});h.all(d,function(a){return{_error:a}}).then(function(a){if(a=r.getFileMetadata()){var d=k.node(p);d&&(m.commandService.destroy(d),m.commandService.renderCommands(d.id,d,a,b,"button"));if(d=k.node("pageNavigationActions"))m.commandService.destroy(d),m.commandService.renderCommands(d.id,d,b,b,"button")}})})}};q.EditorCommandFactory=z;return q});
define("orion/inputManager","i18n!orion/edit/nls/messages orion/explorers/navigatorRenderer orion/i18nUtil orion/Deferred orion/EventTarget orion/objects orion/PageUtil".split(" "),function(g,l,k,e,c,h,b){function f(a){this._document=a.document||document;this._timeout=a.timeout;a="keypress keydown keyup mousemove mousedown mousemove".split(" ");for(var b=function(a){this._resetTimer()}.bind(this),d=0;d<a.length;d++)this._document.addEventListener(a[d],b,!0);c.attach(this)}function d(a,b){if(a){if(!b.Severity){var d=
b,c={Severity:"Error",Message:g.noResponse};if(0!==d.status)if(d.responseText){d=d.responseText;try{var e=JSON.parse(d);c.Severity=e.Severity||c.Severity;c.Message=e.Message||c.Message}catch(f){c.Message=d}}else try{c.Message=JSON.stringify(d)}catch(h){}b=c}a.setProgressResult(b)}else window.console.log(b)}function m(a){c.attach(this);this.serviceRegistry=a.serviceRegistry;this.statusService=a.statusService;this.fileClient=a.fileClient;this.progressService=a.progressService;this.contentTypeRegistry=
a.contentTypeRegistry;this.selection=a.selection;this._input=this._title="";this.dispatcher=null;this._unsavedChanges=[]}f.prototype={_resetTimer:function(){var a=this._document.defaultView||this._document.parentWindow;this._timer&&(a.clearTimeout(this._timer),this._timer=null);-1!==this._timeout&&(this._timer=a.setTimeout(function(){this.onIdle({type:"Idle"});this._timer=null;this._resetTimer()}.bind(this),this._timeout))},onIdle:function(a){return this.dispatchEvent(a)},setTimeout:function(a){this._timeout=
a;this._resetTimer()}};h.mixin(m.prototype,{_maybeLoadWorkspace:function(a){var b=this.fileClient;return a===b.fileServiceRootURL(a)?b.loadWorkspace(a).then(function(a){return a.Location}):(new e).resolve(a)},_read:function(a){var b=this.cachedMetadata||l.getClickedItem();if(b&&b.Location===a&&b.Parents&&b.Attributes&&b.ETag)return(new e).resolve(b);var d=this.fileClient,c=Array.prototype.slice.call(arguments,1);return this._maybeLoadWorkspace(a).then(function(a){return d.read.apply(d,[a].concat(c))})},
load:function(){var a=this.getInput();if(a){var b=this.fileClient,c=this._parsedLocation.resource,f=this.progressService,h=function(a,b,d){return!f?a:f.progress(a,k.formatMessage(b,d))},m=this.getEditor();if(this._fileMetadata)!this._saving&&!this._fileMetadata.Directory&&!this._readonly&&h(b.read(c,!0),g.ReadingMetadata,a).then(function(d){this._fileMetadata&&this._fileMetadata.Location===d.Location&&this._fileMetadata.ETag!==d.ETag&&(this._fileMetadata=d,(!m.isDirty()||window.confirm(g.loadOutOfSync))&&
h(b.read(c),g.Reading,a).then(function(b){m.setInput(a,null,b);this._unsavedChanges=[]}.bind(this)))}.bind(this));else{var l=c;if(0===l.indexOf("/gitapi/commit/")){var v=l.indexOf("/file"),u=l.indexOf("?",v);-1===u&&(u=l.length);l=l.substring(v,u);this._readonly=!0}var y=window.setTimeout(function(){y=null;this.reportStatus(k.formatMessage(g.Fetching,a))}.bind(this),800),x=function(){this.reportStatus("");y&&window.clearTimeout(y)}.bind(this),z=function(a){x();var b=null;this.serviceRegistry?b=this.serviceRegistry.getService("orion.page.message"):
this.statusService&&(b=this.statusService);d(b,a);this._setNoInput()}.bind(this);this._acceptPatch=null;h(this._read(l,!0),g.ReadingMetadata,l).then(function(d){d?d.Directory?e.when(d.Children||h(b.fetchChildren(d.ChildrenLocation),g.Reading,a),function(b){x();d.Children=b;this._setInputContents(this._parsedLocation,a,b,d)}.bind(this),z):this._isText(d)?h(b.read(c,!1,!0),g.Reading,a).then(function(b){x();"string"!==typeof b&&(this._acceptPatch=b.acceptPatch,b=b.result);this._setInputContents(this._parsedLocation,
a,b,d)}.bind(this),z):h(b._getService(c).readBlob(c),g.Reading,a).then(function(b){x();this._setInputContents(this._parsedLocation,a,b,d)}.bind(this),z):z({responseText:k.formatMessage(g.ReadingMetadataError,l)})}.bind(this),z)}}},processParameters:function(a){var b=this.getEditor();b&&b.processParameters&&b.processParameters(a)},getAutoLoadEnabled:function(){return this._autoLoadEnabled},getAutoSaveEnabled:function(){return this._autoSaveEnabled},getEditor:function(){return this.editor},getInput:function(){return this._input},
getTitle:function(){return this._title},getFileMetadata:function(){return this._fileMetadata},getReadOnly:function(){var a=this._fileMetadata;return this._readonly||!a||a.Attributes&&a.Attributes.ReadOnly},getContentType:function(){return this._contentType},onFocus:function(a){this._autoSaveEnabled&&this._errorSaving?this.save():this._autoLoadEnabled&&this.load()},onChanging:function(a){if(this._getSaveDiffsEnabled()){var b=this._unsavedChanges.length,d=a.removedCharCount,c=a.start,e=a.start+d,f=
0;0===a.addedCharCount?f=-1:0===d&&(f=1);if(0<b&&f===this.previousChangeType){b=this._unsavedChanges[b-1];if(0===d&&c===b.end+b.text.length){b.text+=a.text;return}if(0===a.addedCharCount&&e===b.start){b.start=c;return}}this.previousChangeType=f;this._unsavedChanges.push({start:c,end:e,text:a.text})}},reportStatus:function(a){this.statusReporter?this.statusReporter(a):this.editor&&this.editor.reportStatus(a)},save:function(){function a(a){f===A.getInput()&&(A.getFileMetadata().ETag=a.ETag,c.setInput(f,
null,h,!0));A.reportStatus("");e&&q&&q.setProgressResult({Message:g.Saved,Severity:"Normal"});A.afterSave&&A.afterSave();A._saving=!1}function b(a){A.reportStatus("");d(q,a);A._saving=!1;A._errorSaving=!0}if(!this._saving){var c=this.getEditor();if(c&&c.isDirty()&&!this.getReadOnly()){var e=this._errorSaving;this._saving=!0;var f=this.getInput();this.reportStatus(g["Saving..."]);this.dispatchEvent({type:"Saving",inputManager:this});c.markClean();var h=c.getText(),m=h;if(this._getSaveDiffsEnabled()&&
!this._errorSaving){for(var l=this._unsavedChanges,u=0,y=0;y<l.length;y++)u+=l[y].text.length;h.length>u&&(m={diff:l})}this._unsavedChanges=[];this._errorSaving=!1;var l={ETag:this.getFileMetadata().ETag},x=this._parsedLocation.resource,m=this.fileClient.write(x,m,l),z=this.progressService,q=null;this.serviceRegistry&&(q=this.serviceRegistry.getService("orion.page.message"));z&&(m=z.progress(m,k.formatMessage(g.savingFile,f)));var A=this;m.then(a,function(d){412===d.status?window.confirm(g.saveOutOfSync)?
(d=A.fileClient.write(x,h),z&&(d=z.progress(d,k.formatMessage(g.savingFile,f))),d.then(a,b)):A._saving=!1:b(d)})}}},setAutoLoadEnabled:function(a){this._autoLoadEnabled=a},setAutoSaveTimeout:function(a){this._autoSaveEnabled=-1!==a;this._idle?this._idle.setTimeout(a):(this._idle=new f({document:document,timeout:a}),this._idle.addEventListener("Idle",function(){this._errorSaving||this.save()}.bind(this)))},setContentType:function(a){this._contentType=a},setInput:function(a){if(!this._ignoreInput&&
(a||(a=b.hash()),"string"===typeof a)){var d=this.getEditor();a&&"#"!==a[0]&&(a="#"+a);var c=b.matchResourceParameters(a),e=this._parsedLocation||{};if(d&&d.isDirty()){var f=this._location;if(e.resource!==c.resource)if(this._autoSaveEnabled)this.save();else if(!window.confirm(g.confirmUnsavedChanges)){window.location.hash=f;return}}d=d&&e.editor!==c.editor;this._location=a;this._parsedLocation=c;this._ignoreInput=!0;this.selection&&this.selection.setSelections(a);this._ignoreInput=!1;(a=c.resource)?
a===this._input?d?(this.reportStatus(""),this._setInputContents(c,a,null,this._fileMetadata,this._isText(this._fileMetadata))):this.processParameters(c):(this._input=a,this._readonly=!1,this._fileMetadata=null,this.load()):this._setNoInput(!0)}},setTitle:function(a){var b=a.lastIndexOf("/");-1!==b&&(a=a.substring(b+1));this._title=a},setSaveDiffsEnabled:function(a){this._saveDiffsEnabled=a},_getSaveDiffsEnabled:function(){return this._saveDiffsEnabled&&null!==this._acceptPatch&&-1!==this._acceptPatch.indexOf("application/json-patch")},
_isText:function(a){a=this.contentTypeRegistry.getFileContentType(a);if(!a)return!0;var b=this.contentTypeRegistry.getContentType("text/plain");return this.contentTypeRegistry.isExtensionOf(a,b)},_setNoInput:function(a){a?this.fileClient.loadWorkspace("").then(function(a){this._input=a.ChildrenLocation;this._setInputContents(a.ChildrenLocation,null,a,a)}.bind(this)):(this._input=this._title=this._fileMetadata=null,this.setContentType(null),this.dispatchEvent({type:"InputChanged",input:null}))},_setInputContents:function(a,
b,d,c,e){var f,g=!1;c?(this._fileMetadata=c,this.setTitle(c.Location||String(c)),this.setContentType(this.contentTypeRegistry.getFileContentType(c)),f=c.Name,g=c.Directory):(this._fileMetadata=null,this.setTitle(b),this.setContentType(this.contentTypeRegistry.getFilenameContentType(this.getTitle())),f=this.getTitle());var h=this.getEditor();this._focusListener&&(h&&h.getTextView&&h.getTextView()&&h.getTextView().removeEventListener("Focus",this._focusListener),this._focusListener=null);this._changingListener&&
(h&&h.getModel&&h.getModel()&&h.getModel().removeEventListener("Changing",this._changingListener),this._changingListener=null);c={type:"InputChanged",input:a,name:f,title:b,contentType:this.getContentType(),metadata:c,location:window.location,contents:d};this.dispatchEvent(c);this.editor=h=c.editor;g||(h&&h.getModel&&h.getModel()&&h.getModel().addEventListener("Changing",this._changingListener=this.onChanging.bind(this)),e||h.setInput(b,null,d),h&&h.getTextView&&h.getTextView()&&h.getTextView().addEventListener("Focus",
this._focusListener=this.onFocus.bind(this)),this._unsavedChanges=[],this.processParameters(a))}});return{handleError:d,InputManager:m}});
define("orion/compare/resourceComparer","i18n!orion/compare/nls/messages require orion/Deferred orion/webui/littlelib orion/compare/compareUtils orion/compare/diffProvider orion/compare/compareView orion/highlight orion/fileClient orion/globalCommands orion/commands orion/keyBinding orion/searchAndReplace/textSearcher orion/editorCommands orion/objects orion/inputManager orion/editor/editorFeatures orion/URL-shim".split(" "),function(g,l,k,e,c,h,b,f,d,m,a,n,p,t,r,s,w){function v(a){this._syntaxHighlither=
new f.SyntaxHighlighter(a)}l={};l.DefaultDiffProvider=function(){function a(b){this.serviceRegistry=b;this._diffProvider=new h.DiffProvider(b)}a.prototype={_resolveTwoFiles:function(a,b){var d=this;return k.all([d._getContentType(a),d._getContentType(b)],function(a){return{_error:a}}).then(function(c){if(Array.isArray(c)&&2===c.length&&c[0]&&c[1]){var e=c[0];c=c[1];return(new k).resolve({oldFile:{URL:a,Name:d._resolveFileName(a),Type:e},newFile:{URL:b,Name:d._resolveFileName(b),Type:c},diffContent:d._diffContent})}e=
a?d._resolveFileName(a):"";c=b?d._resolveFileName(b):"";return(new k).resolve({oldFile:{URL:a,Name:e,Type:null},newFile:{URL:b,Name:c,Type:null},diffContent:d._diffContent})})},_resolveFileName:function(a){return a.split("?")[0]},_getContentType:function(a){a=this._resolveFileName(a);return this.serviceRegistry.getService("orion.core.contentTypeRegistry").getFilenameContentType(a)},_resolveComplexFileURL:function(a){var b=this;return this._diffProvider.getDiffFileURI(a).then(function(a,d){return b._resolveTwoFiles(a.Old,
a.New)},function(){})},resolveDiff:function(a,b,d){this._hasConflicts=d;if(b)return this._resolveTwoFiles(b,a);if(this._diffProvider){var c=this;return c._diffProvider.getDiffContent(a).then(function(b,d){c._diffContent=c._hasConflicts?b.split("diff --git")[1]:b;return c._resolveComplexFileURL(a)},function(){})}console.log("A diff provider is needed for compound diff URL")}};return a}();v.prototype={highlight:function(a,b,d){return this._syntaxHighlither.setup(b,d.getTextView(),null,a,!1)}};l.ResourceComparer=
function(){function f(a,c,e,h){this._registry=a;this._commandService=c;this._fileClient=new d.FileClient(a);this._fileClient=new d.FileClient(a);this._searchService=this._registry.getService("orion.core.search");this._progress=this._registry.getService("orion.page.progress");this.setOptions(e,!0);this._compareView=e.toggleable?new b.toggleableCompareView("inline"===e.type?"inline":"twoWay",h):"inline"===e.type?new b.inlineCompareView(h):new b.TwoWayCompareView(h);this._compareView.getWidget().setOptions({extCmdHolder:this});
h.highlighters||this._compareView.getWidget().setOptions({highlighters:[new v(a),new v(a)]});h.oldFile||this._compareView.getWidget().setOptions({oldFile:{readonly:this._checkReadonly(e.readonlyRight)}});h.newFile||this._compareView.getWidget().setOptions({newFile:{readonly:this._checkReadonly(e.readonly,!0)}});this.initExtCmds();this._initInputManagers();this._compareView.getWidget().initEditors(g["fetching..."]);this._inputManagers.forEach(function(a){if(a.manager){var b=this._compareView.getWidget().getEditors()[a.manager._editorIndex];
b.addEventListener("DirtyChanged",function(d){a.manager.setDirty(b.isDirty())})}}.bind(this))}f.prototype={_clearOptions:function(){this.options={}},_checkReadonly:function(a,b){return b?"undefined"===typeof a?!1:a:"undefined"===typeof a?!0:a},_getFileOptions:function(a){return 1===a?this._compareView.getWidget().options.newFile:this._compareView.getWidget().options.oldFile},_createInputManager:function(){return new s.InputManager({serviceRegistry:this._registry,fileClient:this._fileClient,progressService:this._progress})},
_initInputManagers:function(){this._inputManagers=[{},{}];!this.options.toggleable&&this._compareView.getWidget()._uiFactory&&"twoWay"===this._compareView.getWidget().type&&(this._checkReadonly(this.options.readonlyRight)||(this._inputManagers[0].manager=this._createInputManager(),this._initInputManager(this._inputManagers[0].manager,0,this._compareView.getWidget()._uiFactory.getActionDivId())),this._checkReadonly(this.options.readonly,!0)||(this._inputManagers[1].manager=this._createInputManager(),
this._initInputManager(this._inputManagers[1].manager,1,this._compareView.getWidget()._uiFactory.getActionDivId(!0))));var a=this;this._inputManagers.forEach(function(b){b.manager&&(this._getFileOptions(b.manager._editorIndex).keyBindingFactory=function(d,c,e,f){c=new p.TextSearcher(d,a._registry,a._commandService,e);e=(new w.KeyBindingsFactory).createKeyBindings(d,e,f,c);(new t.EditorCommandFactory({serviceRegistry:a._registry,commandRegistry:a._commandService,fileClient:a._fileClient,inputManager:b.manager,
toolbarId:b.manager._actionBarId,readonly:!1,navToolbarId:"pageNavigationActions",textSearcher:c})).generateSimpleEditorCommands(d,1===b.manager._editorIndex?"orion.compare.save.left":"orion.compare.save.right");return e})}.bind(this))},_initInputManager:function(a,b,d){var c=this;r.mixin(a,{filePath:"",_editorIndex:b,_actionBarId:d,getInput:function(){return this.filePath},setDirty:function(a){var b=c._compareView.getWidget().getEditors(),d=a;b&&2===b.length&&(d=b[0].isDirty()||b[1].isDirty());m.setDirtyIndicator(d);
c._compareView.getWidget().refreshTitle&&c._compareView.getWidget().refreshTitle(this._editorIndex,a)},getFileMetadata:function(){return this._fileMetadata},getEditor:function(){return c._compareView.getWidget().getEditors()[this._editorIndex]},setInput:function(a,b){this._parsedLocation={resource:a};c._progress.progress(c._fileClient.read(a,!0),"Getting file metadata "+a).then(function(a){this._fileMetadata=a;var b=e.node(this._actionBarId);if(b){c._commandService.destroy(b);var d=this._editorIndex;
c._commandService.renderCommands(b.id,b,c._compareView.getWidget().getEditors()[d],c._compareView.getWidget().getEditors()[d],"button")}a&&this.setTitle(a.Location,a)}.bind(this),function(b){console.error("Error loading file metadata: "+b.message);this.setTitle(a)}.bind(this));this.lastFilePath=a},setTitle:function(a,b){"*"===a.charAt(0)?m.setDirtyIndicator(!0):m.setDirtyIndicator(!1)},afterSave:function(){var a=c._compareView.getWidget().getEditors()[this._editorIndex].getTextView().getText();c._getFileOptions(this._editorIndex).Content=
a;c._compareView.getWidget().refresh()}})},setOptions:function(a,b){b&&this._clearOptions();this.options||(this.options={});a&&Object.keys(a).forEach(function(b){this.options[b]=a[b]}.bind(this))},generateLink:function(a){a=a.getCurrentDiffPos();a=c.generateCompareHref(this.options.resource,{compareTo:this.options.compareTo,readonly:this.options.readonly,readonlyRight:this.options.readonlyRight,conflict:this.options.hasConflicts,block:a.block?a.block:1,change:a.change?a.change:0});a=(new URL(a,window.location.href)).href;
prompt(g["Copy the link URL:"],a)},openComparePage:function(a){a=a.getCurrentDiffPos();return c.generateCompareHref(this.options.resource,{compareTo:this.options.compareTo,readonly:!this.options.editableInComparePage,conflict:this.options.hasConflicts,block:a.block?a.block:1,change:a.change?a.change:0})},initExtCmds:function(){var b=this._compareView.getWidget().options.commandProvider;if(b&&b.getOptions().commandSpanId){var b=b.getOptions().commandSpanId,d=new a.Command({tooltip:g["Generate link of the current diff"],
name:g["Generate Link"],id:"orion.compare.generateLink",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.extCmdHolder.options.resource&&a.options.extCmdHolder.options.generateLink},callback:function(a){a.items.options.extCmdHolder.generateLink(a.items)}}),c=new a.Command({tooltip:g["Open the compare page"],name:g.Compare,id:"orion.compare.openComparePage",groupId:"orion.compareGroup",visibleWhen:function(a){return a.options.extCmdHolder.options.resource&&!a.options.extCmdHolder.options.generateLink},
hrefCallback:function(a){return a.items.options.extCmdHolder.openComparePage(a.items)}});this._commandService.addCommand(d);this._commandService.addCommand(c);this._commandService.registerCommandContribution(b,"orion.compare.openComparePage",98);this._commandService.registerCommandContribution(b,"orion.compare.generateLink",99,null,!1,new n.KeyBinding("l",!0,!0))}},_getFilesContents:function(a){var b=[];a.forEach(function(a){b.push(this._loadSingleFile(a))}.bind(this));return k.all(b,function(a){return{_error:a}})},
_isImage:function(a){switch(a&&a.id){case "image/jpeg":case "image/png":case "image/gif":case "image/ico":case "image/tiff":case "image/svg":return!0}return!1},_loadSingleFile:function(a){return this._registry.getService("orion.page.progress").progress(this._fileClient.read(a.URL),"Getting contents of "+a.URL).then(function(b){a.Content=b;return a}.bind(this),function(b,d){404===b.status&&(a.Content="");return a}.bind(this))},start:function(){if(this.options.resource){if(this.options.diffProvider){var a=
this;return a.options.diffProvider.resolveDiff(a.options.resource,a.options.compareTo,a.options.hasConflicts).then(function(b){a._compareView.getWidget().setOptions(b);b=a._isImage(b.newFile.Type);var d=a._compareView.getWidget().options;if(a._checkReadonly(a.options.readonlyRight)||b)d.oldFile.readonly=!0;if(a._checkReadonly(a.options.readonly,!0)||b)d.newFile.readonly=!0;return b?(a._compareView.initImageMode(),a._compareView.getWidget().refresh().then(function(a){return(new k).resolve(a+5)})):
a._getFilesContents(d.diffContent?[d.oldFile]:[d.oldFile,d.newFile]).then(function(){var b=a._compareView.getWidget().refresh(!0);this._inputManagers.forEach(function(b){if(b.manager){var d=a._getFileOptions(b.manager._editorIndex),c=a._compareView.getWidget().getEditors()[b.manager._editorIndex];b.manager.filePath=d.URL;b.manager.setInput(d.URL,c)}});return(new k).resolve(b)}.bind(a))})}console.log("A diff provider is needed for Complex diff URL")}}};return f}();return l});
define("orion/git/util",["orion/URL-shim"],function(g){function l(e){for(var b=0;b<c.length;b++)if(e.type===c[b])return!0;return!1}function k(c){for(var b=0;b<e.length;b++)if(c.type===e[b])return!0;return!1}var e=["Missing","Modified","Untracked","Conflicting"],c=["Added","Changed","Removed"];return{statusUILocation:"git/git-status.html",isStaged:l,isUnstaged:k,isChange:function(c){return l(c)||k(c)},hasStagedChanges:function(e){for(var b=0;b<c.length;b++)if(0<e[c[b]].length)return!0;return!1},hasUnstagedChanges:function(c){for(var b=
0;b<e.length;b++)if(0<c[e[b]].length)return!0;return!1},parseSshGitUrl:function(c){try{var b=new URL(c);return{host:b.hostname,port:b.port}}catch(e){try{var d=c.split(":")[0].split("@");return{host:1<d.length?d[1]:d[0],port:22}}catch(g){return{host:"",port:""}}}},trimCommitMessage:function(c){c=c.split(/\r\n|\n/);for(var b=0;0<c.length&&/^\s*$/.test(c[b]);)b++;return 100<c[b].length?c[b].substring(0,100)+"...":c[b]},getGerritFooter:function(c){c=c.split(/\r\n|\n/);for(var b={},e=0,d=c.length-1;0<=
d;--d)if(0===c[d].indexOf("Change-Id: ")){if(b.changeId=c[d].substring(11,c[d].length),1<++e){b={};break}}else 0===c[d].indexOf("Signed-off-by: ")&&(b.signedOffBy=c[d].substring(15,c[d].length));return b}}});
define("orion/git/uiUtil",["orion/compare/compareCommands","orion/compare/resourceComparer","orion/webui/littlelib","orion/git/util"],function(g,l,k,e){e=Object.create(e);e.createCompareWidget=function(c,e,b,f,d,m,a,n,p){var t=new l.DefaultDiffProvider(c);m=new g.CompareCommandFactory({commandService:e,commandSpanId:m,gridRenderer:n});(new l.ResourceComparer(c,e,{toggleable:!0,type:"inline",readonly:!0,hasConflicts:f,diffProvider:t,resource:b,compareTo:p,editableInComparePage:a},{parentDivId:d,commandProvider:m})).start().then(function(a){var b=
420;a<b&&(b=a);k.node(d).style.height=b+"px"})};return e});
define("orion/git/gitPreferenceStorage",["orion/Deferred"],function(g){function l(g){this._prefix="/git/credentials";this._preferenceService=g.getService("orion.core.preference")}l.prototype={put:function(k,e){var c={gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""};void 0!==e&&(void 0!==e.gitSshUsername&&null!==e.gitSshUsername&&(c.gitSshUsername=e.gitSshUsername),void 0!==e.gitSshPassword&&null!==e.gitSshPassword&&(c.gitSshPassword=e.gitSshPassword),void 0!==e.gitPrivateKey&&
null!==e.gitPrivateKey&&(c.gitPrivateKey=e.gitPrivateKey),void 0!==e.gitPassphrase&&null!==e.gitPassphrase&&(c.gitPassphrase=e.gitPassphrase));var h=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(b){var e=b.get("settings");void 0===e?h.reject():e.enabled?(b.put(k,c),h.resolve()):h.reject()});return h},get:function(k){var e={gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""},c=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(g){var b=
g.get("settings");void 0===b?c.reject():b.enabled?(g=g.get(k),void 0!==g?c.resolve(g):c.resolve(e)):c.reject()});return c},isEnabled:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(e){e=e.get("settings");void 0===e?k.resolve(!1):k.resolve(e.enabled)});return k},enable:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(e){e.put("settings",{enabled:!0});k.resolve()});return k},disable:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,
2).then(function(e){e.put("settings",{enabled:!1});k.resolve()});return k},remove:function(k){var e=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(c){c.remove(k);e.resolve()});return e},getRepositories:function(){var k=new g;this._preferenceService.getPreferences(this._prefix,2).then(function(e){var c=[];e=e.keys();for(var g=0;g<e.length;++g)"settings"!==e[g]&&c.push(e[g]);k.resolve(c)});return k}};return l.prototype.constructor=l});
define("orion/git/gitConfigPreference",["orion/Deferred"],function(g){function l(g){this._prefix="/git/config";this._preferenceService=g.getService("orion.core.preference")}l.prototype={getConfig:function(){var k=new g;this._preferenceService.getPreferences(this._prefix).then(function(e){e=e.get("userInfo");k.resolve(e)});return k},setConfig:function(k){var e=new g;this._preferenceService.getPreferences(this._prefix).then(function(c){c.put("userInfo",k);e.resolve()});return e}};return l.prototype.constructor=
l});
define("orion/git/widgets/ConfirmPushDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv id\x3d"header"\x3e\x3c/div\x3e';k.prototype._init=function(e){var c=this;this.title="Git Push";this.modal=!0;this.messages=g;this.location=e.location;this.dialog2=e.dialog;this.func=e.func;this.buttons=[];this.dialog2&&this.buttons.push({callback:function(){c.destroy();c.dialog2.show()},text:"More"});this.buttons.push({callback:function(){c.destroy();c.func()},
text:"OK"});this._initialize()};k.prototype._bindToDom=function(e){e=this.$header;e.appendChild(document.createTextNode("You are going to push to the following remote: "+this.location));e.appendChild(document.createElement("br"));this.dialog2&&e.appendChild(document.createTextNode(" Click More to push to another remote or OK to push to default."))};k.prototype.constructor=k;return{ConfirmPushDialog:k}});
define("orion/git/widgets/RemotePrompterDialog",["i18n!git/nls/gitmessages","orion/webui/dialog","orion/explorers/explorer","orion/selection"],function(g,l,k,e){function c(b,d){this.explorer=d;this._init(b)}function h(b){this._init(b)}var b=function(){function b(d,c,a,e){this.gitClient=d;this.rootPath=c;this.fetchItems=a;this.root=e?e:null}b.prototype=new k.ExplorerModel;b.prototype.getRoot=function(b){var c=this;this.root?b(this.root):this.fetchItems(this.rootPath).then(function(a){c.root=a;b(a)})};
b.prototype.getIdentity=function(b){b.Location?(b=b.Location,b=b.replace(/[^\.\:\-\_0-9A-Za-z]/g,"")):b="ROOT";return b};b.prototype.getChildren=function(b,c){b.children=[];if(b.Children){for(var a=0;a<b.Children.length;a++)b.Children[a].parent=b,b.children[a]=b.Children[a];c(b.Children)}else b.BranchLocation&&b.RemoteLocation?(b.children=[{GroupNode:"true",Location:b.BranchLocation,Name:"Branches",parent:b},{GroupNode:"true",Location:b.RemoteLocation,BranchLocation:b.BranchLocation,Name:"Remotes",
parent:b},{GroupNode:"true",Location:b.TagLocation,Name:"Tags",parent:b}],c(b.children)):b.GroupNode?this.gitClient.getGitBranch(b.Location).then(function(a){b.children=a.Children;for(var e=0;e<a.Children.length;e++)a.Children[e].parent=b;c(a.Children)}):"Remote"===b.Type&&this.gitClient.getGitBranch(b.Location).then(function(a){b.children=a.Children;for(var e=0;e<a.Children.length;e++)a.Children[e].parent=b;c(a.Children)})};return b}();c.prototype=new k.SelectionRenderer;c.prototype.constructor=
c;c.prototype.getLabelColumnIndex=function(){return 0};c.prototype.getCellElement=function(b,d,c){var a=document.createElement("td");c.appendChild(a);b=document.createElement("span");b.id=c.id+"navSpan";a.appendChild(b);b.className="mainNavColumn singleNavColumn";(d.children||d.Children||d.GroupNode||"Remote"===d.Type||d.BranchLocation&&d.RemoteLocation)&&this.getExpandImage(c,b);c=d.Name;"RemoteTrackingBranch"===d.Type&&!d.Id&&(c=d.Name+g[" [New branch]"]);b.appendChild(document.createTextNode(c))};
h.prototype=new l.Dialog;h.prototype.TEMPLATE='\x3cdiv\x3e\x3cdiv id\x3d"treeContentPane" style\x3d"width:25em; min-height: 25em; max-height: 30em; height: auto; overflow-y: auto; padding: 8px"\x3e\x3c/div\x3e\x3cdiv id\x3d"newBranchPane" style\x3d"padding: 8px"\x3e\x3clabel for\x3d"newBranch"\x3e${New Branch:}\x3c/label\x3e\x3cinput id\x3d"newBranch" value\x3d"" disabled\x3dtrue/\x3e\x3c/div\x3e\x3c/div\x3e';h.prototype._init=function(b){var d=this;this.title=b.title||g["Choose a Folder"];this.modal=
!0;this.messages=g;this.func=b.func;this.treeRoot=b.treeRoot;this.gitClient=b.gitClient;this.hideNewBranch=b.hideNewBranch;this.serviceRegistry=b.serviceRegistry;this.buttons=[];this.buttons.push({callback:function(){d.$remoteOk.classList.contains(this.DISABLED)||(d.destroy(),d._execute.bind(d)())},text:"OK",isDefault:!0,id:"remoteOk"})};h.prototype._bindToDom=function(b){var d=this;this.$newBranch.addEventListener("input",function(b){d._validate()});this.$newBranch.placeholder=g["No remote selected"];
this.hideNewBranch&&(this.$newBranchPane.style.display="none")};h.prototype._beforeShowing=function(){this._initialize();this._loadRemoteChildren()};h.prototype._afterShowing=function(){this.$treeContentPane.focus();this._validate()};h.prototype._loadRemoteChildren=function(){var c=new b(this.gitClient,null,this.gitClient.getGitClone,this.treeRoot);this._createTree(c)};h.prototype._createTree=function(b){var d=this,h=this.serviceRegistry.getService("orion.remotePrompter.selection");h||(h=new e.Selection(this.serviceRegistry,
"orion.remotePrompter.selection"));var a=new c({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"});this.explorer=new k.Explorer(this.serviceRegistry,h,a);a.explorer=this.explorer;this.explorer.createTree("treeContentPane",b);h.addEventListener("selectionChanged",function(a){a.selection&&"Remote"===a.selection.Type?(d.$newBranch.disabled=!1,d.$newBranch.placeholder=g["Enter a name..."]):(d.$newBranch.disabled=!0,d.$newBranch.placeholder=g["No remote selected"]);d._validate(a.selection)})};
h.prototype._validate=function(b){var d=function(b){b&&"RemoteTrackingBranch"===b.Type?this.$remoteOk.classList.remove(this.DISABLED):b&&"Remote"===b.Type&&""!==this.$newBranch.value?this.$remoteOk.classList.remove(this.DISABLED):this.$remoteOk.classList.add(this.DISABLED)};b?d.bind(this)(b):this.serviceRegistry.getService("orion.remotePrompter.selection").getSelection(d.bind(this))};h.prototype._execute=function(){var b=this;this.serviceRegistry.getService("orion.remotePrompter.selection").getSelection(function(d){if(b.func)if("RemoteTrackingBranch"===
d.Type)b.func(d,d.parent);else{var c=d.CloneLocation.substring(d.CloneLocation.indexOf(d.CloneLocation.split("/")[3])),a={};a.parent=d;a.FullName="refs/remotes/"+d.Name+"/"+b.$newBranch.value;a.Name=d.Name+"/"+b.$newBranch.value;a.Type="RemoteTrackingBranch";a.Location="/gitapi/remote/"+d.Name+"/"+encodeURIComponent(encodeURIComponent(b.$newBranch.value))+"/"+c;b.func(null,d,a)}})};h.prototype.constructor=h;return{RemotePrompterDialog:h}});
define("orion/git/widgets/ReviewRequestDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv\x3e\x3cdiv id\x3d"treeContentPane" style\x3d"padding: 8px"\x3e\x3clabel for\x3d"reviewReqUrl"\x3e${Paste link in email or IM}\x3c/label\x3e\x3cbr\x3e\x3cinput id\x3d"reviewReqUrl" style\x3d"width: 50em" value\x3d""/\x3e\x3c/div\x3e\x3cdiv id\x3d"newBranchPane" style\x3d"padding: 8px"\x3e\x3clabel for\x3d"reviewerName"\x3e${Send the link to the reviewer}\x3c/label\x3e\x3cbr\x3e\x3cinput id\x3d"reviewerName" style\x3d"width: 30em"  value\x3d""/\x3e\x3c/div\x3e\x3c/div\x3e';
k.prototype._init=function(e){var c=this;this.title=e.title||g["Contribution Review Request"];this.modal=!0;this.messages=g;this.url=e.url;this.func=e.func;this.buttons=[];this.buttons.push({callback:function(){c.destroy();c.func(c.$reviewerName.value)},text:g.Submit});this._initialize()};k.prototype._bindToDom=function(e){this.$reviewReqUrl.value=this.url};k.prototype.constructor=k;return{ReviewRequestDialog:k}});
define("orion/fileUtils",["require","i18n!orion/nls/messages","orion/URL-shim"],function(g,l){var k;k=g.toUrl?(new URL(g.toUrl("workspace"),window.location.href)).href:(new URL("/",window.location.href)).href;return{makeRelative:function(e){if(!e)return e;var c=window.location.protocol+"//"+window.location.host;return 0===e.indexOf(c)?e.substring(c.length):e},isAtRoot:function(e){return!e?!1:"/workspace"===e?!0:0===(new URL(e,window.location.href)).href.indexOf(k)}}});
define("orion/explorers/explorer-table","i18n!orion/navigate/nls/messages orion/Deferred orion/webui/littlelib orion/i18nUtil orion/fileUtils orion/explorers/explorer orion/EventTarget orion/objects orion/util".split(" "),function(g,l,k,e,c,h,b,f,d){function m(a,b,d,c,e,f){this.registry=a;this.root=b;this.fileClient=d;this.idPrefix=c||"";this.excludeFiles=!!e;this.excludeFolders=!!f}function a(a){b.attach(this);this.registry=a.serviceRegistry;this.treeRoot=a.treeRoot;this.selection=a.selection;this.fileClient=
a.fileClient;this.excludeFiles=a.excludeFiles;this.excludeFolders=a.excludeFolders;this.navHandlerFactory=a.navHandlerFactory;this.parentId=a.parentId;this.renderer=a.rendererFactory(this);this.dragAndDrop=a.dragAndDrop;this.setFocus=a.setFocus;this.myTree=this.model=null;this._hookedDrag=this.checkbox=!1;var d=a.modelEventDispatcher?a.modelEventDispatcher:new b;this.modelEventDispatcher=d;var c=this;this._modelListeners={};"copy copyMultiple create delete deleteMultiple import move moveMultiple".split(" ").forEach(function(a){d.addEventListener(a,
c._modelListeners[a]=c.modelHandler[a].bind(c))});this._clickListener=function(a){if("A"===a.target.tagName){for(a=a.target;a&&!a._item;)a=a.parentNode;if(a&&a._item)c.onLinkClick({type:"linkClick",item:a._item})}};(a=k.node(this.parentId))&&a.addEventListener("click",this._clickListener);var e=this.renderer;this.registry&&this.registry.registerService("orion.cm.managedservice",{updated:function(a){a=a&&"undefined"!==a["links.newtab"]?a["links.newtab"]?"_blank":"_self":"_self";e.setTarget&&e.setTarget(a)}},
{pid:"nav.config"})}m.prototype=new h.ExplorerModel;f.mixin(m.prototype,{getRoot:function(a){a(this.root)},processParent:function(a,b){var d=a.Projects?[]:[a].concat(a.Parents||[]);if(this.excludeFiles||this.excludeFolders){var c=[],e;for(e in b)if(!(b[e].Directory?this.excludeFolders:this.excludeFiles))c.push(b[e]),b[e].parent=a,b[e].Parents||(b[e].Parents=d);b=c}else for(c in b)b[c].parent=a,b[c].Parents||(b[c].Parents=d);a.children=b;a.children.sort(function(a,b){var d=a.Directory;if(d!==b.Directory)return d?
-1:1;var d=a.Name&&a.Name.toLowerCase(),c=b.Name&&b.Name.toLowerCase();return d<c?-1:d>c?1:0});return b},getChildren:function(a,b){var d=this;if(a.children)b(a.children);else if(void 0!==a.Directory&&!1===a.Directory)b([]);else if(a.Children)b(d.processParent(a,a.Children));else if(a.Location){var c=null;this.registry&&(c=this.registry.getService("orion.page.progress"));(c?c.progress(this.fileClient.fetchChildren(a.ChildrenLocation),g["Fetching children of "]+a.Name):this.fileClient.fetchChildren(a.ChildrenLocation)).then(function(c){d.destroyed||
b(d.processParent(a,c))},function(){b([])})}else b([])},hasChildren:function(){var a=!1;this.root.Children&&(a=0<this.root.Children.length);return a}});m.prototype.constructor=m;var n,p;a.prototype=Object.create(h.Explorer.prototype);f.mixin(a.prototype,{destroy:function(){var a=this;Object.keys(this._modelListeners).forEach(function(b){a.modelEventDispatcher.removeEventListener(b,a._modelListeners[b])});var b=k.node(this.parentId);b&&b.removeEventListener("click",this._clickListener);h.Explorer.prototype.destroy.call(this)},
onLinkClick:function(a){this.dispatchEvent(a)},onModelCreate:function(a){return this.changedItem(a.parent,!0)},onModelCopy:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){a=(a=a.parent)||b.treeRoot;d[a.Location]=a});return l.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelMove:function(a){var b=this,d={};(a.items||[a]).forEach(function(a){var c=b.treeRoot;if((c.Location||c.ContentLocation)===a.oldValue.Location){var e=b.treeRoot;a=a.newValue;a=a.ChildrenLocation?
a:this.fileClient.read(a.ContentLocation,!0);return l.when(a,function(a){b.dispatchEvent({type:"rootMoved",oldValue:e,newValue:a});b.loadResourceList(a)})}c=(c=a.oldValue.parent)||b.treeRoot;d[c.Location]=c;c=(c=a.parent)||b.treeRoot;d[c.Location]=c;a.oldValue.Directory&&a.newValue&&b.isExpanded(a.oldValue)&&(d[a.newValue.Location]=a.newValue)});return l.all(Object.keys(d).map(function(a){return b.changedItem(d[a],!0)}))},onModelDelete:function(a){a=a.items||[a];var b=this,d=b.treeRoot,c;if(a.some(function(a){if(a.oldValue.Location===
(d.Location||d.ContentLocation)){if(a.oldValue.Location!==(a.parent.Location||a.parent.ContentLocation))c=a.parent;return!0}return!1}))return this.loadResourceList(c);var e={};a.forEach(function(a){a=a.parent;e[a.Location]=a});return l.all(Object.keys(e).map(function(a){return b.changedItem(e[a],!0)}))},modelHandler:{copy:function(a){if(!a.count)return this.onModelCopy(a)},copyMultiple:function(a){return this.onModelCopy(a)},create:function(a){return this.onModelCreate(a)},"delete":function(a){if(!a.count)return this.onModelDelete(a)},
deleteMultiple:function(a){return this.onModelDelete(a)},"import":function(a){return this.changedItem(a.target,!0)},move:function(a){if(!a.count)return this.onModelMove(a)},moveMultiple:function(a){return this.onModelMove(a)}},_makeDropTarget:function(a,b,f){if(this.dragAndDrop){var h=this,m=this.dragAndDrop,l=function(a){n=a.target};f&&(this._oldDragStart&&b.removeEventListener("dragstart",this._oldDragStart,!1),this._oldDragStart=l);b.addEventListener("dragstart",l,!1);l=function(a){n=null};f&&
(this._oldDragEnd&&b.removeEventListener("dragend",this._oldDragEnd,!1),this._oldDragEnd=l);b.addEventListener("dragend",l,!1);l=function(a){b.classList.remove("dragOver");a.preventDefault();a.stopPropagation()};f&&(this._oldDragLeave&&b.removeEventListener("dragleave",this._oldDragLeave,!1),this._oldDragLeave=l);b.addEventListener("dragleave",l,!1);l=function(a){if(n)p=a.dataTransfer.dropEffect=(d.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!d.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===
a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect="copy";b.classList.add("dragOver");k.stop(a)};f&&(this._oldDragEnter&&b.removeEventListener("dragenter",this._oldDragEnter,!1),this._oldDragEnter=l);b.addEventListener("dragenter",l,!1);l=function(a){if(n)p=a.dataTransfer.dropEffect=(d.isMac?a.altKey:a.ctrlKey)?"copy":"move";else if(!d.isIE&&("all"===a.dataTransfer.effectAllowed||"uninitialized"===a.dataTransfer.effectAllowed||0<=a.dataTransfer.effectAllowed.indexOf("copy")))a.dataTransfer.dropEffect=
"copy";k.stop(a)};f&&!this._oldDragOver&&(b.addEventListener("dragover",l,!1),this._oldDragOver=l);var y=null,x=null;h.registry&&(y=h.registry.getService("orion.page.progress"),x=h.registry.getService("orion.page.message"));var z=function(a){if(x){var b=null,b="string"===typeof a?{Severity:"Error",Message:a}:a&&a.error?{Severity:"Error",Message:a.error}:a;x.setProgressResult(b)}else window.console.log(a)},q=function(b,d,f,h,m,k,l){!f.Location&&f.fileMetadata&&(f=f.fileMetadata);d=d||"";if(b.isFile)c.isAtRoot(f.Location)?
z(g["You cannot copy files directly into the workspace.  Create a folder first."]):b.file(function(a){m(f,a,h,a.name.indexOf(".zip")===a.name.length-4&&window.confirm(e.formatMessage(g["Unzip ${0}?"],a.name)))});else if(b.isDirectory){var n=b.createReader(),p=function(a){n.readEntries(function(c){for(var e=0;e<c.length;e++)q(c[e],d+b.name+"/",a,h,m,k,!0)})};c.isAtRoot(f.Location)?(y?y.progress(k.createProject(f.ChildrenLocation,b.name),e.formatMessage(g["Creating ${0}"],b.name)):k.createProject(f.ChildrenLocation,
b.name)).then(function(a){h.loadResourceList(h.treeRoot.Path,!0);(y?y.progress(k.read(a.ContentLocation,!0),g["Loading "]+a.name):k.read(a.ContentLocation,!0)).then(function(a){p(a)},z)},z):(y?y.progress(k.createFolder(f.Location,b.name),e.formatMessage(g["Creating ${0}"],b.name)):k.createFolder(f.Location,b.name)).then(function(b){var d=h.modelEventDispatcher;l||d.dispatchEvent({type:"create",parent:a,newValue:b});p(b)},z)}},l=function(d){var f;b.classList.remove("dragOver");if(n){f=h.fileClient;
for(var l=n,s;l;){if(l._item){s=l._item;break}l=l.parentNode}if(!s)return;var u="copy"===p,l=u?f.copyFile:f.moveFile;(y?y.showWhile(l.apply(f,[s.Location,a.Location]),e.formatMessage(g[u?"Copying ${0}":"Moving ${0}"],s.Location)):l.apply(f,[s.Location,a.Location])).then(function(b){h.modelEventDispatcher.dispatchEvent({type:u?"copy":"move",oldValue:s,newValue:b,parent:a})},z)}else if(d.dataTransfer.items&&0<d.dataTransfer.items.length)for(f=0;f<d.dataTransfer.items.length;f++)l=null,"function"===
typeof d.dataTransfer.items[f].getAsEntry?l=d.dataTransfer.items[f].getAsEntry():"function"===typeof d.dataTransfer.items[f].webkitGetAsEntry&&(l=d.dataTransfer.items[f].webkitGetAsEntry()),l&&q(l,null,a,h,m,h.fileClient);else if(d.dataTransfer.files&&0<d.dataTransfer.files.length)for(f=0;f<d.dataTransfer.files.length;f++)l=d.dataTransfer.files[f],!l.size&&!l.type?z(e.formatMessage(g["Did not drop ${0}.  Folder drop is not supported in this browser."],l.name)):c.isAtRoot(a.Location)?z(g["You cannot copy files directly into the workspace.  Create a folder first."]):
m(a,l,h,l.name.indexOf(".zip")===l.name.length-4&&window.confirm(e.formatMessage(g["Unzip ${0}?"],l.name)));k.stop(d)};f&&(this._oldDrop&&b.removeEventListener("drop",this._oldDrop,!1),this._oldDrop=l);b.addEventListener("drop",l,!1)}},createModel:function(){return new m(this.registry,this.treeRoot,this.fileClient,this.parentId,this.excludeFiles,this.excludeFolders)},changedItem:function(a,b){if(this.treeRoot&&this.treeRoot.Location===a.Location)return this.loadResourceList(this.treeRoot,b);var d=
this,c=new l;a.children=a.Children=null;this.model.getChildren(a,function(e){d.getNavHandler();d.myTree.refresh.bind(d.myTree)(a,e,b);c.resolve(e)});return c},showItem:function(a,b){var d=new l;if(!a||!this.model||!this.myTree||!this.myTree.showRoot&&a.Location===this.treeRoot.Location)return d.reject();var c=this.getRow(a);if(c)d.resolve(c._item||a);else return a.Parents&&0<a.Parents.length?(a.Parents[0].Parents=a.Parents.slice(1),this.expandItem(a.Parents[0],b).then(function(b){var d=this.getRow(a);
return!d?this.changedItem(b,!0).then(function(){var b=this.getRow(a);return b?b._item:(new l).reject()}.bind(this)):d._item||a}.bind(this))):void 0===b||b?this.reroot(a):d.reject();return d},expandItem:function(a,b){var d=new l;this.showItem(a,b).then(function(a){this.myTree.isExpanded(a)?d.resolve(a):this.myTree.expand(this.model.getId(a),function(){d.resolve(a)})}.bind(this),d.reject);return d},reveal:function(a,b){return this.showItem(a,b).then(function(a){var b=this.getNavHandler();b&&(b.cursorOn(a,
!0),b.setSelection(a));return a}.bind(this))},reroot:function(a){return(new l).reject()},isExpanded:function(a){a=this.model.getId(a);return this.renderer.tableTree.isExpanded(a)},getNameNode:function(a){if(a=this.model.getId(a))return k.node(a+"NameLink")},scopeUp:function(){},scopeDown:function(a){},loadResourceList:function(a,b,d){a&&"object"===typeof a&&(a=a.ChildrenLocation||a.ContentLocation);a=c.makeRelative(a);if(!b&&a===this._lastPath)return(new l).resolve(this.treeRoot);this._lastPath=a;
var e=this;return b||a!==this.treeRoot.Path?this.load(this.fileClient.loadWorkspace(a),g["Loading "]+a).then(function(b){e.treeRoot.Path=a;"function"===typeof d&&d();e.dispatchEvent({type:"rootChanged",root:e.treeRoot});return(new l).resolve(e.treeRoot)},function(a){e.treeRoot.Path=null;e.dispatchEvent({type:"rootChanged",root:e.treeRoot});return(new l).reject(a)}):(new l).resolve(e.treeRoot)},load:function(a,b,d){var c=k.node(this.parentId),e=k.node("progress");e||(e=document.createElement("div"),
e.id="progress",k.empty(c),c.appendChild(e));k.empty(e);var f=setTimeout(function(){k.empty(e);e.appendChild(document.createTextNode(b))},500),g=this;return l.when(a,function(a){clearTimeout(f);if(!g.destroyed){g.treeRoot={};for(var b in a)g.treeRoot[b]=a[b];g.model=g.createModel();g.dragAndDrop&&(g._hookedDrag?g._makeDropTarget(g.treeRoot,c,!0):(a=(a=c&&("draggable"in c||"ondragstart"in c&&"ondrop"in c))&&!(!window.File||!window.FileList||!window.FileReader),g._hookedDrag=!0,a?g._makeDropTarget(g.treeRoot,
c,!0):(g.dragAndDrop=null,window.console.log("Local file drag and drop is not supported in this browser."))));var e=new l;g.createTree(g.parentId,g.model,{onComplete:function(a){e.resolve(a)},navHandlerFactory:g.navHandlerFactory,setFocus:"undefined"===typeof g.setFocus?!0:g.setFocus,selectionPolicy:g.renderer.selectionPolicy,onCollapse:function(a){if(g.getNavHandler())g.getNavHandler().onCollapse(a)}});return e.then(function(){if("function"===typeof d)try{d()}catch(a){g.registry&&g.registry.getService("orion.page.message").setErrorMessage(a)}if("function"===
typeof g.onchange)g.onchange(g.treeRoot);return g.treeRoot})}},function(a){clearTimeout(f);g.registry&&g.registry.getService("orion.page.message").setProgressResult(a);return(new l).reject(a)})},onchange:function(a){}});a.prototype.constructor=a;return{FileExplorer:a,FileModel:m}});
define("orion/webui/dialogs/DirectoryPrompterDialog","i18n!orion/widgets/nls/messages orion/webui/littlelib orion/webui/dialog orion/fileUtils orion/selection orion/explorers/navigationUtils orion/explorers/explorer orion/explorers/explorer-table".split(" "),function(g,l,k,e,c,h,b,f){function d(a,b){this.explorer=b;this._init(a)}function m(a){this._init(a)}d.prototype=new b.SelectionRenderer;d.prototype.constructor=d;d.prototype.getLabelColumnIndex=function(){return 0};d.prototype.getCellElement=
function(a,b,d){a=document.createElement("td");d.appendChild(a);var c=document.createElement("span");c.id=d.id+"navSpan";a.appendChild(c);c.className="mainNavColumn singleNavColumn";this.getExpandImage(d,c);c.appendChild(document.createTextNode(b.Name))};m.prototype=new k.Dialog;m.prototype.TEMPLATE='\x3cdiv id\x3d"message" style\x3d"width: 25em; padding-bottom: 5px;"\x3e\x3c/div\x3e\x3cdiv id\x3d"directoryTree" class\x3d"explorerTreeClass" style\x3d"width:25em; min-height: 25em; max-height:30em; height: auto; overflow-y: auto;"\x3e\x3c/div\x3e';
m.prototype._init=function(a){this.title=a.title||g["Choose a Folder"];this.modal=!0;this.buttons=[{text:g.OK,isDefault:!0,callback:this.done.bind(this)}];this.customFocus=!0;this._fileClient=a.fileClient;this._serviceRegistry=a.serviceRegistry;this._message=a.message||"";this._func=a.func;this._initialize()};m.prototype._bindToDom=function(a){this.loadFolderList("/");this._message?this.$message.appendChild(document.createTextNode(this._message)):this.$message.style.display="none";this.$directoryTree.focus()};
m.prototype.loadFolderList=function(a){a=e.makeRelative(a);this.selection=new c.Selection(this._serviceRegistry,"orion.directoryPrompter.selection");this.explorer=new f.FileExplorer({treeRoot:{children:[]},selection:this.selection,serviceRegistry:this._serviceRegistry,fileClient:this._fileClient,parentId:"directoryTree",excludeFiles:!0,rendererFactory:function(a){return new d({checkbox:!1,singleSelection:!0,treeTableClass:"directoryPrompter"},a)}});this.explorer.loadResourceList(a,!0,null)};m.prototype.done=
function(){this.selection.getSelection(function(a){this.hide();this._func(a)}.bind(this))};m.prototype.constructor=m;return{DirectoryPrompterDialog:m}});
define("orion/git/widgets/CloneGitRepositoryDialog",["i18n!git/nls/gitmessages","orion/webui/dialogs/DirectoryPrompterDialog","orion/webui/dialog","orion/URITemplate","require"],function(g,l,k,e,c){function h(b){this._init(b)}var b=new e("edit/edit.html#{,resource,params*}");h.prototype=new k.Dialog;h.prototype.TEMPLATE='\x3cspan id\x3d"basicPane"\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3clabel for\x3d"gitUrl"\x3e${Repository URL:}\x3c/label\x3e\x3cinput id\x3d"gitUrl" style\x3d"width: 50em" value\x3d""/\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 8px; text-align: right;"\x3e\x3ca id\x3d"advancedLink" href\x3d"javascript:"\x3e${Choose target location}\x3c/a\x3e\x3ca id\x3d"advancedLinkHide" href\x3d"javascript:" style\x3d"display: none"\x3e${Default target location}\x3c/a\x3e\x3c/div\x3e\x3c/span\x3e\x3cspan id\x3d"advancedPane" style\x3d"display: none;"\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3cinput id\x3d"isNewProject" type\x3d"radio" name\x3d"isNewProject" checked value\x3d"new"/\x3e\x3clabel for\x3d"gitName" style\x3d"padding: 0 8px"\x3e${New folder:}\x3c/label\x3e\x3cinput id\x3d"gitName" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3cinput id\x3d"isExistingProject" type\x3d"radio" name\x3d"isNewProject" value\x3d"existing"/\x3e\x3clabel for\x3d"gitPath" style\x3d"padding: 0 8px"\x3e${Existing directory:}\x3c/label\x3e\x3cinput id\x3d"gitPath" type\x3d"hidden" value\x3d""\x3e\x3cspan id\x3d"shownGitPath" style\x3d"padding-right: 24px"\x3e\x3c/span\x3e\x3ca id\x3d"changeGitPath" href\x3d"javascript:"\x3e${Change...}\x3c/a\x3e\x3c/div\x3e\x3c/span\x3e';h.prototype._init=
function(b){var d=this;this.title=b.title?b.title:g["Clone Git Repository"];this.modal=!0;this.messages=g;this.advancedShown=!1;this.alwaysShowAdvanced=b.alwaysShowAdvanced;this.advancedOnly=b.advancedOnly;this.url=b.url;this.serviceRegistry=b.serviceRegistry;this.fileClient=b.fileClient;this.func=b.func;this.buttons=[];this.buttons.push({callback:function(){d.destroy();d._execute()},text:"OK"});this._initialize()};h.prototype._bindToDom=function(b){var d=this;this.url&&(this.$gitUrl.value=this.url);
this.advancedOnly&&(this.$basicPane.style.display="none",this.$advancedPane.style.display="",setTimeout(function(){d.$gitName.focus()},400));this.$changeGitPath.addEventListener("click",function(b){d._openDirectoryPickerDialog()});this.$isExistingProject.addEventListener("click",function(b){d._checkNewExisting()});this.$isNewProject.addEventListener("click",function(b){d._checkNewExisting()});this.$gitName.addEventListener("focus",function(b){d._showNewProject()});this.$advancedLink.addEventListener("click",
function(b){d._showAdvanced()});this.$advancedLinkHide.addEventListener("click",function(b){d._hideAdvanced()});this.alwaysShowAdvanced&&this._showAdvanced()};h.prototype._execute=function(){this.func&&this.func(this.advancedOnly?void 0:this.$gitUrl.value,this.advancedShown&&this.$isNewProject.checked?void 0:this.$gitPath.value,this.advancedShown&&!this.$isNewProject.checked?void 0:this.$gitName.value)};h.prototype._showAdvanced=function(){this.advancedShown=!0;this.$advancedPane.style.display="";
this.$advancedLink.style.display="none";this.$advancedLinkHide.style.display=""};h.prototype._hideAdvanced=function(){this.advancedShown=!1;this.$advancedPane.style.display="none";this.$advancedLink.style.display="";this.$advancedLinkHide.style.display="none"};h.prototype._checkNewExisting=function(){this.$isExistingProject.checked?this._openDirectoryPickerDialog():this.$gitName.focus()};h.prototype._showNewProject=function(){this.$isNewProject.checked=!0};h.prototype._openDirectoryPickerDialog=function(){function e(a){var d=
document.createElement("a");d.href=c.toUrl(b.expand({resource:a.ChildrenLocation}));d.textContent=a.Name;return d}var d=this;this.$isExistingProject.checked=!0;var h=new l.DirectoryPrompterDialog({title:g["Choose a Folder"],serviceRegistry:this.serviceRegistry,fileClient:this.fileClient,func:function(a){if(a&&a.Location){for(d.$gitPath.value=a.Location;d.$shownGitPath.hasChildNodes();)d.$shownGitPath.removeChild(d.$shownGitPath.lastChild);for(d.$shownGitPath.appendChild(e(a));a.parent&&"/"!==a.parent.Location;)d.$shownGitPath.insertBefore(document.createTextNode("/"),
d.$shownGitPath.firstChild),d.$shownGitPath.insertBefore(e(a.parent),d.$shownGitPath.firstChild),a=a.parent}}});this._addChildDialog(h);h.show()};h.prototype.constructor=h;return{CloneGitRepositoryDialog:h}});
define("orion/git/widgets/GitCredentialsDialog",["i18n!git/nls/gitmessages","orion/git/gitPreferenceStorage","orion/webui/dialog","orion/git/util"],function(g,l,k,e){function c(c){this._init(c)}c.prototype=new k.Dialog;c.prototype.TEMPLATE='\x3cdiv id\x3d"gitCredentialsLabel" style\x3d"padding: 8px"\x3e${Repository URL:}\x3cstrong id\x3d"url"\x3e\x3c/strong\x3e\x3c/div\x3e\x3cdiv id\x3d"gitSshUsernameRow" style\x3d"padding: 8px"\x3e\x3clabel id\x3d"gitSshUsernameLabel" for\x3d"gitSshUsername"\x3e${Username:}\x3c/label\x3e\x3cinput id\x3d"gitSshUsername" value\x3d""\x3e\x3c/div\x3e\x3cdiv id\x3d"gitSshPasswordRow" style\x3d"padding: 8px"\x3e\x3cinput id\x3d"isSshPassword" type\x3d"radio" name\x3d"isSshPassword" checked value\x3d"password"/\x3e\x3clabel id\x3d"gitSshPasswordLabel" for\x3d"gitSshPassword" style\x3d"padding: 0 8px"\x3e${Password:}\x3c/label\x3e\x3cinput type\x3d"password" id\x3d"gitSshPassword" value\x3d"" style\x3d"width: 30em"\x3e\x3c/div\x3e\x3cdiv style\x3d"padding: 8px"\x3e\x3cdiv id\x3d"gitPrivateKeyRow"\x3e\x3cinput id\x3d"isPrivateKey" type\x3d"radio" name\x3d"isSshPassword" value\x3d"privateKey" style\x3d"vertical-align: top"/\x3e\x3clabel id\x3d"gitPrivateKeyLabel" for\x3d"gitPrivateKey" style\x3d"padding: 0 8px; vertical-align: top"\x3e${Private key:}\x3c/label\x3e\x3ctextarea id\x3d"gitPrivateKey" value\x3d""\x3e\x3c/textarea\x3e\x3c/div\x3e\x3cdiv id\x3d"gitPrivateKeyFileRow" style\x3d"padding-left: 8em"\x3e\x3clabel id\x3d"gitPrivateKeyFileLabel" for\x3d"gitPrivateKeyFile"\x3e${Private key file (optional):}\x3c/label\x3e\x3cbr\x3e\x3cinput id\x3d"gitPrivateKeyFile" multiple\x3d"false" type\x3d"file" size\x3d"53" label\x3d"Browse..."\x3e\x3c/div\x3e\x3cdiv id\x3d"gitPassphraseRow" style\x3d"padding-left: 8em"\x3e\x3clabel id\x3d"gitPassphraseLabel" for\x3d"gitPassphrase"\x3e${Passphrase (optional):}\x3c/label\x3e\x3cbr\x3e\x3cinput type\x3d"password" id\x3d"gitPassphrase" value\x3d"" style\x3d"width: 30em"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv id\x3d"gitSaveCredentialsRow" style\x3d"padding: 8px"\x3e\x3cimg id\x3d"gitSaveCredentialsInfo" src\x3d"/images/info.gif""\x3e\x3cinput id\x3d"gitSaveCredentials" type\x3d"checkbox" name\x3d"gitSaveCredentials"\x3e\x3clabel id\x3d"gitSaveCredentialsLabel" for\x3d"gitSaveCredentials"\x3e${Don\'t prompt me again:}\x3c/label\x3e\x3c/div\x3e';c.prototype._init=
function(c){var b=this;this.title=c.title||g["Git Credentials"];this.modal=!0;this.messages=g;this.options=c;!this.options.username&&!this.options.password&&!this.options.privatekey&&!this.options.passphrase&&(this.options.username=!0,this.options.password=!0,this.options.privatekey=!0,this.options.passphrase=!0);c.serviceRegistry&&(this._sshService=c.serviceRegistry.getService("orion.net.ssh"),this._progressService=c.serviceRegistry.getService("orion.page.progress"));this.buttons=[];this.buttons.push({callback:function(){b.destroy();
b._execute()},text:"OK",isDefault:!0});this._initialize()};c.prototype._bindToDom=function(c){var b=this;this.options.username||(this.$gitSshUsernameRow.style.display="none");this.options.password||(this.$gitSshPasswordRow.style.display="none");this.options.privatekey||(this.$gitPrivateKeyRow.style.display="none",this.$gitPrivateKeyFileRow.style.display="none");this.options.passphrase||(this.$gitPassphraseRow.style.display="none");this.options.errordata&&this.options.errordata.Url&&(this.$gitCredentialsLabel.style.display=
"block",this.$url.textContent=this.options.errordata.Url);this.options.errordata&&this.options.errordata.User&&""!==this.options.errordata.User&&(this.$gitSshUsername.value=this.options.errordata.User,this.$gitSshUsernameRow.style.display="none",setTimeout(function(){b.$gitSshPassword.focus()},400));(new l(this.options.serviceRegistry)).isEnabled().then(function(c){c||(b.$gitSaveCredentials.style.display="none",b.$gitSaveCredentialsLabel.style.display="none",b.$gitSaveCredentialsInfo.style.display=
"none")});this.$gitSshPassword.addEventListener("focus",function(c){b.$isSshPassword.checked=!0});this.$gitPrivateKey.addEventListener("focus",function(c){b.$isPrivateKey.checked=!0});this.$gitPrivateKeyFile.addEventListener("focus",function(c){b.$isPrivateKey.checked=!0});this.$gitPassphrase.addEventListener("focus",function(c){b.$isPrivateKey.checked=!0});this.$gitPrivateKeyFile.addEventListener("change",function(c){b.privateKeyFile=c.target.files[0]})};c.prototype._execute=function(){var c=this,
b=this.$gitPrivateKey.value,f=this.$url.textContent,d=function(a){if(c._sshService){var b=e.parseSshGitUrl(f);c._sshService.getKnownHostCredentials(b.host,b.port).then(function(b){if(c.options.func){var d="undefined"===typeof c.options.failedOperation?c.options.errordata.failedOperation:c.options.failedOperation;"undefined"!==d&&c._progressService.removeOperation(d);c.options.func({gitSshUsername:c.$gitSshUsername.value,gitSshPassword:c.$isSshPassword.checked?c.$gitSshPassword.value:"",gitPrivateKey:c.$isPrivateKey.checked?
a:"",gitPassphrase:c.$isPrivateKey.checked?c.$gitPassphrase.value:"",knownHosts:b})}})}else c.options.func&&(b="undefined"===typeof c.options.failedOperation?c.options.errordata.failedOperation:c.options.failedOperation,"undefined"!==b&&c._progressService.removeOperation(b),c.options.func({gitSshUsername:c.$gitSshUsername.value,gitSshPassword:c.$gitSshPassword.value,gitPrivateKey:a,gitPassphrase:c.$gitPassphrase.value,knownHosts:c.$gitSshKnownHosts.value}))};if(this.privateKeyFile){var g=new FileReader;
g.onload=function(a){return function(a){b=a.target.result;a=new l(c.options.serviceRegistry);c.$gitSaveCredentials.checked?a.put(f,{gitPrivateKey:b,gitPassphrase:c.$gitPassphrase.value}).then(function(){d(b)}):d(b)}}(this.privateKeyFile);g.readAsText(this.privateKeyFile)}else 0<b.length?(g=new l(c.options.serviceRegistry),c.$gitSaveCredentials.checked?g.put(f,{gitPrivateKey:b,gitPassphrase:c.$gitPassphrase.value}).then(function(){d(b)}):d(b)):(g=new l(c.options.serviceRegistry),c.$gitSaveCredentials.checked?
g.put(f,{gitSshUsername:c.$gitSshUsername.value,gitSshPassword:c.$gitSshPassword.value}).then(function(){d(b)}):d(b))};c.prototype.constructor=c;return{GitCredentialsDialog:c}});
define("orion/git/widgets/OpenCommitDialog","require i18n!git/nls/gitmessages orion/i18nUtil orion/Deferred orion/webui/dialog orion/URITemplate orion/webui/littlelib".split(" "),function(g,l,k,e,c,h,b){function f(b){this._init(b)}var d=new h("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1");f.prototype=new c.Dialog;f.prototype.TEMPLATE='\x3cdiv\x3e\x3clabel for\x3d"resourceName"\x3e${Type the commit name (sha1):}\x3c/label\x3e\x3c/div\x3e\x3cdiv\x3e\x3cinput type\x3d"text" id\x3d"resourceName"\x3e\x3c/div\x3e\x3cdiv id\x3d"results" style\x3d"max-height:400px; height:auto; overflow-y:auto;"\x3e\x3c/div\x3e';
f.prototype._init=function(b){this.title=b.title||l["Find Commit"];this.modal=!0;this.messages=l;this.SEARCH_DELAY=500;this.timeoutId=null;this.time=0;this.serviceRegistry=b.serviceRegistry;if(!this.serviceRegistry)throw Error("Missing required argument: serviceRegistry");this.repositories=b.repositories;if(!this.repositories)throw Error("Missing required argument: repositories");this.commitName=b.commitName;this._initialize()};f.prototype._bindToDom=function(c){var a=this;this.$resourceName.addEventListener("input",
function(b){a.time=+new Date;a.timeoutId&&clearTimeout(a.timeoutId);a.timeoutId=setTimeout(a._checkSearch.bind(a),0)},!1);this.$resourceName.addEventListener("keydown",function(c){if(c.keyCode===b.KEY.ENTER){var d=b.$("a",a.$results);d&&(b.stop(c),window.open(d.href),a.hide())}},!1);this.$resourceName.value=this.commitName};f.prototype._checkSearch=function(){clearTimeout(this.timeoutId);var b=(new Date).getTime();b-this.time>this.SEARCH_DELAY?(this.time=b,this._doSearch()):this.timeoutId=setTimeout(this._checkSearch.bind(this),
50)};f.prototype._findCommitLocation=function(b,a,c){var d=this;c||(c=new e);0<b.length?this.serviceRegistry.getService("orion.page.progress").progress(d.serviceRegistry.getService("orion.git.provider").doGitLog("/gitapi/commit/"+a+b[0].ContentLocation+"?page\x3d1\x26pageSize\x3d1"),"Getting commit details "+a).then(function(a){c.resolve(a.Children[0])},function(e){d._findCommitLocation(b.slice(1),a,c)}):c.reject();return c};f.prototype._doSearch=function(){var c=this,a=this.$resourceName&&this.$resourceName.value;
if(a){var d=document.createElement("div");d.appendChild(document.createTextNode(l["Searching..."]));b.empty(this.$results);this.$results.appendChild(d);this.serviceRegistry.getService("orion.page.message").setProgressMessage(l["Looking for the commit"]);this._findCommitLocation(this.repositories,a).then(function(a){b.empty(c.$results);c._displayCommit(a,c.$results);c.serviceRegistry.getService("orion.page.message").setProgressMessage("")},function(a){a=document.createElement("div");a.appendChild(document.createTextNode("No commits found"));
b.empty(c.$results);c.$results.appendChild(a);c.serviceRegistry.getService("orion.page.message").setProgressMessage("")})}};f.prototype._displayCommit=function(c,a){var e=this,f=document.createElement("div");f.style.padding="10px";f.style.maxWidth="480px";b.empty(a);a.appendChild(f);var h=c.Message.split(/(\r?\n|$)/)[0],r=document.createElement("a");r.className="navlinkonpage";r.href=g.toUrl(d.expand({resource:c.Location}));r.textContent=h;f.appendChild(r);r.addEventListener("mouseup",function(a){0===
a.button&&!a.ctrlKey&&!a.metaKey&&e.hide()},!1);r.addEventListener("keyup",function(a){a.keyCode===b.KEY.ENTER&&e.hide()},!1);h=document.createElement("div");h.style.paddingTop="15px";f.appendChild(h);c.AuthorImage&&(f=new Image,f.src=c.AuthorImage,f.name=c.AuthorName,f.className="git-author-icon",h.appendChild(f));f=document.createElement("div");f.textContent=k.formatMessage(l[" authored by ${0} {${1}) on ${2}"],c.AuthorName,c.AuthorEmail,(new Date(c.Time)).toLocaleString());h.appendChild(f);f=document.createElement("div");
f.textContent=k.formatMessage(l["committed by 0 (1)"],c.CommitterName,c.CommitterEmail);h.appendChild(f);f=document.createElement("div");f.style.paddingTop="15px";f.textContent=l["commit:"]+c.Name;h.appendChild(f);c.Parents&&0<c.Parents.length&&(a=document.createElement("div"),a.textContent=l["parent:"],f=document.createElement("a"),f.className="navlinkonpage",f.href=g.toUrl(d.expand({resource:c.Parents[0].Location})),f.textContent=c.Parents[0].Name,a.appendChild(f),f.addEventListener("mouseup",function(a){0===
a.button&&!a.ctrlKey&&!a.metaKey&&e.hide()},!1),f.addEventListener("keyup",function(a){a.keyCode===b.KEY.ENTER&&e.hide()},!1),h.appendChild(a))};f.prototype._beforeHiding=function(){clearTimeout(this._timeoutId)};f.prototype.constructor=f;return{OpenCommitDialog:f}});
define("orion/git/widgets/CommitDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv style\x3d"display: none; padding-top: 10px; padding-bottom: 10px;" id\x3d"commitInfoBar"\x3e\x3cstrong id\x3d"commitInfo"\x3e\x3c/strong\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"commitMessageLabel" for\x3d"commitMessage"\x3e${Message:}\x3c/label\x3e\x3cinput id\x3d"commitMessage" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"amendLabel" for\x3d"amend"\x3e${Amend:}\x3c/label\x3e\x3cinput id\x3d"amend" type\x3d"checkbox"\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"changeIdLabel" for\x3d"changeId"\x3e${ChangeId:}\x3c/label\x3e\x3cinput id\x3d"changeId" type\x3d"checkbox"\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"committerNameLabel" for\x3d"committerName"\x3e${Committer Name:}\x3c/label\x3e\x3cinput id\x3d"committerName" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"committerEmailLabel" for\x3d"committerEmail"\x3e${Committer Email:}\x3c/label\x3e\x3cinput id\x3d"committerEmail" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"authorNameLabel" for\x3d"authorName"\x3e${Author Name:}\x3c/label\x3e\x3cinput id\x3d"authorName" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3clabel id\x3d"authorEmailLabel" for\x3d"authorEmail"\x3e${Author Email:}\x3c/label\x3e\x3cinput id\x3d"authorEmail" style\x3d"width: 30em" value\x3d""\x3e\x3c/div\x3e';k.prototype._init=
function(e){var c=this;this.title=g["Commit Changes"];this.modal=!0;this.messages=g;this.options=e;this.buttons=[];this.buttons.push({callback:function(){c._execute()},text:"OK",id:"commitChangesButton"});this._initialize()};k.prototype._bindToDom=function(e){var c=this;this.options.body.Message&&(this.$commitMessage.value=this.options.body.Message);this.$commitMessage.addEventListener("keyup",function(e){c._validate()});this.options.body.Amend&&(this.$amend.checked=!0);this.options.body.ChangeId&&
(this.$changeId.checked=!0);this.options.body.CommitterName&&(this.$committerName.value=this.options.body.CommitterName);this.$committerName.addEventListener("keyup",function(e){c._validate()});this.options.body.CommitterEmail&&(this.$committerEmail.value=this.options.body.CommitterEmail);this.$committerEmail.addEventListener("keyup",function(e){c._validate()});this.options.body.AuthorName&&(this.$authorName.value=this.options.body.AuthorName);this.$authorName.addEventListener("keyup",function(e){c._validate()});
this.options.body.AuthorEmail&&(this.$authorEmail.value=this.options.body.AuthorEmail);this.$authorEmail.addEventListener("keyup",function(e){c._validate()});this._validate()};k.prototype._validate=function(){this.$commitMessage.value?this.$committerName.value?this.$committerEmail.value?this.$authorName.value?this.$authorEmail.value?(this.$commitInfoBar.style.display="none",this.$commitChangesButton.classList.remove(this.DISABLED)):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),
this.$commitInfo.textContent=g["The author mail is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=g["The author name is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=g["The committer mail is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=
g["The committer name is required."]):(this.$commitInfoBar.style.display="block",this.$commitChangesButton.classList.add(this.DISABLED),this.$commitInfo.textContent=g["The commit message is required."])};k.prototype._execute=function(){if(!this.$commitChangesButton.classList.contains(this.DISABLED)){if(this.options.func){var e={};e.Message=this.$commitMessage.value;e.Amend=this.$amend.checked?!0:!1;e.ChangeId=this.$changeId.checked?!0:!1;e.CommitterName=this.$committerName.value;e.CommitterEmail=
this.$committerEmail.value;e.AuthorName=this.$authorName.value;e.AuthorEmail=this.$authorEmail.value;this.options.func(e)}this.hide()}};k.prototype.constructor=k;return{CommitDialog:k}});
define("orion/git/widgets/ApplyPatchDialog",["i18n!git/nls/gitmessages","orion/webui/dialog"],function(g,l){function k(e){this._init(e)}k.prototype=new l.Dialog;k.prototype.TEMPLATE='\x3cdiv style\x3d"padding:4px"\x3e\x3cinput type\x3d"radio" name\x3d"radio" value\x3d"urlRadio" id\x3d"urlRadio" checked/\x3e'+g["URL:"]+'\x3cinput type\x3d"text" name\x3d"url" id\x3d"url"/\x3e\x3c/div\x3e\x3cdiv style\x3d"padding:4px"\x3e\x3cinput type\x3d"radio" name\x3d"radio" value\x3d"fileRadio" id\x3d"fileRadio"/\x3e'+
g["File:"]+'\x3cinput type\x3d"file" name\x3d"selectedFile" id\x3d"selectedFile" class\x3d"uploadChooser" /\x3e\x3c/div\x3e';k.prototype._init=function(e){var c=this;this.title=g["Apply Patch"];this.modal=!0;this.messages=g;this.options=e;this.buttons=[];this.buttons.push({callback:function(){c._applyPatch()},text:g.OK});this._initialize()};k.prototype._bindToDom=function(e){this.$selectedFile.onchange=function(c){this.$urlRadio.checked=!1;this.$fileRadio.checked="fileRadio"}.bind(this);this.$url.onchange=
function(c){this.$urlRadio.checked="urlRadio";this.$fileRadio.checked=!1}.bind(this)};k.prototype._applyPatch=function(e){e=new FormData;e.append("uploadedfile",this.$selectedFile.files[0]);e.append("url",this.$url.value);e.append("radio",this.$fileRadio.checked?"fileRadio":"urlRadio");this.req=new XMLHttpRequest;this.req.open("post",this.options.diffLocation);this.req.setRequestHeader("Orion-Version","1");this.req.onreadystatechange=this.handleReadyState.bind(this);this.req.send(e)};k.prototype.handleReadyState=
function(e){4===this.req.readyState&&(200===this.req.status?this.options.deferred&&this.options.deferred.resolve(this.req.responseText):this.options.deferred&&this.options.deferred.reject(this.req.responseText),this.hide())};k.prototype.constructor=k;return{ApplyPatchDialog:k}});
define("orion/git/gitCommands","i18n!git/nls/gitmessages require orion/Deferred orion/i18nUtil orion/webui/littlelib orion/commands orion/commandRegistry orion/git/util orion/compare/compareUtils orion/git/gitPreferenceStorage orion/git/gitConfigPreference orion/git/widgets/ConfirmPushDialog orion/git/widgets/RemotePrompterDialog orion/git/widgets/ReviewRequestDialog orion/git/widgets/CloneGitRepositoryDialog orion/git/widgets/GitCredentialsDialog orion/git/widgets/OpenCommitDialog orion/git/widgets/CommitDialog orion/git/widgets/ApplyPatchDialog orion/URL-shim orion/PageLinks orion/URITemplate".split(" "),function(g,
l,k,e,c,h,b,f,d,m,a,n,p,t,r,s,w,v,u,y,x,z){var q={};(function(){function A(a){return l.toUrl(D.expand({resource:a}))}function B(a){var b;try{b=JSON.parse(a.responseText)}catch(c){b={Message:g["Problem while performing the action"]}}b.HttpCode=a.status;return b}var y=!1,I=new z("git/git-repository.html#{,resource,params*}"),N=new z("git/git-log.html#{,resource,params*}?page\x3d1"),H=new z("git/git-log.html#{,resource,params*}"),E=new z("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1"),
D=new z(f.statusUILocation+"#{,resource,params*}"),F=new z("edit/edit.html#{,resource,params*}");q.updateNavTools=function(a,b,d,e,f,g,h){var m=c.node(e);if(m)b.destroy(m);else throw"could not find toolbar "+e;b.renderCommands(e,m,g,d,"button");if(h&&(e=c.node(h)))b.destroy(e),b.renderCommands(h,e,g,d,"button");if(f&&(g=c.node(f)))b.destroy(f),b.renderCommands(f,g,null,d,"button");y||(y=!0,a.getService("orion.page.selection").addEventListener("selectionChanged",function(a){var e=c.node(f);e&&(b.destroy(e),
b.renderCommands(f,e,a.selections,d,"button"))}))};q.handleKnownHostsError=function(a,b,c,d){if(confirm(e.formatMessage(g["Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}."],b.KeyType,b.Host,b.HostFingerprint))){var h=f.parseSshGitUrl(b.Url);b={host:b.Host,keyType:b.KeyType,hostKey:b.HostKey,port:h.port};a.getService("orion.net.ssh").addKnownHost(b).then(function(b){c.knownHosts=b;"undefined"!==typeof c.failedOperation&&a.getService("orion.page.progress").removeOperation(c.failedOperation);
d(c)})}};q.handleSshAuthenticationError=function(a,b,c,d,e){b=b?b.Url:void 0;var f=function(){(new s.GitCredentialsDialog({title:e,serviceRegistry:a,func:d,errordata:c.errordata,failedOperation:c.failedOperation})).show()};c.gitSshUsername&&""!==c.gitSshUsername||c.gitSshPassword&&""!==c.gitSshPassword||c.gitPrivateKey&&""!==c.gitPrivateKey?f():(new m(a)).get(b).then(function(b){""!==b.gitPrivateKey||""!==b.gitSshUsername||""!==b.gitSshPassword?("undefined"!==typeof c.failedOperation&&a.getService("orion.page.progress").removeOperation(c.failedOperation),
d({knownHosts:c.knownHosts,gitSshUsername:b.gitSshUsername,gitSshPassword:b.gitSshPassword,gitPrivateKey:b.gitPrivateKey,gitPassphrase:b.gitPassphrase})):f()},f)};q.getDefaultSshOptions=function(a,b,c){var d=new k;a=a.getService("orion.net.ssh");var e=c&&!c.optionsRequested?c.valueFor("sshuser"):"",g=c&&!c.optionsRequested?c.valueFor("sshpassword"):"",h;void 0!==b.GitUrl?h=b.GitUrl:void 0!==b.errorData?h=b.errorData.Url:void 0!==b.toRef?h=b.toRef.RemoteLocation[0].GitUrl:void 0!==b.RemoteLocation&&
(h=b.RemoteLocation[0].GitUrl);if(!h)return d.resolve({knownHosts:"",gitSshUsername:e,gitSshPassword:g,gitPrivateKey:"",gitPassphrase:""}),d;b=f.parseSshGitUrl(h);a.getKnownHostCredentials(b.host,b.port).then(function(a){d.resolve({knownHosts:a,gitSshUsername:e,gitSshPassword:g,gitPrivateKey:"",gitPassphrase:""})});return d};q.handleProgressServiceResponse=function(a,b,c,d,e,f){a&&void 0!==a.status&&(a=B(a));if(!a||void 0===a.HttpCode)d&&d(a);else switch(a.HttpCode){case 401:a.JsonData&&(b.errordata=
a.JsonData);a.failedOperation&&(b.failedOperation=a.failedOperation);q.handleSshAuthenticationError(c,a.JsonData,b,e,f);break;case 400:if(a.JsonData&&a.JsonData.HostKey){a.failedOperation&&(b.failedOperation=a.failedOperation);q.handleKnownHostsError(c,a.JsonData,b,e);break}else if(a.JsonData&&a.JsonData.Host){a.JsonData&&(b.errordata=a.JsonData);a.failedOperation&&(b.failedOperation=a.failedOperation);q.handleSshAuthenticationError(c,a.JsonData,b,e,f);break}default:b=[],b.Severity="Error",b.HTML=
!1,b.Message=a.DetailedMessage?a.DetailedMessage:a.Message,c.getService("orion.page.message").setProgressResult(b),d&&d(a)}};q.gatherSshCredentials=function(a,b,c){var d=new k,h;void 0!==b.items.RemoteLocation?h=b.items.RemoteLocation[0].GitUrl:void 0!==b.items.GitUrl?h=b.items.GitUrl:void 0!==b.items.errorData?h=b.items.errorData.Url:void 0!==b.items.toRef&&(h=b.items.toRef.RemoteLocation[0].GitUrl);var l=a.getService("orion.net.ssh"),n=f.parseSshGitUrl(h),q=function(c){a.getService("orion.net.ssh").getKnownHostCredentials(n.host,
n.port).then(function(a){b.sshObject=c;d.resolve({knownHosts:a,gitSshUsername:c.gitSshUsername,gitSshPassword:c.gitSshPassword,gitPrivateKey:c.gitPrivateKey,gitPassphrase:c.gitPassphrase})})},p=b.errorData;if(p&&p.HostKey){if(confirm(e.formatMessage(g["Would you like to add ${0} key for host ${1} to continue operation? Key fingerpt is ${2}."],p.KeyType,p.Host,p.HostFingerprint))){var r=f.parseSshGitUrl(p.Url);l.addKnownHost({host:p.Host,keyType:p.KeyType,hostKey:p.HostKey,port:r.port}).then(function(){b.sshObject&&
(""!==b.sshObject.gitSshUsername||""!==b.sshObject.gitSshPassword||""!==b.sshObject.gitPrivateKey)?q({gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""}):(new m(a)).get(h).then(function(a){q(a)},function(){q({gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""})})})}return d}var t=function(){if(!b.parameters&&!b.optionsRequested)q({gitSshUsername:"",gitSshPassword:"",gitPrivateKey:"",gitPassphrase:""});else if(b.parameters&&!b.optionsRequested){var d=b.parameters&&
b.parameters.valueFor("sshuser")?b.parameters.valueFor("sshuser"):b.errorData.User,e=b.parameters?b.parameters.valueFor("sshpassword"):"",f=b.parameters&&b.parameters.valueFor("saveCredentials")?b.parameters.valueFor("saveCredentials"):!1,g=new m(a);f?g.put(h,{gitSshUsername:d,gitSshPassword:e}).then(function(){q({gitSshUsername:d,gitSshPassword:e,gitPrivateKey:"",gitPassphrase:""})}):q({gitSshUsername:d,gitSshPassword:e,gitPrivateKey:"",gitPassphrase:""})}else(new s.GitCredentialsDialog({title:c,
serviceRegistry:a,func:q,errordata:p})).show()};b.sshObject&&(""!==b.sshObject.gitSshUsername||""!==b.sshObject.gitSshPassword||""!==b.sshObject.gitPrivateKey)?t():(new m(a)).get(h).then(function(a){""!==a.gitPrivateKey||""!==a.gitSshUsername||""!==a.gitSshPassword?q(a):t()},t);return d};q.handleGitServiceResponse=function(a,b,c,d){a&&void 0!==a.status&&(a=B(a));if(!a||!a.HttpCode)c&&c(a);else switch(a.HttpCode){case 401:d(a);break;case 400:if(a.JsonData&&a.JsonData.HostKey){d(a);break}default:d=
[],d.Severity="Error",d.HTML=!1,d.Message=a.DetailedMessage?a.DetailedMessage:a.Message,b.getService("orion.page.message").setProgressResult(d),c&&c(a)}};q.createFileCommands=function(a,c,f,r){function s(b){var c={Severity:"Error",HTML:!1};try{var d=JSON.parse(b.responseText);401===b.status?(c.HTML=!0,c.Message="\x3cspan\x3e",c.Message+=e.formatMessage(g["Authentication required for: ${0}. ${1} and re-try the request."],d.label,'\x3ca target\x3d"_blank" href\x3d"'+d.SignInLocation+'"\x3e'+g.Login+
"\x3c/a\x3e")+"\x3c/span\x3e"):c.Message=d.DetailedMessage?d.DetailedMessage:d.Message?d.Message:g["Problem while performing the action"]}catch(f){c.Message=g["Problem while performing the action"]}a.getService("orion.page.message").setProgressResult(c)}r=new b.ParametersDescription([new b.CommandParameter("name","text",g["Local Branch Name:"])]);r=new h.Command({name:g.Checkout,tooltip:g["Checkout the current tag, creating a local branch based on its contents."],imageClass:"git-sprite-checkout",
spriteClass:"gitCommandSprite",id:"eclipse.checkoutTag",parameters:r,callback:function(b){var c=b.items,d=function(b,c,d){a.getService("orion.page.progress").showWhile(a.getService("orion.git.provider").checkoutTag(b,c,d),e.formatMessage(g["Checking out tag ${0}"],d)).then(function(){f.changedItem()},s)},h=c.Repository?c.Repository.Location:c.CloneLocation;b.parameters.valueFor("name")&&!b.parameters.optionsRequested&&d(h,c.Name,b.parameters.valueFor("name"))},visibleWhen:function(a){return"Tag"===
a.Type}});c.addCommand(r);r=new h.Command({name:g.Checkout,tooltip:g["Checkout the branch or corresponding local branch and make it active. If the remote tracking branch does not have a corresponding local branch, the local branch will be created first."],imageClass:"git-sprite-checkout",spriteClass:"gitCommandSprite",id:"eclipse.checkoutBranch",callback:function(b){var c=b.items,d=a.getService("orion.git.provider"),h=a.getService("orion.page.message"),m=a.getService("orion.page.progress");h.setProgressMessage(c.Name?
e.formatMessage(g["Checking out branch ${0}..."],c.Name):g["Checking out branch..."]);"Branch"===c.Type?m.progress(d.checkoutBranch(c.CloneLocation,c.Name),"Checking out branch "+c.Name).then(function(){h.setProgressResult(g["Branch checked out."]);f.changedItem(c.parent)},function(a){s(a)}):m.progress(d.addBranch(c.Repository?c.Repository.BranchLocation:c.parent.parent.BranchLocation,null,c.Name),"Adding branch "+c.Name).then(function(a){m.progress(d.checkoutBranch(a.CloneLocation,a.Name),"Checking out branch "+
c.Name).then(function(){h.setProgressResult(g["Branch checked out."]);f.changedItem(c.Repository?c.Repository.BranchLocation:c.parent.parent.parent)},function(a){s(a)})},function(a){s(a)})},visibleWhen:function(a){return"Branch"===a.Type||"RemoteTrackingBranch"===a.Type}});c.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("name","text","Name:")]);r=new h.Command({name:g["New Branch"],tooltip:g["Add a new local branch to the repository"],id:"eclipse.addBranch",parameters:r,callback:function(b){var c=
b.items,d=a.getService("orion.page.progress"),e=function(b,e){d.progress(a.getService("orion.git.provider").addBranch(b,e),"Adding branch "+e).then(function(){f.changedItem(c)},s)},g;g="Clone"===c.Type?c.BranchLocation:c.Location;b.parameters.valueFor("name")&&!b.parameters.optionsRequested&&e(g,b.parameters.valueFor("name"))},visibleWhen:function(a){return a.GroupNode&&"Branches"===a.Name||"Clone"===a.Type&&"artifacts"===f.parentId}});c.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the local branch from the repository"],
imageClass:"core-sprite-delete",id:"eclipse.removeBranch",callback:function(b){var c=b.items;b=a.getService("orion.page.progress");confirm(e.formatMessage(g["Are you sure you want to delete branch ${0}?"],c.Name))&&b.progress(a.getService("orion.git.provider").removeBranch(c.Location),"Removing branch "+c.Name).then(function(){f.changedItem?f.changedItem(c.parent):f.displayBranches&&f.displayBranches(c.ParentLocation,null)},s)},visibleWhen:function(a){return"Branch"===a.Type&&!a.Current}});c.addCommand(r);
r=new h.Command({name:g.Delete,tooltip:g["Delete the remote tracking branch from the repository"],imageClass:"core-sprite-delete",id:"eclipse.removeRemoteBranch",callback:function(b){var c=b.items,d=a.getService("orion.page.progress");confirm(e.formatMessage(g["You're going to delete remote branch ${0} and push the change."],c.Name)+"\n\n"+g["Are you sure?"])&&q.getDefaultSshOptions(a,c).then(function(b){var e=arguments.callee,h=a.getService("orion.git.provider"),m=a.getService("orion.page.message"),
h=d.progress(h.doPush(c.Location,"",!1,!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Removing remote branch: "]+c.Name);m.createProgressMonitor(h,g["Removing remote branch: "]+c.Name);h.then(function(d){q.handleProgressServiceResponse(d,b,a,function(a){"Ok"==a.Result.Severity&&f.changedItem(c.parent)},e,g["Delete Remote Branch"])},function(d,f){q.handleProgressServiceResponse(d,b,a,function(){},e,g["Removing remote branch: "]+c.Name)})})},visibleWhen:function(a){return"RemoteTrackingBranch"===
a.Type}});c.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("name","text","Name:"),new b.CommandParameter("url","url","Url:")]);r=new h.Command({name:g["New Remote"],tooltip:g["Add a new remote to the repository"],id:"eclipse.addRemote",parameters:r,callback:function(b){var c=b.items,d=a.getService("orion.page.progress"),e=function(b,e,g){d.progress(a.getService("orion.git.provider").addRemote(b,e,g),"Adding remote "+b).then(function(){f.changedItem(c)},s)},g;g="Clone"===c.Type?
c.RemoteLocation:c.Location;b.parameters.valueFor("name")&&b.parameters.valueFor("url")&&e(g,b.parameters.valueFor("name"),b.parameters.valueFor("url"))},visibleWhen:function(a){return a.GroupNode&&"Remotes"===a.Name||"Clone"===a.Type&&"artifacts"===f.parentId}});c.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the remote from the repository"],imageClass:"core-sprite-delete",id:"eclipse.removeRemote",callback:function(b){var c=b.items;confirm(e.formatMessage(g["Are you sure you want to delete remote ${0}?"],
c.Name))&&a.getService("orion.page.progress").progress(a.getService("orion.git.provider").removeRemote(c.Location),"Removing remote "+c.Name).then(function(){f.changedItem(c.parent)},s)},visibleWhen:function(a){return"Remote"===a.Type}});c.addCommand(r);r=new h.Command({name:g.Pull,tooltip:g["Pull from the repository"],imageClass:"git-sprite-pull",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pull",callback:function(b){var c=b.items,d=c.Location,e=c.Name;q.getDefaultSshOptions(a,c).then(function(b){var h=
arguments.callee,m=a.getService("orion.git.provider"),k=a.getService("orion.page.message"),m=a.getService("orion.page.progress").progress(m.doPull(d,!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pulling: "]+e);k.createProgressMonitor(m,g["Pulling: "]+e);var l;m.then(function(d){q.handleProgressServiceResponse(d,b,a,function(a){"Clone"===c.Type&&f.changedItem(c)},h,"Pull Git Repository")},function(d,e){l&&(d.failedOperation=l);q.handleProgressServiceResponse(d,
b,a,function(){f.changedItem(c)},h,g["Pull Git Repository"])},function(a){l=a.Location})})},visibleWhen:function(a){return"Clone"===a.Type}});c.addCommand(r);r=new h.Command({name:g["Git Log"],tooltip:g["Open the log for the branch"],id:"eclipse.openGitLog",hrefCallback:function(a){return l.toUrl(N.expand({resource:a.items.CommitLocation}))},visibleWhen:function(a){return"Branch"===a.Type||"RemoteTrackingBranch"===a.Type}});c.addCommand(r);r=new h.Command({name:g["Git Log"],tooltip:g["Open the log for the repository"],
id:"eclipse.openGitLogAll",imageClass:"git-sprite-log",spriteClass:"gitCommandSprite",hrefCallback:function(a){return l.toUrl(N.expand({resource:a.items.CommitLocation}))},visibleWhen:function(a){return!a.CommitLocation||!a.StatusLocation?!1:!0}});c.addCommand(r);r=new h.Command({name:g["Git Status"],tooltip:g["Open the status for the repository"],id:"eclipse.openGitStatus",hrefCallback:function(a){return A(a.items.StatusLocation)},visibleWhen:function(a){return!a.StatusLocation?!1:!0}});c.addCommand(r);
r=new h.Command({name:g.ShowInEditor,tooltip:g.ShowInEditorTooltip,id:"eclipse.openCloneContent",hrefCallback:function(a){return l.toUrl(F.expand({resource:a.items.ContentLocation}))},visibleWhen:function(a){return!a.ContentLocation?!1:!0}});c.addCommand(r);r=new h.Command({name:g["Compare With Each Other"],id:"eclipse.compareGitCommits",hrefCallback:function(b){b=b.items;return a.getService("orion.page.progress").progress(a.getService("orion.git.provider").getDiff(b[1].DiffLocation,b[0].Name),"Generating Diff for "+
b[0].Name+" and "+b[1].Name).then(function(a){return d.generateCompareHref(a.Location,{readonly:!0})})},visibleWhen:function(a){return f.isDirectory?!1:Array.isArray(a)&&2===a.length&&"Commit"===a[0].Type&&"Commit"===a[1].Type?!0:!1}});c.addCommand(r);r=new h.Command({name:g["Compare With Working Tree"],imageClass:"git-sprite-compare",spriteClass:"gitCommandSprite",id:"eclipse.compareWithWorkingTree",hrefCallback:function(a){return d.generateCompareHref(a.items.DiffLocation,{})},visibleWhen:function(a){return"Commit"===
a.Type&&null!==a.ContentLocation&&!f.isDirectory}});c.addCommand(r);r=new h.Command({name:g.Open,id:"eclipse.openGitCommit",imageClass:"git-sprite-open",spriteClass:"gitCommandSprite",hrefCallback:function(a){return l.toUrl(F.expand({resource:a.items.ContentLocation}))},visibleWhen:function(a){return"Commit"===a.Type&&null!=a.ContentLocation&&!f.isDirectory}});c.addCommand(r);r=new h.Command({name:g.Fetch,tooltip:g["Fetch from the remote"],imageClass:"git-sprite-fetch",spriteClass:"gitCommandSprite",
id:"eclipse.orion.git.fetch",callback:function(d){var e=d.items,h=e.Location,k=e.Name,l=function(d,e){d.JsonData.HostKey?(e.parameters=null,e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),
new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):
new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=d.JsonData;e.errorData.failedOperation=d.failedOperation;c.collectParameters(e)})},n=function(){d.parameters&&d.parameters.optionsRequested?(d.parameters=null,d.optionsRequested=!0,c.collectParameters(d)):(d.errorData&&d.errorData.failedOperation&&a.getService("orion.page.progress").removeOperation(d.errorData.failedOperation),
q.gatherSshCredentials(a,d).then(function(b){var c=a.getService("orion.git.provider"),m=a.getService("orion.page.message");b=a.getService("orion.page.progress").progress(c.doFetch(h,!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Fetching remote: "]+k);m.createProgressMonitor(b,g["Fetching remote: "]+k);b.then(function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem(e)},function(a){l(a,d)})},function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem(e)},
function(a){l(a,d)})})}))};if(d.items.GitUrl)n();else{var p=a.getService("orion.git.provider"),r=a.getService("orion.page.progress");r.progress(p.getGitRemote(h),"Getting remote details "+k).then(function(a){r.progress(p.getGitClone(a.CloneLocation),"Getting git repository information "+a.Name).then(function(a){d.items.GitUrl=a.Children[0].GitUrl;n()},s)},s)}},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||"Remote"===a.Type||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?
!0:!1}});c.addCommand(r);r=new h.Command({name:g["Force Fetch"],imageClass:"git-sprite-fetch",spriteClass:"gitCommandSprite",tooltip:g["Fetch from the remote branch into your remote tracking branch overriding its current content"],id:"eclipse.orion.git.fetchForce",callback:function(d){if(confirm(g["You're going to override content of the remote tracking branch. This can cause the branch to lose commits."]+"\n\n"+g["Are you sure?"])){var e=d.items,h=e.Location,k=e.Name,l=function(d,e){d.JsonData.HostKey?
(e.parameters=null,e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser",
"text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});
e.errorData=d.JsonData;e.errorData.failedOperation=d.failedOperation;c.collectParameters(e)})},n=function(){d.parameters&&d.parameters.optionsRequested?(d.parameters=null,d.optionsRequested=!0,c.collectParameters(d)):(d.errorData&&d.errorData.failedOperation&&a.getService("orion.page.progress").removeOperation(d.errorData.failedOperation),q.gatherSshCredentials(a,d).then(function(b){var c=a.getService("orion.git.provider"),m=a.getService("orion.page.progress"),n=a.getService("orion.page.message");
b=m.progress(c.doFetch(h,!0,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Fetching remote: "]+k);n.createProgressMonitor(b,g["Fetching remote: "]+k);b.then(function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem(e)},function(a){l(a,d)})},function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem(e)},function(a){l(a,d)})})}))};if(d.items.GitUrl)n();else{var p=a.getService("orion.git.provider");p.getGitRemote(h).then(function(a){p.getGitClone(a.CloneLocation).then(function(a){d.items.GitUrl=
a.Children[0].GitUrl;n()})})}}},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||"Remote"===a.Type||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?!0:!1}});c.addCommand(r);r=new h.Command({name:g.Merge,tooltip:g["Merge the content from the branch to your active branch"],imageClass:"git-sprite-merge",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.merge",callback:function(b){var c=b.items;b=a.getService("orion.git.provider");var d=a.getService("orion.page.progress"),
h=a.getService("orion.page.message");d.progress(b.doMerge(c.HeadLocation,c.Name,!1),"Merging "+c.Name).then(function(a){var b={};if("FAST_FORWARD"===a.Result||"ALREADY_UP_TO_DATE"===a.Result)b.Severity="Ok",b.HTML=!1,b.Message=a.Result;else if(a.Result){var d=c.HeadLocation.replace("commit/HEAD","status");b.Severity="Warning";b.HTML=!0;b.Message="\x3cspan\x3e"+a.Result;if(a.FailingPaths){var m="",k=!0,l;for(l in a.FailingPaths)k||(m+=", "),k=!1,m+=l;k||(b.Severity="Error",b.Message+=". "+e.formatMessage(g["Failing paths: ${0}"],
m))}b.Message+=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(d)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e"}else a.error&&(d=c.HeadLocation.replace("commit/HEAD","status"),b.Severity="Error",a.error.responseText&&JSON.parse(a.error.responseText)?(a=JSON.parse(a.error.responseText),b.Message=a.DetailedMessage?a.DetailedMessage:a.Message):b.Message=a.error.message,b.HTML=!0,b.Message="\x3cspan\x3e"+b.Message+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(d)+'"\x3e'+g["Git Status page"]+
"\x3c/a\x3e")+"\x3c/span\x3e");h.setProgressResult(b);f.changedItem(c)},function(b,d){var h=[],m=c.HeadLocation.replace("commit/HEAD","status");h.Severity="Error";h.HTML=!0;h.Message="\x3cspan\x3e"+JSON.stringify(d.xhr.responseText).DetailedMessage+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(m)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e";a.getService("orion.page.message").setProgressResult(h);f.changedItem(c)})},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||
"Branch"===a.Type&&!a.Current||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?!0:!1}});c.addCommand(r);r=new h.Command({name:g["Merge Squash"],tooltip:g["Squash the content of the branch to the index"],imageClass:"git-sprite-merge-squash",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.mergeSquash",callback:function(b){var c=b.items;b=a.getService("orion.git.provider");var d=a.getService("orion.page.progress"),h=a.getService("orion.page.message");d.progress(b.doMerge(c.HeadLocation,
c.Name,!0),"Merging "+c.Name).then(function(a){var b=[];if("FAST_FORWARD_SQUASHED"===a.Result||"ALREADY_UP_TO_DATE"===a.Result)b.Severity="Ok",b.HTML=!1,b.Message=a.Result;else if(a.Result){var d=c.HeadLocation.replace("commit/HEAD","status");b.Severity="Warning";b.HTML=!0;b.Message="\x3cspan\x3e"+a.Result+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(d)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e"}else a.error&&(d=c.HeadLocation.replace("commit/HEAD","status"),b.Severity="Error",
a.error.responseText&&JSON.parse(a.error.responseText)?(a=JSON.parse(a.error.responseText),b.Message=a.DetailedMessage?a.DetailedMessage:a.Message):b.Message=a.error.message,b.HTML=!0,b.Message="\x3cspan\x3e"+b.Message+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(d)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e");h.setProgressResult(b);f.changedItem(c)},function(b,d){var h=[],m=c.HeadLocation.replace("commit/HEAD","status");h.Severity="Error";h.HTML=!0;h.Message="\x3cspan\x3e"+
JSON.stringify(d.xhr.responseText).DetailedMessage+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(m)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e";a.getService("orion.page.message").setProgressResult(h);f.changedItem(c)})},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||"Branch"===a.Type&&!a.Current||"Commit"===a.Type&&a.toRef&&"RemoteTrackingBranch"===a.toRef.Type?!0:!1}});c.addCommand(r);r=new h.Command({name:g.Rebase,tooltip:g["Rebase your commits by removing them from the active branch, starting the active branch again based on the latest state of the selected branch "]+
"and applying each commit again to the updated active branch.",id:"eclipse.orion.git.rebase",imageClass:"git-sprite-rebase",spriteClass:"gitCommandSprite",callback:function(b){var c=b.items;b=a.getService("orion.page.message");var d=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doRebase(c.HeadLocation,c.Name,"BEGIN"),c.Name?g["Rebase on top of "]+c.Name:g.Rebase);b.createProgressMonitor(d,c.Name?g["Rebase on top of "]+c.Name:g.Rebase);d.then(function(b){var d=[],
h=c.HeadLocation.replace("commit/HEAD","status");"OK"===b.Result||"FAST_FORWARD"===b.Result||"UP_TO_DATE"===b.Result?(d.Severity="Ok",d.HTML=!1,d.Message=b.Result):"STOPPED"===b.Result?(d.Severity="Warning",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Some conflicts occurred. Please resolve them and continue, skip patch or abort rebasing"]+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(h)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e"):"FAILED_WRONG_REPOSITORY_STATE"===b.Result?
(d.Severity="Error",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Repository state is invalid (i.e. already during rebasing)"]+e.formatMessage(". Go to ${0}.",'\x3ca href\x3d"'+A(h)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e"):"FAILED_UNMERGED_PATHS"===b.Result?(d.Severity="Error",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Repository contains unmerged paths"]+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(h)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e"):
"FAILED_PENDING_CHANGES"===b.Result?(d.Severity="Error",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Repository contains pending changes. Please commit or stash them"]+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(h)+'"\x3eGit Status page\x3c/a\x3e')+".\x3c/span\x3e"):(d.Severity="Warning",d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(h)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+".\x3c/span\x3e");a.getService("orion.page.message").setProgressResult(d);
f.changedItem(c)},s)},visibleWhen:function(a){this.tooltip=g["Rebase your commits by removing them from the active branch, "]+g["starting the active branch again based on the latest state of '"]+a.Name+"' "+g["and applying each commit again to the updated active branch."];return"RemoteTrackingBranch"===a.Type||"Branch"===a.Type&&!a.Current}});c.addCommand(r);r=new h.Command({name:g["Push All"],tooltip:g["Push commits and tags from your local branch into the remote branch"],imageClass:"git-sprite-push",
spriteClass:"gitCommandSprite",id:"eclipse.orion.git.push",callback:function(d){var e=d.targetBranch,h,l=d.items;l.toRef&&(l=l.toRef);l.CloneLocation.split("/");var r=function(d,e){d.JsonData.HostKey?(e.parameters=null,e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword",
"password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],
{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=d.JsonData;e.errorData.failedOperation=d.failedOperation;c.collectParameters(e)})};if(d.parameters&&d.parameters.optionsRequested)d.parameters=null,d.optionsRequested=!0,c.collectParameters(d);else{var s=a.getService("orion.git.provider"),t=a.getService("orion.page.progress");d.errorData&&
d.errorData.failedOperation&&t.removeOperation(d.errorData.failedOperation);var u=function(b,c,e,h,m){var k=a.getService("orion.page.message");b=t.progress(s.doPush(c,e,!0,m,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+h);k.createProgressMonitor(b,g["Pushing remote: "]+h);b.then(function(b){q.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){r(a,d)})},function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem()},
function(a){r(a,d)})})};t.progress(s.getGitClone(l.CloneLocation),"Getting git repository details "+l.Name).then(function(b){var c=b.Children[0].RemoteLocation,f=b.Children[0].ConfigLocation,m=function(b){q.handleProgressServiceResponse(b,{},a)};q.gatherSshCredentials(a,d).then(function(b){var q=new k;if(1===l.RemoteLocation.length&&1===l.RemoteLocation[0].Children.length)q=t.progress(s.getGitRemote(c),"Getting git remote details "+l.Name);else{var r={};r.Children=l.RemoteLocation;q.resolve(r)}q.then(function(c){e?
u(b,e.Location,"HEAD",e.Name,!1):(c=new p.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:s,treeRoot:{Children:c.Children},hideNewBranch:!1,func:function(a,c,e){h=null===a?e:a;var g="branch."+l.Name+".remote";t.progress(s.addCloneConfigurationProperty(f,g,h.parent.Name),"Adding git configuration property "+l.Name).then(function(){d.targetBranch=h;u(b,h.Location,"HEAD",h.Name,!1)},function(a){409===a.status?s.getGitCloneConfig(f).then(function(a){if(a.Children)for(var c=
0;c<a.Children.length;c++)if(a.Children[c].Key===g){t.progress(s.editCloneConfigurationProperty(a.Children[c].Location,h.parent.Name),"Updating configuration property "+h.parent.Name).then(function(){d.targetBranch=h;u(b,h.Location,"HEAD",h.Name,!1)},m);break}},m):m(a)})}}),1===l.RemoteLocation.length&&1===l.RemoteLocation[0].Children.length&&(c=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:s,dialog:c,location:l.RemoteLocation[0].Children[0].Name,func:function(){d.targetBranch=
l.RemoteLocation[0].Children[0];u(b,l.RemoteLocation[0].Children[0].Location,"HEAD",l.Name,!1)}})),c.show())})})})}},visibleWhen:function(a){return a.toRef?""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation:"Branch"===a.Type&&a.Current&&a.RemoteLocation}});c.addCommand(r);r=new h.Command({name:g["Push Branch"],tooltip:g["Push commits without tags from your local branch into the remote branch"],imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushBranch",
callback:function(d){var e=d.targetBranch,h,l=d.items;l.toRef&&(l=l.toRef);l.CloneLocation.split("/");var r=function(d,e){d.JsonData.HostKey?(e.parameters=null,e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword",
"password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],
{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=d.JsonData;e.errorData.failedOperation=d.failedOperation;c.collectParameters(e)})};if(d.parameters&&d.parameters.optionsRequested)d.parameters=null,d.optionsRequested=!0,c.collectParameters(d);else{var s=a.getService("orion.git.provider"),t=a.getService("orion.page.progress");d.errorData&&
d.errorData.failedOperation&&t.removeOperation(d.errorData.failedOperation);var u=function(b,c,e,h,m){var k=a.getService("orion.page.message");b=t.progress(s.doPush(c,e,!1,m,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+h);k.createProgressMonitor(b,g["Pushing remote: "]+h);b.then(function(b){q.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){r(a,d)})},function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem()},
function(a){r(a,d)})})};t.progress(s.getGitClone(l.CloneLocation),"Getting git repository details "+l.Name).then(function(b){var c=b.Children[0].RemoteLocation,f=b.Children[0].ConfigLocation,m=function(b){q.handleProgressServiceResponse(b,{},a)};q.gatherSshCredentials(a,d).then(function(b){var q=new k;if(1===l.RemoteLocation.length&&1===l.RemoteLocation[0].Children.length)q=t.progress(s.getGitRemote(c),"Getting git remote details "+l.Name);else{var r={};r.Children=l.RemoteLocation;q.resolve(r)}q.then(function(c){e?
u(b,e.Location,"HEAD",e.Name,!1):(c=new p.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:s,treeRoot:{Children:c.Children},hideNewBranch:!1,func:function(a,c,e){h=null===a?e:a;var g="branch."+l.Name+".remote";t.progress(s.addCloneConfigurationProperty(f,g,h.parent.Name),"Adding git configuration property "+l.Name).then(function(){d.targetBranch=h;u(b,h.Location,"HEAD",h.Name,!1)},function(a){409===a.status?s.getGitCloneConfig(f).then(function(a){if(a.Children)for(var c=
0;c<a.Children.length;c++)if(a.Children[c].Key===g){t.progress(s.editCloneConfigurationProperty(a.Children[c].Location,h.parent.Name),"Updating configuration property "+h.parent.Name).then(function(){d.targetBranch=h;u(b,h.Location,"HEAD",h.Name,!1)},m);break}},m):m(a)})}}),1===l.RemoteLocation.length&&1===l.RemoteLocation[0].Children.length&&(c=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:s,dialog:c,location:l.RemoteLocation[0].Children[0].Name,func:function(){d.targetBranch=
l.RemoteLocation[0].Children[0];u(b,l.RemoteLocation[0].Children[0].Location,"HEAD",l.Name,!1)}})),c.show())})})})}},visibleWhen:function(a){return a.toRef?""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation:"Branch"===a.Type&&a.Current&&a.RemoteLocation}});c.addCommand(r);r=new h.Command({name:g["Push for Review"],tooltip:g["Push commits to Gerrit Code Review"],imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushToGerrit",callback:function(d){var e=
d.targetBranch,h=d.items;h.toRef&&(h=h.toRef);h.CloneLocation.split("/");var l=function(d,e){d.JsonData.HostKey?(e.parameters=null,e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,e.errorData.failedOperation=d.failedOperation,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),
new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):
new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=d.JsonData;e.errorData.failedOperation=d.failedOperation;c.collectParameters(e)})};if(d.parameters&&d.parameters.optionsRequested)d.parameters=null,d.optionsRequested=!0,c.collectParameters(d);else{var p=a.getService("orion.git.provider"),r=a.getService("orion.page.progress");d.errorData&&d.errorData.failedOperation&&
r.removeOperation(d.errorData.failedOperation);var s=function(b,c,e,h,m){var k=a.getService("orion.page.message");b=r.progress(p.doPush(c,e,!1,m,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+h);k.createProgressMonitor(b,g["Pushing remote: "]+h);b.then(function(b){q.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){l(a,d)})},function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){l(a,d)})})};r.progress(p.getGitClone(h.CloneLocation),
"Getting git repository details "+h.Name).then(function(b){var c=b.Children[0].RemoteLocation;q.gatherSshCredentials(a,d).then(function(b){var f=new k;if(1===h.RemoteLocation.length&&1===h.RemoteLocation[0].Children.length)f=r.progress(p.getGitRemote(c),"Getting git remote details "+h.Name);else{var m={};m.Children=h.RemoteLocation;f.resolve(m)}f.then(function(c){if(e)s(b,e.Location,"HEAD",e.Name,!1);else{d.targetBranch=h.RemoteLocation[0].Children[0];c=h.RemoteLocation[0].Children[0].Location.split("/");
c[4]=encodeURIComponent(encodeURIComponent("refs/for/master"));var f=c.join("/");d.targetBranch.Location=f;d.targetBranch.Name="refs/for/master";dialog=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:p,dialog:null,location:"refs/for/master",func:function(){s(b,f,"HEAD","refs/for/master",!1)}});dialog.show()}})})})}},visibleWhen:function(a){return a.toRef?""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation&&a.toRef.RemoteLocation[0].IsGerrit:
"Branch"===a.Type&&a.Current&&a.RemoteLocation&&a.RemoteLocation[0].IsGerrit}});c.addCommand(r);r=new h.Command({name:g["Force Push All"],tooltip:g["Push commits and tags from your local branch into the remote branch overriding its current content"],imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushForce",callback:function(d){var e=d.confirmedWarnings,h=d.targetBranch;if(!e)if(confirm(g["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+
"\n\n"+g["Are you sure?"]))e=d.confirmedWarnings=!0;else return;var l,r=d.items;r.toRef&&(r=r.toRef);var s=r.CloneLocation.split("/"),t=function(d,e){d.JsonData.HostKey?(e.parameters=null,e.errorData=d.JsonData,c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials",
"boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser",
"text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=d.JsonData;c.collectParameters(e)})};if(d.parameters&&d.parameters.optionsRequested)d.parameters=null,d.optionsRequested=!0,c.collectParameters(d);else{var u=a.getService("orion.git.provider"),v=a.getService("orion.page.progress"),w=function(b,c,e,h,m){var k=a.getService("orion.page.message");b=v.progress(u.doPush(c,e,!0,m,b.gitSshUsername,b.gitSshPassword,b.knownHosts,
b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+h);k.createProgressMonitor(b,g["Pushing remote: "]+h);b.then(function(b){q.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){t(a,d)})},function(b,c){q.handleGitServiceResponse(b,a,function(){f.changedItem(r)},function(a){t(a,d)})})};v.progress(u.getGitClone(r.CloneLocation),"Getting git repository details "+r.Name).then(function(b){var c=b.Children[0].RemoteLocation,e=b.Children[0].ConfigLocation;q.gatherSshCredentials(a,d).then(function(b){var f=
new k;if(1===r.RemoteLocation.length&&1===r.RemoteLocation[0].Children.length)f=v.progress(u.getGitRemote(c),"Getting remote details "+r.Name);else{var m={};m.Children=r.RemoteLocation;f.resolve(m)}f.then(function(c){h?w(b,h.Location,"HEAD",h.Name,!0):(c=new p.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:u,treeRoot:{Children:c.Children},hideNewBranch:!1,func:function(a,c,f){l=null===a?f:a;var g="/gitapi/config/branch."+r.Name+".remote/clone/file/"+s[4];v.progress(u.addCloneConfigurationProperty(e,
"branch."+r.Name+".remote",l.parent.Name),"Setting git configuration property "+r.Name).then(function(){d.targetBranch=l;w(b,l.Location,"HEAD",l.Name,!0)},function(a){409===a.status&&v.progres(u.editCloneConfigurationProperty(g,l.parent.Name),"Setting git configuration property "+l.parent.Name).then(function(){d.targetBranch=l;w(b,l.Location,"HEAD",l.Name,!0)})})}}),1===r.RemoteLocation.length&&1===r.RemoteLocation[0].Children.length&&(c=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,
gitClient:u,dialog:c,location:r.RemoteLocation[0].Children[0].Name,func:function(){d.targetBranch=r.RemoteLocation[0].Children[0];w(b,r.RemoteLocation[0].Children[0].Location,"HEAD",r.Location,!0)}})),c.show())})})})}},visibleWhen:function(a){if(a.toRef)return""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation}});c.addCommand(r);r=new h.Command({name:g["Force Push Branch"],tooltip:g["Push commits without tags from your local branch into the remote branch overriding its current content"],
imageClass:"git-sprite-push",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.pushForceBranch",callback:function(d){var e=d.confirmedWarnings,h=d.targetBranch;if(!e)if(confirm(g["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+"\n\n"+g["Are you sure?"]))e=d.confirmedWarnings=!0;else return;var l,r=d.items;r.toRef&&(r=r.toRef);var s=r.CloneLocation.split("/"),t=function(d,e){d.JsonData.HostKey?(e.parameters=null,e.errorData=d.JsonData,
c.collectParameters(e)):e.optionsRequested?(e.errorData=d.JsonData,c.collectParameters(e)):(new m(a)).isEnabled().then(function(a){e.parameters=a?d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),
new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):d.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=d.JsonData;c.collectParameters(e)})};if(d.parameters&&d.parameters.optionsRequested)d.parameters=
null,d.optionsRequested=!0,c.collectParameters(d);else{var u=a.getService("orion.git.provider"),v=a.getService("orion.page.progress"),w=function(b,c,e,h,m){var k=a.getService("orion.page.message");b=v.progress(u.doPush(c,e,!1,m,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),g["Pushing remote: "]+h);k.createProgressMonitor(b,g["Pushing remote: "]+h);b.then(function(b){q.handleGitServiceResponse(b,a,function(){f.changedItem()},function(a){t(a,d)})},function(b,c){q.handleGitServiceResponse(b,
a,function(){f.changedItem(r)},function(a){t(a,d)})})};v.progress(u.getGitClone(r.CloneLocation),"Getting git repository details "+r.Name).then(function(b){var c=b.Children[0].RemoteLocation,e=b.Children[0].ConfigLocation;q.gatherSshCredentials(a,d).then(function(b){var f=new k;if(1===r.RemoteLocation.length&&1===r.RemoteLocation[0].Children.length)f=v.progress(u.getGitRemote(c),"Getting remote details "+r.Name);else{var m={};m.Children=r.RemoteLocation;f.resolve(m)}f.then(function(c){h?w(b,h.Location,
"HEAD",h.Name,!0):(c=new p.RemotePrompterDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:u,treeRoot:{Children:c.Children},hideNewBranch:!1,func:function(a,c,f){l=null===a?f:a;var g="/gitapi/config/branch."+r.Name+".remote/clone/file/"+s[4];v.progress(u.addCloneConfigurationProperty(e,"branch."+r.Name+".remote",l.parent.Name),"Setting git configuration property "+r.Name).then(function(){d.targetBranch=l;w(b,l.Location,"HEAD",l.Name,!0)},function(a){409===a.status&&v.progres(u.editCloneConfigurationProperty(g,
l.parent.Name),"Setting git configuration property "+l.parent.Name).then(function(){d.targetBranch=l;w(b,l.Location,"HEAD",l.Name,!0)})})}}),1===r.RemoteLocation.length&&1===r.RemoteLocation[0].Children.length&&(c=new n.ConfirmPushDialog({title:g["Choose Branch"],serviceRegistry:a,gitClient:u,dialog:c,location:r.RemoteLocation[0].Children[0].Name,func:function(){d.targetBranch=r.RemoteLocation[0].Children[0];w(b,r.RemoteLocation[0].Children[0].Location,"HEAD",r.Location,!0)}})),c.show())})})})}},
visibleWhen:function(a){if(a.toRef)return""===a.RepositoryPath&&"Branch"===a.toRef.Type&&a.toRef.Current&&a.toRef.RemoteLocation}});c.addCommand(r);r=new h.Command({name:g["\x3c Previous Page"],tooltip:g["Show previous page of git log"],id:"eclipse.orion.git.previousLogPage",hrefCallback:function(a){return l.toUrl(H.expand({resource:a.items.PreviousLocation}))},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||a.toRef&&"Branch"===a.toRef.Type||null!==a.RepositoryPath?void 0!==a.PreviousLocation:
!1}});c.addCommand(r);r=new h.Command({name:g["Next Page \x3e"],tooltip:g["Show next page of git log"],id:"eclipse.orion.git.nextLogPage",hrefCallback:function(a){return l.toUrl(H.expand({resource:a.items.NextLocation}))},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type||a.toRef&&"Branch"===a.toRef.Type||null!==a.RepositoryPath?void 0!==a.NextLocation:!1}});c.addCommand(r);r=new h.Command({name:g["\x3c Previous Page"],tooltip:g["Show previous page of git tags"],id:"eclipse.orion.git.previousTagPage",
hrefCallback:function(a){return l.toUrl(I.expand({resource:a.items.PreviousLocation}))},visibleWhen:function(a){return"Tag"===a.Type?void 0!==a.PreviousLocation:!1}});c.addCommand(r);r=new h.Command({name:g["Next Page \x3e"],tooltip:g["Show next page of git tags"],id:"eclipse.orion.git.nextTagPage",hrefCallback:function(a){return l.toUrl(I.expand({resource:a.items.NextLocation}))},visibleWhen:function(a){return"Tag"===a.Type?void 0!==a.NextLocation:!1}});c.addCommand(r);r=new h.Command({name:g.Reset,
tooltip:g["Reset your active branch to the state of the selected branch. Discard all staged and unstaged changes."],id:"eclipse.orion.git.resetIndex",imageClass:"git-sprite-reset",spriteClass:"gitCommandSprite",callback:function(b){var c=b.items;if(confirm(e.formatMessage(g.GitResetIndexConfirm,c.Name))){b=a.getService("orion.git.provider");var d=a.getService("orion.page.message");b=a.getService("orion.page.progress").progress(b.resetIndex(c.IndexLocation,c.Name),"Resetting git index for "+c.Name);
d.createProgressMonitor(b,g["Resetting index..."]);b.then(function(a){f.changedItem(c);d.setProgressResult({Severity:"Info",HTML:!1,Message:"Ok"})},function(a){var b={Severity:"Error",HTML:!1};b.Message=a.message;d.setProgressResult(b)})}},visibleWhen:function(a){return"RemoteTrackingBranch"===a.Type}});c.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("name","text",g["Name:"])]);r=new h.Command({name:g.Tag,tooltip:g["Create a tag for the commit"],imageClass:"git-sprite-tag",spriteClass:"gitCommandSprite",
id:"eclipse.orion.git.addTag",parameters:r,callback:function(b){var c=b.items,d=function(b,d){a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doAddTag(b,d),"Adding tag "+d).then(function(){f.changedItem(c)},s)},e=c.Location;b.parameters.valueFor("name")&&!b.parameters.optionsRequested&&d(e,b.parameters.valueFor("name"))},visibleWhen:function(a){return"Commit"===a.Type}});c.addCommand(r);r=new h.Command({name:g.Delete,tooltip:g["Delete the tag from the repository"],
imageClass:"core-sprite-delete",id:"eclipse.removeTag",callback:function(b){var c=b.items;confirm(e.formatMessage(g["Are you sure you want to delete tag ${0}?"],c.Name))&&a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doRemoveTag(c.Location),"Removing tag "+c.Name).then(function(){f.changedItem(c.parent)},s)},visibleWhen:function(a){return"Tag"===a.Type}});c.addCommand(r);r=new b.ParametersDescription([new b.CommandParameter("reviewer","text",g["Reviewer name"])],
{hasOptionalParameters:!0});r=new h.Command({name:g["Ask for review"],tooltip:g["Ask for review tooltip"],imageClass:"core-sprite-tag",id:"eclipse.orion.git.askForReviewCommand",parameters:r,callback:function(b){var c=a.getService("orion.page.progress"),d=function(a){var b=document.createElement("a");b.href=a;"ssh:"===b.protocol&&(b=a.indexOf("@"),-1!==b&&(a="ssh://"+a.substr(b+1)));return a},e=function(e){var f=b.items,g=f.Location.replace(f.Name,"HEAD"),h=f.AuthorName,m=f.Name,k=f.Message;c.progress(a.getService("orion.git.provider").getGitClone(f.CloneLocation),
"Getting repository details "+f.Name).then(function(b){window.location.href.split("#");var l=x.getOrionHome();b=d(b.Children[0].GitUrl);l=l+"/git/reviewRequest.html#"+b+"_"+f.Name;c.progress(a.getService("orion.git.provider").sendCommitReviewRequest(m,g,e,l,h,k),"Sending review request for "+m).then(function(b){var c={Severity:"Ok",HTML:!1};c.Message=b.Result;a.getService("orion.page.message").setProgressResult(c)},s)})};if(b.parameters.valueFor("reviewer")&&!b.parameters.optionsRequested)e(b.parameters.valueFor("reviewer"));
else{var f=b.items;c.progress(a.getService("orion.git.provider").getGitClone(f.CloneLocation),"Getting git details "+f.Name).then(function(a){window.location.href.split("#");var b=x.getOrionHome();a=d(a.Children[0].GitUrl);(new t.ReviewRequestDialog({title:g["Contribution Review Request"],url:b+"/git/reviewRequest.html#"+a+"_"+f.Name,func:e})).show()},s)}},visibleWhen:function(a){return"Commit"===a.Type}});c.addCommand(r);r=new h.Command({name:g["Cherry-Pick"],tooltip:g["Apply the change introduced by the commit to your active branch"],
id:"eclipse.orion.git.cherryPick",imageClass:"git-sprite-cherry-pick",spriteClass:"gitCommandSprite",callback:function(b){var c=b.items;b=a.getService("orion.page.progress");var d=a.getService("orion.git.provider"),f=c.Location.replace(c.Name,"HEAD");b.progress(d.doCherryPick(f,c.Name),"Cherry picking "+c.Name).then(function(b){var d=[],f=c.Location.replace("commit/"+c.Name,"status");if("OK"===b.Result)d.Severity="Ok",b.HeadUpdated?(d.HTML=!1,d.Message=b.Result):(d.HTML=!0,d.Message="\x3cspan\x3e"+
g["Nothing changed."]+"\x3c/span\x3e");else if("CONFLICTING"===b.Result)d.Severity="Warning",d.HTML=!0,f=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(f)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e",d.Message="\x3cspan\x3e"+b.Result+g[". Some conflicts occurred"]+f;else if("FAILED"===b.Result){d.Severity="Error";d.HTML=!0;d.Message="\x3cspan\x3e"+b.Result;if(b.FailingPaths){var h="",m=!0,k;for(k in b.FailingPaths)m||(h+=", "),m=!1,h+=k;m||(d.Message+=". "+e.formatMessage(g["Failing paths: ${0}"],
h))}d.Message+=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(f)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e"}else d.Severity="Warning",d.HTML=!1,d.Message=b.Result;a.getService("orion.page.message").setProgressResult(d)},s)},visibleWhen:function(a){return"Commit"===a.Type}});c.addCommand(r);r=new h.Command({name:g.Revert,tooltip:g["Revert changes introduced by the commit into your active branch"],id:"eclipse.orion.git.revert",imageClass:"git-sprite-reset",spriteClass:"gitCommandSprite",
callback:function(b){var c=b.items;b=a.getService("orion.page.progress");var d=a.getService("orion.git.provider"),f=c.Location.replace(c.Name,"HEAD");b.progress(d.doRevert(f,c.Name),"Reverting "+c.Name).then(function(b){var d=[],f=c.Location.replace("commit/"+c.Name,"status");"OK"===b.Result?(d.Severity="Ok",d.HTML=!1,d.Message=b.Result):"FAILURE"===b.Result?(f=e.formatMessage(g[". Go to ${0}."],'\x3ca href\x3d"'+A(f)+'"\x3e'+g["Git Status page"]+"\x3c/a\x3e")+"\x3c/span\x3e",d.Severity="Warning",
d.HTML=!0,d.Message="\x3cspan\x3e"+b.Result+g[". Could not revert into active branch"]+f):(d.Severity="Warning",d.HTML=!1,d.Message=b.Result);a.getService("orion.page.message").setProgressResult(d)},s)},visibleWhen:function(a){return"Commit"===a.Type}});c.addCommand(r)};q.createGitClonesCommands=function(c,d,f,n,p,s){function t(a){var b={Severity:"Error",HTML:!1};try{var d=JSON.parse(a.responseText);b.Message=d.DetailedMessage?d.DetailedMessage:d.Message?d.Message:g["Problem while performing the action"]}catch(e){b.Message=
g["Problem while performing the action"]}c.getService("orion.page.message").setProgressResult(b)}function v(a){Array.isArray(a)&&(a=1<a.length?{}:a[0]);return a}n=new b.ParametersDescription([new b.CommandParameter("key","text",g["Key:"]),new b.CommandParameter("value","text",g["Value:"])]);n=new h.Command({name:g["New Configuration Entry"],tooltip:"Add a new entry to the repository configuration",id:"eclipse.orion.git.addConfigEntryCommand",parameters:n,callback:function(a){var b=a.items,d=c.getService("orion.git.provider"),
e=c.getService("orion.page.progress");a.parameters.valueFor("key")&&a.parameters.valueFor("value")&&e.progress(d.addCloneConfigurationProperty(b.ConfigLocation,a.parameters.valueFor("key"),a.parameters.valueFor("value")),"Setting configuration propetry: "+a.parameters.valueFor("key")).then(function(a){f.changedItem(b)},t)}});d.addCommand(n);n=new b.ParametersDescription([],null,function(a){a=a.items;var c;a&&(c=a.Value);return[new b.CommandParameter("value","text",g["Value:"],c)]});n=new h.Command({name:g.Edit,
tooltip:g["Edit the configuration entry"],imageClass:"core-sprite-edit",id:"eclipse.orion.git.editConfigEntryCommand",parameters:n,callback:function(a){var b=a.items,d=c.getService("orion.git.provider"),e=c.getService("orion.page.progress");a.parameters.valueFor("value")&&e.progress(d.editCloneConfigurationProperty(b.Location,a.parameters.valueFor("value")),"Editing configuration property "+b.Key).then(function(a){f.changedItem(b)},t)},visibleWhen:function(a){return a.Key&&a.Value&&a.Location}});
d.addCommand(n);n=new h.Command({name:g.Delete,tooltip:g["Delete the configuration entry"],imageClass:"core-sprite-delete",id:"eclipse.orion.git.deleteConfigEntryCommand",callback:function(a){var b=a.items;a=c.getService("orion.git.provider");var d=c.getService("orion.page.progress");confirm(e.formatMessage(g["Are you sure you want to delete ${0}?"],b.Key))&&d.progress(a.deleteCloneConfigurationProperty(b.Location),"Deleting configuration property "+b.Key).then(function(a){f.changedItem(b)},t)},visibleWhen:function(a){return a.Key&&
a.Value&&a.Location}});d.addCommand(n);n=new b.ParametersDescription([new b.CommandParameter("url","url",g["Repository URL:"])],{hasOptionalParameters:!0});p=new h.Command({name:g["Clone Repository"],tooltip:g["Clone an existing Git repository to a folder"],id:"eclipse.createGitProject",callback:function(b){var d=b.items,e=c.getService("orion.git.provider"),h=c.getService("orion.page.progress"),m=function(b,m,k){d.GitUrl=b;q.getDefaultSshOptions(c,d).then(function(n){var p=arguments.callee,r=new a(c);
c.getService("orion.page.message").setProgressMessage("Your project is being set up. This may take a minute...");r.getConfig().then(function(a){h.progress(e.cloneGitRepository(k,b,m,f.defaultPath,n.gitSshUsername,n.gitSshPassword,n.knownHosts,n.gitPrivateKey,n.gitPassphrase,a,!0),"Cloning repository "+k).then(function(a,b){q.handleProgressServiceResponse(a,n,c,function(a){e.getGitClone(a.Location).then(function(a){var b="",c;for(c in d.projectDescription)b+=c+"\x3d"+d.projectDescription[c]+"\n";s.write(a.Children[0].ContentLocation+
".git/.projectInfo",b).then(function(){var b=l.toUrl(F.expand({resource:a.Children[0].ContentLocation}));window.location=b})})},p,g["Clone Git Repository"])},function(a,b){q.handleProgressServiceResponse(a,n,c,function(){},p,g["Clone Git Repository"])})})})};d.url&&d.projectDescription.name&&(c.getService("orion.page.message").setProgressMessage("Looking for project "+d.projectDescription.name),s.loadWorkspace().then(function(a){for(var b=0;b<a.Children.length;++b){var c=a.Children[b];if(c.Name===
d.projectDescription.name){c.Git?e.getGitClone(c.Git.CloneLocation).then(function(a){a.Children[0].GitUrl===d.url?window.location=l.toUrl(F.expand({resource:a.Children[0].ContentLocation})):console.info("Folder project is used")}):console.info("Folder project is used");return}}m(d.url,null,d.projectDescription.name)}))},visibleWhen:function(a){return!0}});d.addCommand(p);n=new h.Command({name:g["Clone Repository"],tooltip:g["Clone an existing Git repository to a folder"],id:"eclipse.cloneGitRepository",
parameters:n,callback:function(b){var d=b.items,e=c.getService("orion.git.provider"),h=c.getService("orion.page.progress"),m=function(b,m,k){d.GitUrl=b;q.getDefaultSshOptions(c,d).then(function(d){var l=arguments.callee;(new a(c)).getConfig().then(function(a){a=h.progress(e.cloneGitRepository(k,b,m,f.defaultPath,d.gitSshUsername,d.gitSshPassword,d.knownHosts,d.gitPrivateKey,d.gitPassphrase,a),"Cloning repository "+k);c.getService("orion.page.message").createProgressMonitor(a,g["Cloning repository: "]+
b);a.then(function(a,b){q.handleProgressServiceResponse(a,d,c,function(a){f.changedItem&&f.changedItem()},l,g["Clone Git Repository"])},function(a,b){q.handleProgressServiceResponse(a,d,c,function(){},l,g["Clone Git Repository"])})})})};b.parameters.valueFor("url")&&!b.parameters.optionsRequested?m(b.parameters.valueFor("url")):(new r.CloneGitRepositoryDialog({serviceRegistry:c,fileClient:s,url:b.parameters.valueFor("url"),alwaysShowAdvanced:b.parameters.optionsRequested,func:m})).show()},visibleWhen:function(a){return!0}});
d.addCommand(n);n=new h.Command({name:g["Clone Repository"],tooltip:g["Clone an existing Git repository to a folder"],id:"eclipse.cloneGitRepositoryReviewReq",callback:function(b){var d=b.items,e=c.getService("orion.git.provider"),h=c.getService("orion.page.progress");(new r.CloneGitRepositoryDialog({serviceRegistry:c,fileClient:s,url:b.userData,alwaysShowAdvanced:!1,func:function(b,m,k){d.GitUrl=b;q.getDefaultSshOptions(c,d).then(function(d){var l=arguments.callee;(new a(c)).getConfig().then(function(a){a=
h.progress(e.cloneGitRepository(k,b,m,f.defaultPath,d.gitSshUsername,d.gitSshPassword,d.knownHosts,d.gitPrivateKey,d.gitPassphrase,a),"Cloning git repository "+k);c.getService("orion.page.message").createProgressMonitor(a,g["Cloning repository: "]+b);a.then(function(a,b){q.handleProgressServiceResponse(a,d,c,function(a){f.changedItem&&f.changedItem()},l,g["Clone Git Repository"])},function(a,b){q.handleProgressServiceResponse(a,d,c,function(){},l,g["Clone Git Repository"])})})})}})).show()},visibleWhen:function(a){return!0}});
d.addCommand(n);n=new h.Command({name:g["Add Remote"],tooltip:g["Add a new remote to the repository"],id:"eclipse.addRemoteReviewRequestCommand",imageClass:"git-sprite-fetch",spriteClass:"gitCommandSprite",callback:function(a){a.parameters&&a.parameters.valueFor("remoteName")&&(a.remoteName=a.parameters.valueFor("remoteName"));var e=function(a,e){a.JsonData.HostKey?(e.parameters=null,e.errorData=a.JsonData,d.collectParameters(e)):e.optionsRequested?(e.errorData=a.JsonData,d.collectParameters(e)):
(new m(c)).isEnabled().then(function(c){e.parameters=c?a.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"]),new b.CommandParameter("saveCredentials","boolean",g["Don't prompt me again:"])],
{hasOptionalParameters:!0}):a.JsonData.User?new b.ParametersDescription([new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0}):new b.ParametersDescription([new b.CommandParameter("sshuser","text",g["User Name:"]),new b.CommandParameter("sshpassword","password",g["Password:"])],{hasOptionalParameters:!0});e.errorData=a.JsonData;d.collectParameters(e)})};if(a.parameters&&a.parameters.optionsRequested)a.parameters=null,a.optionsRequested=!0,d.collectParameters(a);
else{var h=function(b,d,h){var m=c.getService("orion.page.progress");m.progress(c.getService("orion.git.provider").addRemote(b,d,a.userData),"Adding git remote "+d).then(function(){q.gatherSshCredentials(c,a).then(function(b){c.getService("orion.git.provider").getGitRemote(h.RemoteLocation).then(function(k){for(var l,n=0;n<k.Children.length;n++)k.Children[n].Name===d&&(l=k.Children[n]);var p=c.getService("orion.git.provider");k=c.getService("orion.page.message");n=m.progress(p.doFetch(l.Location,
!1,b.gitSshUsername,b.gitSshPassword,b.knownHosts,b.gitPrivateKey,b.gitPassphrase),"Fetching remote "+d);k.createProgressMonitor(n,g["Fetching remote: "]+l.Location);n.then(function(b,g){q.handleGitServiceResponse(b,c,function(){m.progress(p.getGitRemote(l.Location),"Getting remote details "+d).then(function(a){f.changedItem(h)},t)},function(b){e(b,a)})},function(b,d){q.handleGitServiceResponse(b,c,function(){f.changedItem(h)},function(b){e(b,a)})})})})},t)};a.remoteName?h(a.items.RemoteLocation,
a.remoteName,a.items):(a.parameters=new b.ParametersDescription([new b.CommandParameter("remoteName","text",g["Remote Name:"])],{hasOptionalParameters:!1}),d.collectParameters(a))}},visibleWhen:function(a){return!0}});d.addCommand(n);n=new b.ParametersDescription([new b.CommandParameter("folderName","text",g["New folder:"])],{hasOptionalParameters:!0});n=new h.Command({name:g["Init Repository"],tooltip:g["Create a new Git repository in a new folder"],id:"eclipse.initGitRepository",parameters:n,callback:function(b){var d=
b.items,e=c.getService("orion.git.provider"),h=c.getService("orion.page.progress"),m=function(b,m,k){d.GitUrl=b;q.getDefaultSshOptions(c,d).then(function(d){var l=arguments.callee;(new a(c)).getConfig().then(function(a){a=h.progress(e.cloneGitRepository(k,b,m,f.defaultPath,null,null,null,null,null,a),g["Initializing repository: "]+k);c.getService("orion.page.message").createProgressMonitor(a,g["Initializing repository: "]+k);a.then(function(a,b){q.handleProgressServiceResponse(a,d,c,function(a){f.changedItem&&
f.changedItem()},l,g["Init Git Repository"])},function(a,b){q.handleProgressServiceResponse(a,d,c,function(){},l,g["Init Git Repository"])})})})};b.parameters.valueFor("folderName")&&!b.parameters.optionsRequested?m(null,null,b.parameters.valueFor("folderName")):(new r.CloneGitRepositoryDialog({serviceRegistry:c,title:g["Init Git Repository"],fileClient:s,advancedOnly:!0,func:m})).show()},visibleWhen:function(a){return!0}});d.addCommand(n);n=new h.Command({name:g.Delete,tooltip:g["Delete the repository"],
imageClass:"core-sprite-delete",id:"eclipse.git.deleteClone",visibleWhen:function(a){return"Clone"===a.Type},callback:function(a){var b=a.items;a=c.getService("orion.git.provider");var d=c.getService("orion.page.progress");if(Array.isArray(b)){if(confirm(e.formatMessage(g["Are you sure you want do delete ${0} repositories?"],b.length)))for(var h=0,m=0;m<b.length;m++)d.progress(a.removeGitRepository(b[m].Location),"Removing repository "+b.Name).then(function(a){h++;h>=b.length&&f.changedItem&&f.changedItem()},
t)}else confirm(e.formatMessage(g["Are you sure you want to delete ${0}?"],b.Name))&&d.progress(a.removeGitRepository(b.Location),"Removing repository "+b.Name).then(function(a){f.changedItem&&(window.location=l.toUrl(I.expand({})),f.changedItem())},t)}});d.addCommand(n);n=new h.Command({name:g["Apply Patch"],tooltip:g["Apply a patch on the selected repository"],id:"eclipse.orion.git.applyPatch",imageClass:"git-sprite-apply-patch",spriteClass:"gitCommandSprite",callback:function(a){a=v(a.items);var b=
new k;(new u.ApplyPatchDialog({title:g["Apply Patch"],diffLocation:a.DiffLocation,deferred:b})).show();var d=c.getService("orion.page.message");b.then(function(a){var b;try{var c=JSON.parse(a);if(c.JsonData&&c.JsonData.modifiedFieles){b="Patch applied, files modified: ";a=!0;for(var e=0;e<c.JsonData.modifiedFieles.length;e++)a||(b+=", "),b+=c.JsonData.modifiedFieles[e],a=!1;c=[];c.Severity="Info";c.HTML=!1;c.Message=b;d.setProgressResult(c);return}}catch(f){}d.setMessage("Patch applied")},function(a){var b=
JSON.parse(a);a="Apply patch failed.";b.DetailedMessage?a=a+" "+b.DetailedMessage:b.Message&&(a+=" ",a+=b.Message);b=[];b.Severity="Error";b.HTML=!1;b.Message=a;d.setProgressResult(b)})},visibleWhen:function(a){return"Clone"===a.Type}});d.addCommand(n);n=new b.ParametersDescription([new b.CommandParameter("commitName","text",g["Commit name:"])],{hasOptionalParameters:!0});n=new h.Command({name:g["Open Commit"],tooltip:g["Open the commit with the given name"],id:"eclipse.orion.git.openCommitCommand",
imageClass:"git-sprite-apply-patch",spriteClass:"gitCommandSprite",parameters:n,callback:function(a){var b=c.getService("orion.page.progress"),d=function(e,f,h){null==h&&(h=new k);0<e.length?b.progress(c.getService("orion.git.provider").doGitLog("/gitapi/commit/"+a.parameters.valueFor("commitName")+e[0].ContentLocation+"?page\x3d1\x26pageSize\x3d1",null,null,g["Looking for the commit"]),"Looking for commit "+a.parameters.valueFor("commitName")).then(function(a){h.resolve(a.Children[0].Location)},
function(a){d(e.slice(1),f,h)}):h.reject();return h},e=function(b){a.parameters.optionsRequested?(new w.OpenCommitDialog({repositories:b,serviceRegistry:c,commitName:a.parameters.valueFor("commitName")})).show():(c.getService("orion.page.message").setProgressMessage(g["Looking for the commit"]),d(b,a.parameters.valueFor("commitName")).then(function(a){a&&(a=l.toUrl(E.expand({resource:a})),window.open(a));c.getService("orion.page.message").setProgressMessage("")},function(){var a=[];a.Severity="warning";
a.HTML=!1;a.Message=g["No commits found"];c.getService("orion.page.message").setProgressResult(a)}))};if("Clone"===a.items.Type){var f=[a.items];e(f)}else a.items.CloneLocation?b.progress(c.getService("orion.git.provider").getGitClone(a.items.CloneLocation),"Getting git repository details").then(function(a){e(a.Children)}):(f=a.items,e(f))},visibleWhen:function(a){return"Clone"===a.Type||a.CloneLocation||1<a.length&&"Clone"===a[0].Type}});d.addCommand(n)};q.createGitStatusCommands=function(a,c,d){function e(b){var c=
{Severity:"Error",HTML:!1};try{var d=JSON.parse(b.responseText);c.Message=d.DetailedMessage?d.DetailedMessage:d.Message?d.Message:g["Problem while performing the action"]}catch(f){c.Message=g["Problem while performing the action"]}a.getService("orion.page.message").setProgressResult(c)}function m(a){Array.isArray(a)||(a=[a]);return a}function k(b,c){var f=a.getService("orion.page.message"),h=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doRebase(b,"",c),"Rebasing git repository");
f.createProgressMonitor(h,c);h.then(function(b){if("OK"===b.Result||"ABORTED"===b.Result||"FAST_FORWARD"===b.Result||"UP_TO_DATE"===b.Result){var c=[];c.Severity="Ok";c.HTML=!1;c.Message=b.Result;a.getService("orion.page.message").setProgressResult(c);d.changedItem({})}"STOPPED"===b.Result?(c=[],c.Severity="Warning",c.HTML=!1,c.Message=b.Result+g[". Repository still contains conflicts."],a.getService("orion.page.message").setProgressResult(c),d.changedItem({})):"FAILED_UNMERGED_PATHS"===b.Result&&
(c=[],c.Severity="Error",c.HTML=!1,c.Message=b.Result+g[". Repository contains unmerged paths. Resolve conflicts first."],a.getService("orion.page.message").setProgressResult(c))},e)}var l=new h.Command({name:g.Stage,tooltip:g["Stage the change"],imageClass:"git-sprite-stage",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.stageCommand",callback:function(b){var c=m(b.items),f=a.getService("orion.page.message"),h=a.getService("orion.page.progress");if(1===c.length)b=h.progress(a.getService("orion.git.provider").stage(c[0].indexURI),
g["Staging changes"]),f.createProgressMonitor(b,g["Staging changes"]),b.then(function(a){d.changedItem(c)},e);else{for(var k=[],l=0;l<c.length;l++)k[l]=c[l].name;b=h.progress(a.getService("orion.git.provider").stageMultipleFiles(b.userData.Clone.IndexLocation,k),g["Staging changes"]);f.createProgressMonitor(b,"Staging changes");b.then(function(a){d.changedItem(c)},e)}},visibleWhen:function(a){a=m(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(!f.isChange(a[b])||f.isStaged(a[b]))return!1;
return!0}});c.addCommand(l);l=new h.Command({name:g.Unstage,tooltip:g["Unstage the change"],imageClass:"git-sprite-unstage",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.unstageCommand",callback:function(b){var c=m(b.items),f=a.getService("orion.page.message"),h=a.getService("orion.page.progress");if(1===c.length)b=h.progress(a.getService("orion.git.provider").unstage(c[0].indexURI,c[0].name),"Unstaging changes"),f.createProgressMonitor(b,g["Staging changes"]),b.then(function(a){d.changedItem(c)},
e);else{for(var k=[],l=0;l<c.length;l++)k[l]=c[l].name;b=h.progress(a.getService("orion.git.provider").unstage(b.userData.Clone.IndexLocation,k),"Unstaging changes");f.createProgressMonitor(b,g["Staging changes"]);b.then(function(a){d.changedItem(c)},e)}},visibleWhen:function(a){a=m(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(!f.isChange(a[b])||!f.isStaged(a[b]))return!1;return!0}});c.addCommand(l);l=new b.CommandEventListener("change",function(b,c){var d=b.target,e=c.items.status,f=
document.getElementById("nameparameterCollector");d.checked?(d=a.getService("orion.page.message"),e=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doGitLog(e.CommitLocation+"?page\x3d1\x26pageSize\x3d1"),g["Fetching previous commit message"]),d.createProgressMonitor(e,g["Fetching previous commit message"],e.then(function(a){f.value=a.Children[0].Message}),function(a){f.value=""})):f.value=""});l=new b.ParametersDescription([new b.CommandParameter("name","text",g["Commit message:"],
"",4),new b.CommandParameter("amend","boolean",g["Amend:"],!1,null,l),new b.CommandParameter("changeId","boolean",g["ChangeId:"],!1)],{hasOptionalParameters:!0});l=new h.Command({name:g.Commit,tooltip:g.Commit,id:"eclipse.orion.git.commitCommand",parameters:l,callback:function(b){var c=b.items.status,f=function(b){var f=a.getService("orion.page.message");b=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").commitAll(c.Clone.HeadLocation,null,JSON.stringify(b)),g["Committing changes"]);
f.createProgressMonitor(b,g["Committing changes"]);b.then(function(a){d.changedItem(c)},e)},h=function(a,c){for(var d=0;d<c.length;d++)"user.name"===c[d].Key?(a.CommitterName=c[d].Value,a.AuthorName=c[d].Value):"user.email"===c[d].Key&&(a.CommitterEmail=c[d].Value,a.AuthorEmail=c[d].Value);a.Message&&a.CommitterName&&a.CommitterEmail&&!b.parameters.optionsRequested?f(a):(new v.CommitDialog({body:a,func:f})).show()},m={};m.Message=b.parameters.valueFor("name");m.Amend=b.parameters.valueFor("amend");
m.ChangeId=b.parameters.valueFor("changeId");var k=c.Clone.Config;if(m.Amend&&!m.Message){var l=a.getService("orion.page.message"),n=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").doGitLog(c.CommitLocation+"?page\x3d1\x26pageSize\x3d1"),g["Committing changes"]);l.createProgressMonitor(n,g["Committing changes"]);n.then(function(a){m.Message=a.Children[0].Message;h(m,k)},function(a){h(m,k)})}else h(m,k)},visibleWhen:function(a){return!0}});c.addCommand(l);l=new h.Command({name:g.Reset,
tooltip:g["Reset the branch, discarding all staged and unstaged changes"],imageClass:"core-sprite-refresh",id:"eclipse.orion.git.resetCommand",callback:function(b){var c=b.items;a.getService("orion.page.dialog").confirm(g["All unstaged and staged changes in the working directory and index will be discarded and cannot be recovered."]+"\n"+g["Are you sure you want to continue?"],function(b){if(b){b=a.getService("orion.page.message");var f=a.getService("orion.page.progress").progress(a.getService("orion.git.provider").unstageAll(c.IndexLocation,
"HARD"),g["Resetting local changes"]);b.createProgressMonitor(f,g["Resetting local changes"]);f.then(function(a){d.changedItem(c)},e)}})},visibleWhen:function(a){return f.hasStagedChanges(a)||f.hasUnstagedChanges(a)}});c.addCommand(l);l=new h.Command({name:g.Checkout,tooltip:g["Checkout all the selected files, discarding all changes"],imageClass:"git-sprite-checkout",spriteClass:"gitCommandSprite",id:"eclipse.orion.git.checkoutCommand",callback:function(b){var c=m(b.items);a.getService("orion.page.dialog").confirm(g["Your changes to the selected files will be discarded and cannot be recovered."]+
"\n"+g["Are you sure you want to continue?"],function(f){if(f){f=a.getService("orion.page.message");for(var h=a.getService("orion.page.progress"),m=[],k=0;k<c.length;k++)m[k]=c[k].name;h=h.progress(a.getService("orion.git.provider").checkoutPath(b.userData.Clone.Location,m),g["Resetting local changes"]);f.createProgressMonitor(h,g["Resetting local changes"]);h.then(function(a){d.changedItem(c)},e)}})},visibleWhen:function(a){a=m(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(!f.isChange(a[b])||
f.isStaged(a[b]))return!1;return!0}});c.addCommand(l);l=new h.Command({name:g["Show Patch"],tooltip:g["Show workspace changes as a patch"],id:"eclipse.orion.git.showPatchCommand",hrefCallback:function(a){var b=m(a.items);a=a.userData.Clone.DiffLocation+"?parts\x3ddiff";for(var c=0;c<b.length;c++)a+="\x26Path\x3d",a+=b[c].name;return a},visibleWhen:function(a){a=m(a);if(0===a.length)return!1;for(var b=0;b<a.length;b++)if(f.isStaged(a[b]))return!1;return!0}});c.addCommand(l);l=new h.Command({name:g.Continue,
tooltip:g["Contibue Rebase"],id:"eclipse.orion.git.rebaseContinueCommand",callback:function(a){return k(a.items.Clone.HeadLocation,"CONTINUE")},visibleWhen:function(a){return-1!==a.RepositoryState.indexOf("REBASING")}});c.addCommand(l);l=new h.Command({name:g["Skip Patch"],tooltip:g["Skip Patch"],id:"eclipse.orion.git.rebaseSkipPatchCommand",callback:function(a){return k(a.items.Clone.HeadLocation,"SKIP")},visibleWhen:function(a){return-1!==a.RepositoryState.indexOf("REBASING")}});c.addCommand(l);
l=new h.Command({name:g.Abort,tooltip:g["Abort Rebase"],id:"eclipse.orion.git.rebaseAbortCommand",callback:function(a){return k(a.items.Clone.HeadLocation,"ABORT")},visibleWhen:function(a){return-1!==a.RepositoryState.indexOf("REBASING")}});c.addCommand(l)}})();return q});
define("orion/git/widgets/CommitTooltipDialog","i18n!git/nls/gitmessages require orion/URITemplate orion/webui/littlelib orion/i18nUtil orion/webui/popupdialog orion/git/util".split(" "),function(g,l,k,e,c,h,b){function f(b){this._init(b)}var d=new k("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1");f.prototype=new h.PopupDialog;f.prototype.TEMPLATE='\x3cdiv id\x3d"parentPane" style\x3d"padding:10px; width:520px"\x3e\x3c/div\x3e';f.prototype._init=function(b){this.commit=b.commit;
this._initialize(b.triggerNode,null,null,"mouseover",1E3)};f.prototype._bindToDom=function(b){this._displayCommit(this.commit)};f.prototype._displayCommit=function(e){var a=this.$parentPane,f=e.Message.split(/(\r?\n|$)/)[0],h=document.createElement("a");h.className="navlinkonpage";h.href=l.toUrl(d.expand({resource:e.Location}));h.textContent=b.trimCommitMessage(f);a.appendChild(h);f=document.createElement("div");f.style.paddingTop="15px";a.appendChild(f);e.AuthorImage&&(a=new Image,a.src=e.AuthorImage,
a.name=e.AuthorName,a.className="git-author-icon",f.appendChild(a));a=document.createElement("div");a.textContent=c.formatMessage(g[" authored by ${0} {${1}) on ${2}"],e.AuthorName,e.AuthorEmail,(new Date(e.Time)).toLocaleString());f.appendChild(a);a=document.createElement("div");a.textContent=c.formatMessage(g["committed by 0 (1)"],e.CommitterName,e.CommitterEmail);f.appendChild(a);a=document.createElement("div");a.style.paddingTop="15px";a.textContent=g["commit:"]+e.Name;f.appendChild(a);a=b.getGerritFooter(e.Message);
a.changeId&&(h=document.createElement("div"),h.style.paddingTop="15px",h.textContent=g["Change-Id: "]+a.changeId,f.appendChild(h));a.signedOffBy&&(h=document.createElement("div"),h.textContent=g["Signed-off-by: "]+a.signedOffBy,f.appendChild(h));if(e.Parents&&0<e.Parents.length){h=document.createElement("div");h.textContent=g["parent:"];if(a.signedOffBy||a.changeId)h.style.paddingTop="15px";a=document.createElement("a");a.className="navlinkonpage";a.href=l.toUrl(d.expand({resource:e.Parents[0].Location}));
a.textContent=e.Parents[0].Name;h.appendChild(a);f.appendChild(h)}h=e.Tags&&0<e.Tags.length;if(e.Branches&&0<e.Branches.length){a=document.createElement("section");a.style.paddingTop="15px";a.textContent=g["branches: "];f.appendChild(a);var k=document.createElement("div");a.appendChild(k);for(a=0;a<e.Branches.length;++a){var r=document.createElement("span");r.style.paddingLeft="10px";r.textContent=e.Branches[a].FullName;k.appendChild(r)}}if(h){a=document.createElement("div");a.style.paddingTop="15px";
f.appendChild(a);a=document.createElement("section");f.appendChild(a);f=document.createElement("span");f.textContent=g["tags: "];a.appendChild(f);f=document.createElement("div");a.appendChild(f);for(a=0;a<e.Tags.length;++a)h=document.createElement("span"),h.style.paddingLeft="10px",h.textContent=e.Tags[a].Name,f.appendChild(h)}};f.prototype.constructor=f;return{CommitTooltipDialog:f}});
define("orion/git/gitStatusExplorer","require i18n!git/nls/gitmessages orion/explorers/explorer orion/selection orion/section orion/URITemplate orion/PageUtil orion/webui/littlelib orion/i18nUtil orion/globalCommands orion/git/uiUtil orion/git/gitCommands orion/Deferred orion/git/widgets/CommitTooltipDialog orion/webui/tooltip orion/git/util".split(" "),function(g,l,k,e,c,h,b,f,d,m,a,n,p,t,r,s){p={};var w=new h("git/git-repository.html#{,resource,params*}"),v=new h("git/git-log.html#{,resource,params*}?page\x3d1"),
u=new h("git/git-commit.html#{,resource,params*}?page\x3d1\x26pageSize\x3d1"),y=function(){function a(){this.selectedItem=this.selectedFileId=void 0;this.interestedUnstagedGroup=["Missing","Modified","Untracked","Conflicting"];this.interestedStagedGroup=["Added","Changed","Removed"];this.conflictPatterns=[["Both","Modified","Added","Changed","Missing"],["RemoteDelete","Untracked","Removed"],["LocalDelete","Modified","Added","Missing"]];this.conflictType="Conflicting";this.statusTypeMap={Missing:{imageClass:"gitImageSprite git-sprite-removal",
tooltip:l["Unstaged removal"]},Removed:{imageClass:"gitImageSprite git-sprite-removal",tooltip:l["Staged removal"]},Modified:{imageClass:"gitImageSprite git-sprite-file",tooltip:l["Unstaged change"]},Changed:{imageClass:"gitImageSprite git-sprite-file",tooltip:l["Staged change"]},Untracked:{imageClass:"gitImageSprite git-sprite-addition",tooltip:l["Unstaged addition"]},Added:{imageClass:"gitImageSprite git-sprite-addition",tooltip:l["Staged addition"]},Conflicting:{imageClass:"gitImageSprite git-sprite-conflict-file",
tooltip:l.Conflicting}}}a.prototype={destroy:function(){},interestedCategory:function(){},init:function(a){this.items=a},getModelType:function(a,b){return b},_markConflict:function(a){var b=this.getGroupData(a[1]);if(b)for(var c=0;c<b.length;c++)if(!b[c].Conflicting){for(var d=b[c].Location,e=[],f=2;f<a.length;f++){var g=this.getGroupData(a[f]);g&&(g=this._findSameFile(d,g))&&e.push(g)}if(e.length===a.length-2){b[c].Conflicting=a[0];for(d=0;d<e.length;d++)e[d].Conflicting="Hide"}}},_findSameFile:function(a,
b){for(var c=0;c<b.length;c++)if(!b[c].Conflicting&&a===b[c].Location)return b[c]},getGroupData:function(a){return this.items[a]},isStaged:function(a){for(var b=0;b<this.interestedStagedGroup.length;b++)if(a===this.interestedStagedGroup[b])return!0;return!1},getClass:function(a){return this.statusTypeMap[a].imageClass},getTooltip:function(a){return this.statusTypeMap[a].tooltip}};return a}();p.GitStatusExplorer=function(){function h(a,b,c,d,e,f,g,m){this.parentId=e;this.registry=a;this.commandService=
b;this.linkService=c;this.selection=d;this.parentId=e;this.toolbarId=f;this.selectionToolsId=g;this.checkbox=!1;this.actionScopeId=m;k.createExplorerCommands(b)}h.prototype.handleError=function(a){var b={Severity:"Error",HTML:!1};try{var c=JSON.parse(a.responseText);b.Message=c.DetailedMessage?c.DetailedMessage:c.Message}catch(d){b.Message=a.DetailedMessage||a.Message||a.message}this.registry.getService("orion.page.message").setProgressResult(b);404===a.status&&(this.initTitleBar(),this.displayCommit())};
h.prototype.changedItem=function(a,b){this.redisplay()};h.prototype.redisplay=function(){var a=b.matchResourceParameters();this.display(a.resource)};h.prototype.display=function(a){var b=this,c=this.registry.getService("orion.page.progress");c.progress(this.registry.getService("orion.git.provider").getGitStatus(a),l["Loading..."]).then(function(a){"Status"===a.Type&&(b._model=new y,b._model.init(a),c.progress(b.registry.getService("orion.git.provider").getGitClone(a.CloneLocation),"Getting repository information").then(function(d){var e=
d.Children;c.progress(b.registry.getService("orion.git.provider").getGitCloneConfig(e[0].ConfigLocation),"Getting repository configuration ",e[0].Name).then(function(c){c=c.Children;a.Clone=e[0];a.Clone.Config=[];for(var d=0;d<c.length;d++)("user.name"===c[d].Key||"user.email"===c[d].Key)&&a.Clone.Config.push(c[d]);c=f.node("table");f.empty(c);b.initTitleBar(a,e[0]);b.displayUnstaged(a,e[0]);b.displayStaged(a,e[0]);b.displayCommits(e[0]);n.updateNavTools(b.registry,b.commandService,b,"pageActions",
"selectionTools",a)},function(a){b.handleError(a)})},function(a){b.handleError(a)}))},function(a){b.handleError(a)})};h.prototype.initTitleBar=function(a,b){var c={};c.Name=l.Status+(a.RepositoryState&&-1!==a.RepositoryState.indexOf("REBASING")?l[" (Rebase in Progress)"]:"");c.Parents=[];c.Parents[0]={};c.Parents[0].Name=b.Name;c.Parents[0].Location=b.Location;c.Parents[0].ChildrenLocation=b.Location;c.Parents[1]={};c.Parents[1].Name=l.Repo;m.setPageTarget({task:l.Status,target:b,breadcrumbTarget:c,
makeBreadcrumbLink:function(a,b){a.href=g.toUrl(w.expand({resource:b||""}))},serviceRegistry:this.registry,commandService:this.commandService})};h.prototype._sortBlock=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c],e=this._model.getGroupData(d);if(e)for(var f=0;f<e.length;f++){var g=this._model.getModelType(e[f],d);g&&b.push({name:e[f].Name,type:g,location:e[f].Location,path:e[f].Path,commitURI:e[f].Git.CommitLocation,indexURI:e[f].Git.IndexLocation,diffURI:e[f].Git.DiffLocation,CloneLocation:this._model.items.CloneLocation,
conflicting:"Conflicting"===g})}}b.sort(function(a,b){var c=a.name&&a.name.toLowerCase(),d=b.name&&b.name.toLowerCase();return c<d?-1:c>d?1:0});return b};h.prototype.displayUnstaged=function(b,d){var g=this,h=this._sortBlock(this._model.interestedUnstagedGroup),m=f.node("table"),n=new c.Section(m,{id:"unstagedSection",title:0<h.length?l.Unstaged:l["No Unstaged Changes"],content:'\x3cdiv id\x3d"unstagedNode"\x3e\x3c/div\x3e',canHide:!0,onExpandCollapse:function(a,b){g.commandService.destroy(b.selectionNode);
a&&g.commandService.renderCommands(b.selectionNode.id,b.selectionNode,null,g,"button",{Clone:d})}});this.commandService.registerCommandContribution(n.actionsNode.id,"orion.explorer.expandAll",200);this.commandService.registerCommandContribution(n.actionsNode.id,"orion.explorer.collapseAll",300);this.commandService.registerCommandContribution(n.selectionNode.id,"eclipse.orion.git.showPatchCommand",100);this.commandService.registerCommandContribution(n.selectionNode.id,"eclipse.orion.git.stageCommand",
200);this.commandService.registerCommandContribution(n.selectionNode.id,"eclipse.orion.git.checkoutCommand",300);this.unstagedOnce||(this.unstagedSelection||(this.unstagedSelection=new e.Selection(this.registry,"orion.unstagedSection.selection"),this.commandService.registerSelectionService(n.selectionNode.id,this.unstagedSelection)),this.registry.getService("orion.unstagedSection.selection").addEventListener("selectionChanged",function(a){var b=f.node(n.selectionNode.id);b&&(g.commandService.destroy(b),
g.commandService.renderCommands(n.selectionNode.id,b,a.selections,g,"button",{Clone:d}))}),this.unstagedOnce=!0);this.commandService.registerCommandContribution("DefaultActionWrapper","eclipse.orion.git.stageCommand",100);var p=function(){function b(){}b.prototype={destroy:function(){},getRoot:function(a){a(h)},getChildren:function(b,c){b instanceof Array&&0<b.length?c(b):a.isChange(b)?(b.children||(b.children=[],b.children.push({diffUri:b.diffURI,Type:"Diff",parent:b})),c(b.children)):c([])},getId:function(b){return b instanceof
Array&&0<b.length?"unstagedRoot":a.isChange(b)?"unstaged"+b.name:"unstaged"+b.diffUri}};return b}(),s=function(){function b(a,c){this._init(a);this.options=a;this.explorer=c;this.registry=a.registry}b.prototype=new k.SelectionRenderer;b.prototype.getCellElement=function(b,c,d){switch(b){case 0:if(a.isChange(c)){b=document.createElement("td");var e=document.createElement("div");e.className="sectionTableItem";b.appendChild(e);this.getExpandImage(d,e);d=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(c,
!0):null;var f=document.createElement("span");f.id="unstaged"+c.name+"DiffActionWrapper";f.className="sectionExplorerActions";e.appendChild(f);g.commandService.destroy(f);g.commandService.renderCommands("DefaultActionWrapper",f,c,g,"tool",null,d);d=document.createElement("span");d.className=g._model.getClass(c.type);d.commandTooltip=new r.Tooltip({node:d,text:g._model.getTooltip(c.type),position:["above","below","right","left"]});e.appendChild(d);d=document.createElement("span");d.textContent=c.name;
e.appendChild(d)}else{b=document.createElement("td");b.colSpan=2;e=document.createElement("div");e.className="sectionTableItem";b.appendChild(e);f=document.createElement("div");f.className="sectionExplorerActions";f.id="unstaged"+c.parent.name+"CompareWidgetActionWrapper";e.appendChild(f);var h=document.createElement("div");h.id="diffArea_"+c.diffUri;h.style.height="420px";h.style.border="1px solid lightgray";h.style.overflow="hidden";e.appendChild(h);d=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(c,
!0):null;a.createCompareWidget(g.registry,g.commandService,c.diffUri,"Conflicting"===c.parent.type,h,f.id,!0,{navGridHolder:d})}return b}};return b}(),m=new (function(){function b(a,c,d,e){this.registry=a;this.checkbox=!1;this.parentId=d;this.selection=c;this.actionScopeId=e;this.renderer=new s({registry:this.registry,cachePrefix:"UnstagedNavigator",checkbox:!1},this);this.createTree(this.parentId,new p,{setFocus:!0})}b.prototype=new k.Explorer;b.prototype.isRowSelectable=function(b){return a.isChange(b)};
b.prototype.getItemCount=function(){return h.length};return b}())(this.registry,this.unstagedSelection,"unstagedNode");this.commandService.renderCommands(n.actionsNode.id,n.actionsNode.id,m,m,"button")};h.prototype.displayStaged=function(b,d){var g=this,h=this._sortBlock(this._model.interestedStagedGroup),m=f.node("table"),n=new c.Section(m,{id:"stagedSection",title:0<h.length?l.Staged:l["No Staged Changes"],content:'\x3cdiv id\x3d"stagedNode"\x3e\x3c/div\x3e',slideout:!0,canHide:!0,onExpandCollapse:function(a,
b){g.commandService.destroy(b.selectionNode);a&&g.commandService.renderCommands(b.selectionNode.id,b.selectionNode,null,g,"button",{Clone:d})}});this.commandService.registerCommandContribution(n.actionsNode.id,"eclipse.orion.git.commitCommand",100);this.commandService.registerCommandContribution(n.actionsNode.id,"orion.explorer.expandAll",200);this.commandService.registerCommandContribution(n.actionsNode.id,"orion.explorer.collapseAll",300);this.commandService.registerCommandContribution(n.selectionNode.id,
"eclipse.orion.git.unstageCommand",100);this.stagedOnce||(this.stagedSelection||(this.stagedSelection=new e.Selection(this.registry,"orion.stagedSection.selection"),this.commandService.registerSelectionService(n.selectionNode.id,this.stagedSelection)),this.registry.getService("orion.stagedSection.selection").addEventListener("selectionChanged",function(a){var b=f.node(n.selectionNode.id);b&&(g.commandService.destroy(b),g.commandService.renderCommands(n.selectionNode.id,b,a.selections,g,"button",{Clone:d}))}),
this.stagedOnce=!0);this.commandService.registerCommandContribution("DefaultActionWrapper","eclipse.orion.git.unstageCommand",100);var p=function(){function b(){}b.prototype={destroy:function(){},getRoot:function(a){a(h)},getChildren:function(b,c){b instanceof Array&&0<b.length?c(b):a.isChange(b)?(b.children||(b.children=[],b.children.push({diffUri:b.diffURI,Type:"Diff",parent:b})),c(b.children)):c([])},getId:function(b){return b instanceof Array&&0<b.length?"stagedRoot":a.isChange(b)?"staged"+b.name:
"staged"+b.diffUri}};return b}(),s=function(){function b(a,c){this._init(a);this.options=a;this.explorer=c;this.registry=a.registry}b.prototype=new k.SelectionRenderer;b.prototype.getCellElement=function(b,c,d){switch(b){case 0:if(a.isChange(c)){b=document.createElement("td");var e=document.createElement("div");e.className="sectionTableItem";b.appendChild(e);this.getExpandImage(d,e);d=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(c,!0):null;var f=document.createElement("span");
f.id="staged"+c.name+"DiffActionWrapper";f.className="sectionExplorerActions";e.appendChild(f);g.commandService.destroy(f);g.commandService.renderCommands("DefaultActionWrapper",f,c,g,"tool",null,d);d=document.createElement("span");d.className=g._model.getClass(c.type);d.commandTooltip=new r.Tooltip({node:d,text:g._model.getTooltip(c.type),position:["above","below","right","left"]});e.appendChild(d);d=document.createElement("span");d.textContent=c.name;e.appendChild(d)}else{b=document.createElement("td");
b.colSpan=2;e=document.createElement("div");e.className="sectionTableItem";b.appendChild(e);f=document.createElement("div");f.className="sectionExplorerActions";f.id="staged"+c.parent.name+"CompareWidgetActionWrapper";e.appendChild(f);var h=document.createElement("div");h.id="diffArea_"+c.diffUri;h.style.height="420px";h.style.border="1px solid lightgray";h.style.overflow="hidden";e.appendChild(h);d=this.explorer.getNavDict()?this.explorer.getNavDict().getGridNavHolder(c,!0):null;a.createCompareWidget(g.registry,
g.commandService,c.diffUri,"Conflicting"===c.parent.type,h,f.id,!1,{navGridHolder:d})}return b}};return b}(),m=new (function(){function c(a,d,e,f){this.registry=a;this.checkbox=!1;this.parentId=e;this.status=b;this.selection=d;this.actionScopeId=f;this.renderer=new s({registry:this.registry,cachePrefix:"StagedNavigator",checkbox:!1},this);this.createTree(this.parentId,new p)}c.prototype=new k.Explorer;c.prototype.isRowSelectable=function(b){return a.isChange(b)};c.prototype.getItemCount=function(){return h.length};
return c}())(this.registry,this.stagedSelection,"stagedNode");this.commandService.renderCommands(n.actionsNode.id,n.actionsNode.id,m,m,"button")};h.prototype.displayCommits=function(a){var b=this,e=f.node("table"),g=new c.Section(e,{id:"commitSection",title:l.Commits,content:'\x3cdiv id\x3d"commitNode" class\x3d"mainPadding"\x3e\x3c/div\x3e',slideout:!0,canHide:!0,preferenceService:this.registry.getService("orion.core.preference")}),h=g.createProgressMonitor();h.begin(l["Getting current branch"]);
this.registry.getService("orion.page.progress").progress(this.registry.getService("orion.git.provider").getGitBranch(a.BranchLocation),"Getting current branch "+a.Name).then(function(a){a=a.Children;for(var c,e=0;e<a.length;e++)if(a[e].Current){c=a[e];break}c?(a=1===c.RemoteLocation.length&&1===c.RemoteLocation[0].Children.length,g.setTitle(d.formatMessage(l['Commits for "${0}" branch'],c.Name)),b.commandService.destroy(g.actionsNode.id),b.commandService.registerCommandContribution(g.actionsNode.id,
"eclipse.orion.git.repositories.viewAllCommand",10),b.commandService.renderCommands(g.actionsNode.id,g.actionsNode.id,{ViewAllLink:v.expand({resource:c.CommitLocation}),ViewAllLabel:l["See Full Log"],ViewAllTooltip:l["See the full log"]},b,"button"),a&&(b.commandService.registerCommandContribution(g.actionsNode.id,"eclipse.orion.git.fetch",100),b.commandService.registerCommandContribution(g.actionsNode.id,"eclipse.orion.git.merge",100),b.commandService.registerCommandContribution(g.actionsNode.id,
"eclipse.orion.git.rebase",100),b.commandService.registerCommandContribution(g.actionsNode.id,"eclipse.orion.git.resetIndex",100),b.commandService.renderCommands(g.actionsNode.id,g.actionsNode.id,c.RemoteLocation[0].Children[0],b,"button")),b.commandService.addCommandGroup(g.actionsNode.id,"eclipse.gitPushGroup",1E3,"Push",null,null,null,"Push",null,"eclipse.orion.git.push"),b.commandService.registerCommandContribution(g.actionsNode.id,"eclipse.orion.git.push",1100,"eclipse.gitPushGroup"),b.commandService.registerCommandContribution(g.actionsNode.id,
"eclipse.orion.git.pushBranch",1200,"eclipse.gitPushGroup"),b.commandService.registerCommandContribution(g.actionsNode.id,"eclipse.orion.git.pushToGerrit",1200,"eclipse.gitPushGroup"),b.commandService.renderCommands(g.actionsNode.id,g.actionsNode.id,c,b,"button"),null===c.RemoteLocation[0]?(h.done(),b.renderNoCommit()):(h.worked(d.formatMessage(l['Getting commits for "${0}" branch'],c.Name)),a&&c.RemoteLocation[0].Children[0].CommitLocation?b.registry.getService("orion.page.progress").progress(b.registry.getService("orion.git.provider").getLog(c.RemoteLocation[0].Children[0].CommitLocation+
"?page\x3d1\x26pageSize\x3d20","HEAD"),d.formatMessage(l['Getting commits for "${0}" branch'],c.Name)).then(function(a){h.worked(l["Rendering commits"]);for(var d=a.Children.length,e=0;e<a.Children.length;e++)b.renderCommit(a.Children[e],!0,e);h.worked(l["Getting outgoing commits"]);b.registry.getService("orion.page.progress").progress(b.registry.getService("orion.git.provider").getLog(c.CommitLocation+"?page\x3d1\x26pageSize\x3d20",c.RemoteLocation[0].Children[0].Id),l["Getting outgoing commits"]).then(function(a){h.worked(l["Rendering commits"]);
for(var c=0;c<a.Children.length;c++)b.renderCommit(a.Children[c],!1,c+d);d+=a.Children.length;0===d&&b.renderNoCommit();h.done()},function(a){h.done(a)})},function(a){h.done(a)}):b.registry.getService("orion.page.progress").progress(b.registry.getService("orion.git.provider").doGitLog(c.CommitLocation+"?page\x3d1\x26pageSize\x3d20"),d.formatMessage(l['Getting commits for "${0}" branch'],c.Name)).then(function(a){h.worked(l["Rendering commits"]);for(var c=0;c<a.Children.length;c++)b.renderCommit(a.Children[c],
!0,c);0===a.Children.length&&b.renderNoCommit();h.done()},function(a){h.done(a)}))):h.done()},b.handleError.bind(b))};h.prototype.renderNoCommit=function(){var a=f.node("commitNode");a.innerHTML="";var b=document.createElement("div");b.className="sectionTableItem";a.appendChild(b);a=document.createElement("div");b.appendChild(a);b=document.createElement("div");b.appendChild(document.createTextNode(l["The branch is up to date."]));a.appendChild(b);b=document.createElement("div");b.appendChild(document.createTextNode(l["You have no outgoing or incoming commits."]));
a.appendChild(b)};h.prototype.renderCommit=function(a,b,c){c=f.node("commitNode");var d=document.createElement("div");d.className="sectionTableItem lightTreeTableRow";c.appendChild(d);c=document.createElement("div");c.className="sectionTableItem";c.style.overflow="hidden";d.appendChild(c);b=b?"git-sprite-outgoing-commit":"git-sprite-incoming-commit";d=document.createElement("span");d.className="sectionIcon gitImageSprite "+b;c.appendChild(d);a.AuthorImage&&(b=document.createElement("div"),b.style["float"]=
"left",d=new Image,d.src=a.AuthorImage,d.name=a.AuthorName,d.className="git-author-icon",b.appendChild(d),c.appendChild(b));b=document.createElement("div");b.className="stretch";c.appendChild(b);c=document.createElement("a");c.className="navlinkonpage";c.href=g.toUrl(u.expand({resource:a.Location}));c.textContent=s.trimCommitMessage(a.Message);b.appendChild(c);new t.CommitTooltipDialog({commit:a,triggerNode:c});c=document.createElement("div");c.textContent=" (SHA "+a.Name+") by "+a.AuthorName+" on "+
(new Date(a.Time)).toLocaleString();b.appendChild(c)};return h}();return p});
define("orion/operation",["orion/xhr","orion/Deferred"],function(g,l){function k(c,e,b,f){g("GET",c,{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(d){d=d.response?JSON.parse(d.response):null;e.progress(d);!d.type||"loadstart"===d.type||"progress"===d.type?setTimeout(function(){k(c,e,b,f)},2E3):("error"===d.type||"abort"===d.type?e.reject(f?f(d):d.Result):e.resolve(b?b(d):d.Result.JsonData),d.Location||g("DELETE",c,{headers:{"Orion-Version":"1"},timeout:15E3}))},function(b){var c=b;if(void 0!==
b.responseText){c=b.responseText;try{c=JSON.parse(b.responseText)}catch(a){}}void 0!==c.Message?(c.HttpCode=void 0===c.HttpCode?b.status:c.HttpCode,c.Severity=void 0===c.Severity?"Error":c.Severity,e.reject(c)):e.reject({Severity:"Error",Message:c,HttpCode:b.status})})}function e(c,e){e.then(null,function(b){b instanceof Error&&"Cancel"===b.name&&g("PUT",c,{headers:{"Orion-Version":"1"},data:JSON.stringify({abort:!0}),timeout:15E3})})}return{handle:function(c,g,b){var f=new l;e(c,f);k(c,f,g,b);return f}}});
define("orion/git/gitClient",["require","orion/xhr","orion/Deferred","orion/operation"],function(g,l,k,e){var c=c||{};c.GitService=function(){function c(b){b&&(this._serviceRegistry=b,this._serviceRegistration=b.registerService("orion.git.provider",this))}c.prototype={checkGitService:function(){},cloneGitRepository:function(b,c,d,e,a,h,p,t,r,s,w){var v=this,u={};b&&(u.Name=b);d&&(u.Path=d);c&&(u.GitUrl=c);u.Location=e;a&&(u.GitSshUsername=a);h&&(u.GitSshPassword=h);p&&(u.GitSshKnownHost=p);t&&(u.GitSshPrivateKey=
t);r&&(u.GitSshPassphrase=r);s&&(s.GitMail&&(u.GitMail=s.GitMail),s.GitName&&(u.GitName=s.GitName));w&&(u.initProject=w);b=g.toUrl("gitapi/clone/._");b=b.substring(0,b.length-2);var y=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(u)}).then(function(a){v._getGitServiceResponse(y,a)},function(a){v._handleGitServiceResponseError(y,a)});return y},removeGitRepository:function(b){var c=this,d=new k;l("DELETE",
b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},getGitStatus:function(b){var c=this,d=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},
stage:function(b){var c=this,d=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},stageMultipleFiles:function(b,c){var d=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:c})}).then(function(a){d._getGitServiceResponse(e,
a)},function(a){d._handleGitServiceResponseError(e,a)});return e},unstageAll:function(b,c){var d=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Reset:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},unstage:function(b,c){var d=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Path:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},checkoutPath:function(b,c){var d=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Path:c,RemoveUntracked:"true"})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},
commitAll:function(b,c,d){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:d}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},getGitClone:function(b){var c=this,d=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},
function(b){c._handleGitServiceResponseError(d,b)});return d},getGitCloneConfig:function(b){var c=this,d=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},getGitBranch:function(b){var c=this,d=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,
b)},function(b){c._handleGitServiceResponseError(d,b)});return d},getGitRemote:function(b){var c=this,d=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},checkoutBranch:function(b,c){var d=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",
data:JSON.stringify({Branch:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},resetIndex:function(b,c){var d=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Commit:c,Reset:"HARD"})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},addBranch:function(b,c,d){var e=this,
a={};c&&(a.Name=c);d&&(a.Branch=d);var g=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify(a)}).then(function(a){e._getGitServiceResponse(g,a)},function(a){e._handleGitServiceResponseError(g,a)});return g},removeBranch:function(b){var c=this,d=new k;l("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,
b)},function(b){c._handleGitServiceResponseError(d,b)});return d},addRemote:function(b,c,d){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Remote:c,RemoteURI:d})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},removeRemote:function(b){var c=this,d=new k;l("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},doGitLog:function(b){var c=this,d=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},getDiff:function(b,c){var d=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({New:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},doFetch:function(b,c,d,e,a,g,h){var t=this,r=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Fetch:"true",Force:c,GitSshUsername:d,GitSshPassword:e,GitSshKnownHost:a,GitSshPrivateKey:g,GitSshPassphrase:h})}).then(function(a){t._getGitServiceResponse(r,
a)},function(a){t._handleGitServiceResponseError(r,a)});return r},doPull:function(b,c,d,e,a,g,h){var t=this,r=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Pull:"true",Force:c,GitSshUsername:d,GitSshPassword:e,GitSshKnownHost:a,GitSshPrivateKey:g,GitSshPassphrase:h})}).then(function(a){t._getGitServiceResponse(r,a)},function(a){t._handleGitServiceResponseError(r,a)});return r},doMerge:function(b,
c,d){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Merge:c,Squash:d})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},doCherryPick:function(b,c){var d=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({"Cherry-Pick":c})}).then(function(a){d._getGitServiceResponse(e,
a)},function(a){d._handleGitServiceResponseError(e,a)});return e},doRevert:function(b,c){var d=this,e=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Revert:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},doRebase:function(b,c,d){var e=this,a={};a.Rebase=c;d&&(a.Operation=d);var g=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify(a)}).then(function(a){e._getGitServiceResponse(g,a)},function(a){e._handleGitServiceResponseError(g,a)});return g},doPush:function(b,c,d,e,a,g,h,t,r){var s=this,w=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({PushSrcRef:c,PushTags:d,Force:e,GitSshUsername:a,GitSshPassword:g,GitSshKnownHost:h,GitSshPrivateKey:t,GitSshPassphrase:r})}).then(function(a){s._getGitServiceResponse(w,
a)},function(a){s._handleGitServiceResponseError(w,a)});return w},getLog:function(b,c){var d=this,e=new k,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({New:c})}).then(function(b){a.resolve(b.xhr.getResponseHeader("Location"))},function(a){d._handleGitServiceResponseError(e,a)});a.then(function(a){l("GET",a,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,
handleAs:"json"}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)})});return e},getDefaultRemoteBranch:function(b){var c=this,d=new k,e=new k;l("GET",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(a){c._getGitServiceResponse(e,a)},function(a){c._handleGitServiceResponseError(d,a)});e.then(function(a){l("GET",a.Children[0].Location,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json"}).then(function(a){c._getGitServiceResponse(d,a)},function(a){c._handleGitServiceResponseError(d,a)})});return d},doAddTag:function(b,c){var d=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Name:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},doRemoveTag:function(b){var c=this,d=new k;l("DELETE",
b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},checkoutTag:function(b,c,d){var e=this,a=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Tag:c,Branch:d})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,
b)});return a},addCloneConfigurationProperty:function(b,c,d){var e=this,a=new k;l("POST",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({Key:c,Value:d})}).then(function(b){e._getGitServiceResponse(a,b)},function(b){e._handleGitServiceResponseError(a,b)});return a},editCloneConfigurationProperty:function(b,c){var d=this,e=new k;l("PUT",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},
timeout:15E3,handleAs:"json",data:JSON.stringify({Value:c})}).then(function(a){d._getGitServiceResponse(e,a)},function(a){d._handleGitServiceResponseError(e,a)});return e},deleteCloneConfigurationProperty:function(b){var c=this,d=new k;l("DELETE",b,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json"}).then(function(b){c._getGitServiceResponse(d,b)},function(b){c._handleGitServiceResponseError(d,b)});return d},sendCommitReviewRequest:function(b,
c,d,e,a,g){var h=this,t=new k;l("POST",c,{headers:{"Orion-Version":"1","Content-Type":"application/json; charset\x3dUTF-8"},timeout:15E3,handleAs:"json",data:JSON.stringify({ReviewReqCommit:b,ReviewReqUrl:e,ReviewReqNotifyLogin:d,ReviewReqAuthorName:a,ReviewMessage:g})}).then(function(a){h._getGitServiceResponse(t,a)},function(a){h._handleGitServiceResponseError(t,a)});return t},_getGitServiceResponse:function(b,c){var d=c.response?JSON.parse(c.response):null;if(c.xhr&&202===c.xhr.status){var g=e.handle(d.Location);
g.then(b.resolve,function(a){a.failedOperation=d.Location;b.reject(a)},b.progress);b.then(null,function(a){g.reject(a)})}else b.resolve(d)},_handleGitServiceResponseError:function(b,c){b.reject(c)}};return c}();return c});
define("orion/ssh/sshTools",["orion/Deferred","orion/xhr"],function(g,l){var k=k||{};k.SshService=function(){function e(c){if(c&&(this._serviceRegistry=c,this._authService=c.getService("orion.core.auth"),this._serviceRegistration=c.registerService("orion.net.ssh",this),!this._authService)){var e;this._authService={getUser:function(){if(e){var b=new g;b.resolve(e);return b}return l("POST","../../login",{headers:{"Orion-Version":"1"},timeout:15E3}).then(function(b){return e=b.response?JSON.parse(b.response):
null},function(b){e=null;return b instanceof Error&&"Cancel"===b.name?"_cancel":b.response?JSON.parse(b.response):null})}}}}e.prototype={KNOWN_HOSTS:"knownHosts",addKnownHost:function(c){c=c||{};var e=new g,b=this,f=c.host,d=c.keyType,k=c.hostKey,a=c.port||22;if(!f||!d||!k||!a)return e.reject(),e;this._authService.getUser().then(function(c){for(var g=localStorage.getItem(c.login+"/"+b.KNOWN_HOSTS),g=g?JSON.parse(g):[],l=0;l<g.length;++l){var r=g[l];if(r.host===f&&r.port===a){e.resolve(r.host+" "+
r.keyType+" "+r.hostKey);return}}r={host:f,port:a,keyType:d,hostKey:k};g.push(r);localStorage.setItem(c.login+"/"+b.KNOWN_HOSTS,JSON.stringify(g));e.resolve(r.host+" "+r.keyType+" "+r.hostKey)},function(a){e.reject(a)});return e},clearKnownHosts:function(){var c=new g,e=this;this._authService.getUser().then(function(b){var f=localStorage.getItem(b.login+"/"+e.KNOWN_HOSTS),f=f?JSON.parse(f):[];localStorage.removeItem(b.login+"/"+e.KNOWN_HOSTS);c.resolve(f)},function(b){c.reject(b)});return c},getKnownHostCredentials:function(c,
e){var b=new g,f=this;e=e||22;if(!c||!e)return b.reject(),b;this._authService.getUser().then(function(d){d=(d=localStorage.getItem(d.login+"/"+f.KNOWN_HOSTS))?JSON.parse(d):[];for(var g=0;g<d.length;++g){var a=d[g];if(a.host===c&&a.port===e){b.resolve(a.host+" "+a.keyType+" "+a.hostKey);return}}b.resolve("")},function(c){b.reject(c)});return b}};return e}();return k});
define("orion/links",[],function(){function g(g){this._init(g)}g.prototype={_init:function(g){this._registry=g.serviceRegistry;this._serviceRegistration=this._registry.registerService("orion.core.textlink",this)},_replaceLink:function(g,k,e,c,h){var b=g.search(e);0<b&&(k.appendChild(document.createTextNode(g.substring(0,b))),g=g.substring(b));e=g.replace(e,"");var b=g.substring(0,g.length-e.length),f=b.split(" ",c);if(f.length===c){g=document.createElement("a");for(var d=0;d<c;d++)h=h.replace("%"+
(d+1),f[d]);g.setAttribute("href",h);g.textContent=b;k.appendChild(g);g=e}return g},addLinks:function(g,k){var e=k||document.createElement("div"),c=this._registry.getServiceReferences("orion.core.linkScanner");if(0<c.length)for(var h=c[0],c=RegExp(h.getProperty("pattern"),"i"),b=h.getProperty("words"),h=h.getProperty("anchor"),f=g.search(c);0<=f;)g=this._replaceLink(g,e,c,b,h),f=g.search(c);0<g.length&&e.appendChild(document.createTextNode(g));return e}};g.prototype.constructor=g;return{TextLinkService:g}});
var eclipse;
define("built-git-status.js","i18n!git/nls/gitmessages require orion/browserCompatibility orion/bootstrap orion/status orion/progress orion/commandRegistry orion/commands orion/dialogs orion/selection orion/fileClient orion/operationsClient orion/searchClient orion/globalCommands orion/widgets/themes/ThemePreferences orion/widgets/themes/editor/ThemeData orion/git/gitStatusExplorer orion/git/gitCommands orion/git/gitClient orion/ssh/sshTools orion/links orion/contentTypes orion/PageUtil".split(" "),function(g,
l,k,e,c,h,b,f,d,m,a,n,p,t,r,s,w,v,u,y,x,z,q){e.startup().then(function(e){var k=e.serviceRegistry;e=e.preferences;new d.DialogService(k);var C=new m.Selection(k);new y.SshService(k);var C=new b.CommandRegistry({selection:C}),I=new n.OperationsClient(k);new c.StatusReportingService(k,I,"statusPane","notifications","notificationArea");new h.ProgressService(k,I,C);(new r.ThemePreferences(e,new s.ThemeData)).apply();I=new x.TextLinkService({serviceRegistry:k});new u.GitService(k);var N=new a.FileClient(k);
new z.ContentTypeRegistry(k);var H=new p.Searcher({serviceRegistry:k,commandService:C,fileService:N}),E=new w.GitStatusExplorer(k,C,I,null,"artifacts","pageActions",null,"itemLevelCommands");t.setPageCommandExclusions(["eclipse.git.status2","eclipse.git.status"]);t.generateBanner("orion-git-status",k,C,e,H,E);v.createFileCommands(k,C,E,"pageActions","selectionTools");v.createGitClonesCommands(k,C,E,"pageActions","selectionTools",N);v.createGitStatusCommands(k,C,E);C.addCommandGroup("pageActions",
"eclipse.gitGroup",100);C.registerCommandContribution("pageActions","eclipse.orion.git.resetCommand",100,"eclipse.gitGroup");C.registerCommandContribution("pageActions","eclipse.orion.git.rebaseContinueCommand",200,"eclipse.gitGroup");C.registerCommandContribution("pageActions","eclipse.orion.git.rebaseSkipPatchCommand",300,"eclipse.gitGroup");C.registerCommandContribution("pageActions","eclipse.orion.git.rebaseAbortCommand",400,"eclipse.gitGroup");k=new f.Command({name:g["View All"],id:"eclipse.orion.git.repositories.viewAllCommand",
hrefCallback:function(a){return l.toUrl(a.items.ViewAllLink)},visibleWhen:function(a){this.name=a.ViewAllLabel;this.tooltip=a.ViewAllTooltip;return a.ViewAllLabel&&a.ViewAllTooltip&&a.ViewAllLink}});C.addCommand(k);k=q.matchResourceParameters();E.display(k.resource);window.addEventListener("hashchange",function(){var a=q.matchResourceParameters();E.display(a.resource)},!1)})});
//@ sourceMappingURL=built-git-status.js.map