diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index 8805de2..4e9815d 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -4,6 +4,7 @@ use Illuminate\Support\Str; use App\Models\Master\Menu; use App\Models\Master\AccessMenu; use App\Models\User; +use App\Models\GWP; if (!function_exists('taskLabel')) { /** @@ -327,4 +328,77 @@ if (!function_exists('include_files_in_folder')) { echo $e->getMessage(); } } -} \ No newline at end of file +} + +//NEWW + +if (!function_exists('getMatriks')) { + function getMatriks($ghgCode,$arCode) + { + $gwp = GWP::whereHas('ghg',function($queryGHG) use ($ghgCode){ + $queryGHG->where('kode',$ghgCode); + })->whereHas('ar',function($queryAR) use ($arCode){ + $queryAR->where('kode',$arCode); + })->first(); + + return @$gwp->value; + } +} + +if (!function_exists('getFormattedValue')) { + function getFormattedValue($value, $decNum = 8, $hasTrail = false) + { + if ($value !== null && $value !== '' && is_numeric($value)) { + // Convert to float and format with maximum decimal places + $value = number_format((float) $value, $decNum, ',', '.'); + + // Remove trailing zeros and the decimal separator if there are no decimals left + if ($hasTrail == false) { + $value = rtrim(rtrim($value, '0'), ','); + } + } + + return $value; + } +} + +if (!function_exists('getOriginalValue')) { + function getOriginalValue($value) + { + if ($value) { + $value = str_replace('.', '', $value); // Remove periods + $value = str_replace(',', '.', $value); // Replace commas with periods + + if (is_numeric($value)) { + return (float) $value; + } + } + + return $value; + } +} + + +if (!function_exists('formatActivityCode')) { + function formatActivityCode($code) + { + if (strpos($code, '_') === false && strlen($code) <= 3) { + return strtoupper($code); + } else { + $words = explode('_', $code); + $formattedWords = array_map('ucwords', $words); + return implode(' ', $formattedWords); + } + } +} + +if (!function_exists('activityYearRange')) { + function activityYearRange(int $inventoryYear, $isDesc = true, int $range = 15): array + { + if ($isDesc == true) { + return range($inventoryYear - 1, $inventoryYear - $range); + } else { + return range($inventoryYear - $range, $inventoryYear - 1); + } + } +} diff --git a/app/Http/Controllers/Dashboard/DashboardAdaptasiController.php b/app/Http/Controllers/Dashboard/DashboardAdaptasiController.php index 08fa1a3..9955a76 100644 --- a/app/Http/Controllers/Dashboard/DashboardAdaptasiController.php +++ b/app/Http/Controllers/Dashboard/DashboardAdaptasiController.php @@ -7,12 +7,17 @@ use Illuminate\Http\Request; class DashboardAdaptasiController extends Controller { + protected $title = 'Dashboard Adaptasi'; + protected $template = 'modules.dashboard.adaptasi'; + protected $route = 'modules.dashboard.adaptasi'; + /** * Display a listing of the resource. */ public function index() { - // + $data['title'] = $this->title; + return view($this->template.'.index',$data); } /** diff --git a/app/Http/Controllers/Dashboard/DashboardInventoryController.php b/app/Http/Controllers/Dashboard/DashboardInventoryController.php index 51d24b8..9a1e49e 100644 --- a/app/Http/Controllers/Dashboard/DashboardInventoryController.php +++ b/app/Http/Controllers/Dashboard/DashboardInventoryController.php @@ -7,12 +7,17 @@ use Illuminate\Http\Request; class DashboardInventoryController extends Controller { + protected $title = 'Dashboard Inventory'; + protected $template = 'modules.dashboard.inventory'; + protected $route = 'modules.dashboard.inventory'; + /** * Display a listing of the resource. */ public function index() { - // + $data['title'] = $this->title; + return view($this->template.'.index',$data); } /** diff --git a/app/Http/Controllers/Dashboard/DashboardMitigasiController.php b/app/Http/Controllers/Dashboard/DashboardMitigasiController.php index daf0418..0b2707e 100644 --- a/app/Http/Controllers/Dashboard/DashboardMitigasiController.php +++ b/app/Http/Controllers/Dashboard/DashboardMitigasiController.php @@ -7,12 +7,17 @@ use Illuminate\Http\Request; class DashboardMitigasiController extends Controller { + protected $title = 'Dashboard Mitigasi'; + protected $template = 'modules.dashboard.mitigasi'; + protected $route = 'modules.dashboard.mitigasi'; + /** * Display a listing of the resource. */ public function index() { - // + $data['title'] = $this->title; + return view($this->template.'.index',$data); } /** diff --git a/app/Http/Controllers/Energi/PengunaanListrikController.php b/app/Http/Controllers/Energi/PenggunaanListrikController.php similarity index 95% rename from app/Http/Controllers/Energi/PengunaanListrikController.php rename to app/Http/Controllers/Energi/PenggunaanListrikController.php index d950dde..293c780 100644 --- a/app/Http/Controllers/Energi/PengunaanListrikController.php +++ b/app/Http/Controllers/Energi/PenggunaanListrikController.php @@ -5,7 +5,7 @@ namespace App\Http\Controllers\Energi; use App\Http\Controllers\Controller; use Illuminate\Http\Request; -class PengunaanListrikController extends Controller +class PenggunaanListrikController extends Controller { /** * Display a listing of the resource. diff --git a/app/Http/Controllers/Pengaturan/ARController.php b/app/Http/Controllers/Pengaturan/ARController.php index a08c83b..79b572f 100644 --- a/app/Http/Controllers/Pengaturan/ARController.php +++ b/app/Http/Controllers/Pengaturan/ARController.php @@ -4,15 +4,73 @@ namespace App\Http\Controllers\Pengaturan; use App\Http\Controllers\Controller; use Illuminate\Http\Request; +use App\Models\AR; class ARController extends Controller { + protected $title = 'AR'; + protected $template = 'modules.pengaturan.ar'; + protected $route = 'modules.pengaturan.ar'; + /** * Display a listing of the resource. */ public function index() { - // + permission('is_read', $this->route, 'module',true); + + $data['breadcrumbs'] = [ + ['name' => 'Dashboard'], + ['name' => 'Pengaturan'], + ['name' => 'AR','active' => true], + ]; + $data['title'] = $this->title; + $data['route'] = $this->route; + return view($this->template.'.index',$data); + } + + public function grid(Request $request) + { + + $data = AR::orderBy('nomor_baris','ASC')->get(); + $_data = []; + + + foreach ($data as $key => $row) { + + + $action = ''; + $status = ''; + if($row->status == 0){ + $status = ' Tidak Aktif '; + }else{ + $status = ' Aktif '; + } + $action .= '
").replace(/\r?\n/g,"
").replace(/\t/g," ").replace(/^\s/," ").replace(/\s$/," ").replace(/\s\s/g," ")).includes("
")||r.includes("
"))&&(r=`
${r}
`),t=r),i=this.editor.data.htmlProcessor.toView(t)}var r;const s=new p(this,"inputTransformation");this.fire(s,{content:i,dataTransfer:o,targetRanges:e.targetRanges,method:e.method}),s.stop.called&&t.stop(),n.scrollToTheSelection()}),{priority:"low"}),this.listenTo(this,"inputTransformation",((t,n)=>{if(n.content.isEmpty)return;const o=this.editor.data.toModel(n.content,"$clipboardHolder");0!=o.childCount&&(t.stop(),e.change((()=>{this.fire("contentInsertion",{content:o,method:n.method,dataTransfer:n.dataTransfer,targetRanges:n.targetRanges})})))}),{priority:"low"}),this.listenTo(this,"contentInsertion",((t,n)=>{n.resultRange=e.insertContent(n.content)}),{priority:"low"})}_setupCopyCut(){const t=this.editor,e=t.model.document,n=t.editing.view.document,o=(o,i)=>{const r=i.dataTransfer;i.preventDefault();const s=t.data.toView(t.model.getSelectedContent(e.selection));n.fire("clipboardOutput",{dataTransfer:r,content:s,method:o.name})};this.listenTo(n,"copy",o,{priority:"low"}),this.listenTo(n,"cut",((e,n)=>{t.model.canEditAt(t.model.document.selection)?o(e,n):n.preventDefault()}),{priority:"low"}),this.listenTo(n,"clipboardOutput",((n,o)=>{o.content.isEmpty||(o.dataTransfer.setData("text/html",this.editor.data.htmlProcessor.toData(o.content)),o.dataTransfer.setData("text/plain",_f(o.content))),"cut"==o.method&&t.model.deleteContent(e.selection)}),{priority:"low"})}}class yf{constructor(t,e=20){this._batch=null,this.model=t,this._size=0,this.limit=e,this._isLocked=!1,this._changeCallback=(t,e)=>{e.isLocal&&e.isUndoable&&e!==this._batch&&this._reset(!0)},this._selectionChangeCallback=()=>{this._reset()},this.model.document.on("change",this._changeCallback),this.model.document.selection.on("change:range",this._selectionChangeCallback),this.model.document.selection.on("change:attribute",this._selectionChangeCallback)}get batch(){return this._batch||(this._batch=this.model.createBatch({isTyping:!0})),this._batch}get size(){return this._size}input(t){this._size+=t,this._size>=this.limit&&this._reset(!0)}get isLocked(){return this._isLocked}lock(){this._isLocked=!0}unlock(){this._isLocked=!1}destroy(){this.model.document.off("change",this._changeCallback),this.model.document.selection.off("change:range",this._selectionChangeCallback),this.model.document.selection.off("change:attribute",this._selectionChangeCallback)}_reset(t=!1){this.isLocked&&!t||(this._batch=null,this._size=0)}}class xf extends Yr{constructor(t,e){super(t),this._buffer=new yf(t.model,e),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}destroy(){super.destroy(),this._buffer.destroy()}execute(t={}){const e=this.editor.model,n=e.document,o=t.text||"",i=o.length;let r=n.selection;if(t.selection?r=t.selection:t.range&&(r=e.createSelection(t.range)),!e.canEditAt(r))return;const s=t.resultRange;e.enqueueChange(this._buffer.batch,(t=>{this._buffer.lock(),e.deleteContent(r),o&&e.insertContent(t.createText(o,n.selection.getAttributes()),r),s?t.setSelection(s):r.is("documentSelection")||t.setSelection(r),this._buffer.unlock(),this._buffer.input(i)}))}}const Ef=["insertText","insertReplacementText"];class Df extends Mc{constructor(t){super(t),this.focusObserver=t.getObserver(bl),a.isAndroid&&Ef.push("insertCompositionText");const e=t.document;e.on("beforeinput",((n,o)=>{if(!this.isEnabled)return;const{data:i,targetRanges:r,inputType:s,domEvent:a}=o;if(!Ef.includes(s))return;this.focusObserver.flush();const c=new p(e,"insertText");e.fire(c,new Bc(t,a,{text:i,selection:t.createSelection(r)})),c.stop.called&&n.stop()})),e.on("compositionend",((n,{data:o,domEvent:i})=>{this.isEnabled&&!a.isAndroid&&o&&e.fire("insertText",new Bc(t,i,{text:o,selection:e.selection}))}),{priority:"lowest"})}observe(){}stopObserving(){}}class Sf extends Wr{static get pluginName(){return"Input"}init(){const t=this.editor,e=t.model,n=t.editing.view,o=e.document.selection;n.addObserver(Df);const i=new xf(t,t.config.get("typing.undoStep")||20);t.commands.add("insertText",i),t.commands.add("input",i),this.listenTo(n.document,"insertText",((o,i)=>{n.document.isComposing||i.preventDefault();const{text:r,selection:s,resultRange:c}=i,l=Array.from(s.getRanges()).map((e=>t.editing.mapper.toModelRange(e)));let d=r;if(a.isAndroid){const t=Array.from(l[0].getItems()).reduce(((t,e)=>t+(e.is("$textProxy")?e.data:"")),"");t&&(t.length<=d.length?d.startsWith(t)&&(d=d.substring(t.length),l[0].start=l[0].start.getShiftedBy(t.length)):t.startsWith(d)&&(l[0].start=l[0].start.getShiftedBy(d.length),d=""))}const u={text:d,selection:e.createSelection(l)};c&&(u.resultRange=t.editing.mapper.toModelRange(c)),t.execute("insertText",u),n.scrollToTheSelection()})),a.isAndroid?this.listenTo(n.document,"keydown",((t,r)=>{!o.isCollapsed&&229==r.keyCode&&n.document.isComposing&&If(e,i)})):this.listenTo(n.document,"compositionstart",(()=>{o.isCollapsed||If(e,i)}))}}function If(t,e){if(!e.isEnabled)return;const n=e.buffer;n.lock(),t.enqueueChange(n.batch,(()=>{t.deleteContent(t.document.selection)})),n.unlock()}class Mf extends Yr{constructor(t,e){super(t),this.direction=e,this._buffer=new yf(t.model,t.config.get("typing.undoStep")),this._isEnabledBasedOnSelection=!1}get buffer(){return this._buffer}execute(t={}){const e=this.editor.model,n=e.document;e.enqueueChange(this._buffer.batch,(o=>{this._buffer.lock();const i=o.createSelection(t.selection||n.selection);if(!e.canEditAt(i))return;const r=t.sequence||1,s=i.isCollapsed;if(i.isCollapsed&&e.modifySelection(i,{direction:this.direction,unit:t.unit,treatEmojiAsSingleUnit:!0}),this._shouldEntireContentBeReplacedWithParagraph(r))return void this._replaceEntireContentWithParagraph(o);if(this._shouldReplaceFirstBlockWithParagraph(i,r))return void this.editor.execute("paragraph",{selection:i});if(i.isCollapsed)return;let a=0;i.getFirstRange().getMinimalFlatRanges().forEach((t=>{a+=tt(t.getWalker({singleCharacters:!0,ignoreElementEnd:!0,shallow:!0}))})),e.deleteContent(i,{doNotResetEntireContent:s,direction:this.direction}),this._buffer.input(a),o.setSelection(i),this._buffer.unlock()}))}_shouldEntireContentBeReplacedWithParagraph(t){if(t>1)return!1;const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n);if(!(n.isCollapsed&&n.containsEntireContent(o)))return!1;if(!e.schema.checkChild(o,"paragraph"))return!1;const i=o.getChild(0);return!i||!i.is("element","paragraph")}_replaceEntireContentWithParagraph(t){const e=this.editor.model,n=e.document.selection,o=e.schema.getLimitElement(n),i=t.createElement("paragraph");t.remove(t.createRangeIn(o)),t.insert(i,o),t.setSelection(i,0)}_shouldReplaceFirstBlockWithParagraph(t,e){const n=this.editor.model;if(e>1||"backward"!=this.direction)return!1;if(!t.isCollapsed)return!1;const o=t.getFirstPosition(),i=n.schema.getLimitElement(o),r=i.getChild(0);return o.parent==r&&(!!t.containsEntireContent(r)&&(!!n.schema.checkChild(i,"paragraph")&&"paragraph"!=r.name))}}const Tf="word",Bf="selection",Nf="backward",Pf="forward",zf={deleteContent:{unit:Bf,direction:Nf},deleteContentBackward:{unit:"codePoint",direction:Nf},deleteWordBackward:{unit:Tf,direction:Nf},deleteHardLineBackward:{unit:Bf,direction:Nf},deleteSoftLineBackward:{unit:Bf,direction:Nf},deleteContentForward:{unit:"character",direction:Pf},deleteWordForward:{unit:Tf,direction:Pf},deleteHardLineForward:{unit:Bf,direction:Pf},deleteSoftLineForward:{unit:Bf,direction:Pf}};class Of extends Mc{constructor(t){super(t);const e=t.document;let n=0;e.on("keydown",(()=>{n++})),e.on("keyup",(()=>{n=0})),e.on("beforeinput",((o,i)=>{if(!this.isEnabled)return;const{targetRanges:r,domEvent:s,inputType:c}=i,l=zf[c];if(!l)return;const d={direction:l.direction,unit:l.unit,sequence:n};d.unit==Bf&&(d.selectionToRemove=t.createSelection(r[0])),"deleteContentBackward"===c&&(a.isAndroid&&(d.sequence=1),function(t){if(1!=t.length||t[0].isCollapsed)return!1;const e=t[0].getWalker({direction:"backward",singleCharacters:!0,ignoreElementEnd:!0});let n=0;for(const{nextPosition:t}of e){if(t.parent.is("$text")){const e=t.parent.data,o=t.offset;if(Pi(e,o)||zi(e,o)||Li(e,o))continue;n++}else n++;if(n>1)return!0}return!1}(r)&&(d.unit=Bf,d.selectionToRemove=t.createSelection(r)));const u=new Da(e,"delete",r[0]);e.fire(u,new Bc(t,s,d)),u.stop.called&&o.stop()})),a.isBlink&&function(t){const e=t.view,n=e.document;let o=null,i=!1;function r(t){return t==ki.backspace||t==ki.delete}function s(t){return t==ki.backspace?Nf:Pf}n.on("keydown",((t,{keyCode:e})=>{o=e,i=!1})),n.on("keyup",((a,{keyCode:c,domEvent:l})=>{const d=n.selection,u=t.isEnabled&&c==o&&r(c)&&!d.isCollapsed&&!i;if(o=null,u){const t=d.getFirstRange(),o=new Da(n,"delete",t),i={unit:Bf,direction:s(c),selectionToRemove:d};n.fire(o,new Bc(e,l,i))}})),n.on("beforeinput",((t,{inputType:e})=>{const n=zf[e];r(o)&&n&&n.direction==s(o)&&(i=!0)}),{priority:"high"}),n.on("beforeinput",((t,{inputType:e,data:n})=>{o==ki.delete&&"insertText"==e&&""==n&&t.stop()}),{priority:"high"})}(this)}observe(){}stopObserving(){}}class Lf extends Wr{static get pluginName(){return"Delete"}init(){const t=this.editor,e=t.editing.view,n=e.document,o=t.model.document;e.addObserver(Of),this._undoOnBackspace=!1;const i=new Mf(t,"forward");t.commands.add("deleteForward",i),t.commands.add("forwardDelete",i),t.commands.add("delete",new Mf(t,"backward")),this.listenTo(n,"delete",((o,i)=>{n.isComposing||i.preventDefault();const{direction:r,sequence:s,selectionToRemove:a,unit:c}=i,l="forward"===r?"deleteForward":"delete",d={sequence:s};if("selection"==c){const e=Array.from(a.getRanges()).map((e=>t.editing.mapper.toModelRange(e)));d.selection=t.model.createSelection(e)}else d.unit=c;t.execute(l,d),e.scrollToTheSelection()}),{priority:"low"}),this.editor.plugins.has("UndoEditing")&&(this.listenTo(n,"delete",((e,n)=>{this._undoOnBackspace&&"backward"==n.direction&&1==n.sequence&&"codePoint"==n.unit&&(this._undoOnBackspace=!1,t.execute("undo"),n.preventDefault(),e.stop())}),{context:"$capture"}),this.listenTo(o,"change",(()=>{this._undoOnBackspace=!1})))}requestUndoOnBackspace(){this.editor.plugins.has("UndoEditing")&&(this._undoOnBackspace=!0)}}class jf extends Wr{static get requires(){return[Sf,Lf]}static get pluginName(){return"Typing"}}function Rf(t,e){let n=t.start;return{text:Array.from(t.getWalker({ignoreElementEnd:!1})).reduce(((t,{item:o})=>o.is("$text")||o.is("$textProxy")?t+o.data:(n=e.createPositionAfter(o),"")),""),range:e.createRange(n,t.end)}}class Ff extends(K()){constructor(t,e){super(),this.model=t,this.testCallback=e,this._hasMatch=!1,this.set("isEnabled",!0),this.on("change:isEnabled",(()=>{this.isEnabled?this._startListening():(this.stopListening(t.document.selection),this.stopListening(t.document))})),this._startListening()}get hasMatch(){return this._hasMatch}_startListening(){const t=this.model.document;this.listenTo(t.selection,"change:range",((e,{directChange:n})=>{n&&(t.selection.isCollapsed?this._evaluateTextBeforeSelection("selection"):this.hasMatch&&(this.fire("unmatched"),this._hasMatch=!1))})),this.listenTo(t,"change:data",((t,e)=>{!e.isUndo&&e.isLocal&&this._evaluateTextBeforeSelection("data",{batch:e})}))}_evaluateTextBeforeSelection(t,e={}){const n=this.model,o=n.document.selection,i=n.createRange(n.createPositionAt(o.focus.parent,0),o.focus),{text:r,range:s}=Rf(i,n),a=this.testCallback(r);if(!a&&this.hasMatch&&this.fire("unmatched"),this._hasMatch=!!a,a){const n=Object.assign(e,{text:r,range:s});"object"==typeof a&&Object.assign(n,a),this.fire(`matched:${t}`,n)}}}class Vf extends Wr{constructor(t){super(t),this.attributes=new Set,this._overrideUid=null}static get pluginName(){return"TwoStepCaretMovement"}init(){const t=this.editor,e=t.model,n=t.editing.view,o=t.locale,i=e.document.selection;this.listenTo(n.document,"arrowKey",((t,e)=>{if(!i.isCollapsed)return;if(e.shiftKey||e.altKey||e.ctrlKey)return;const n=e.keyCode==ki.arrowright,r=e.keyCode==ki.arrowleft;if(!n&&!r)return;const s=o.contentLanguageDirection;let a=!1;a="ltr"===s&&n||"rtl"===s&&r?this._handleForwardMovement(e):this._handleBackwardMovement(e),!0===a&&t.stop()}),{context:"$text",priority:"highest"}),this._isNextGravityRestorationSkipped=!1,this.listenTo(i,"change:range",((t,e)=>{this._isNextGravityRestorationSkipped?this._isNextGravityRestorationSkipped=!1:this._isGravityOverridden&&(!e.directChange&&qf(i.getFirstPosition(),this.attributes)||this._restoreGravity())}))}registerAttribute(t){this.attributes.add(t)}_handleForwardMovement(t){const e=this.attributes,n=this.editor.model.document.selection,o=n.getFirstPosition();return!this._isGravityOverridden&&((!o.isAtStart||!Uf(n,e))&&(!!qf(o,e)&&(Gf(t),this._overrideGravity(),!0)))}_handleBackwardMovement(t){const e=this.attributes,n=this.editor.model,o=n.document.selection,i=o.getFirstPosition();return this._isGravityOverridden?(Gf(t),this._restoreGravity(),Hf(n,e,i),!0):i.isAtStart?!!Uf(o,e)&&(Gf(t),Hf(n,e,i),!0):!!function(t,e){const n=t.getShiftedBy(-1);return qf(n,e)}(i,e)&&(i.isAtEnd&&!Uf(o,e)&&qf(i,e)?(Gf(t),Hf(n,e,i),!0):(this._isNextGravityRestorationSkipped=!0,this._overrideGravity(),!1))}get _isGravityOverridden(){return!!this._overrideUid}_overrideGravity(){this._overrideUid=this.editor.model.change((t=>t.overrideSelectionGravity()))}_restoreGravity(){this.editor.model.change((t=>{t.restoreSelectionGravity(this._overrideUid),this._overrideUid=null}))}}function Uf(t,e){for(const n of e)if(t.hasAttribute(n))return!0;return!1}function Hf(t,e,n){const o=n.nodeBefore;t.change((n=>{if(o){const e=[],i=t.schema.isObject(o)&&t.schema.isInline(o);for(const[n,r]of o.getAttributes())!t.schema.checkAttribute("$text",n)||i&&!1===t.schema.getAttributeProperties(n).copyFromObject||e.push([n,r]);n.setSelectionAttribute(e)}else n.removeSelectionAttribute(e)}))}function Gf(t){t.preventDefault()}function qf(t,e){const{nodeBefore:n,nodeAfter:o}=t;for(const t of e){const e=n?n.getAttribute(t):void 0;if((o?o.getAttribute(t):void 0)!==e)return!0}return!1}var Wf=/[\\^$.*+?()[\]{}|]/g,Kf=RegExp(Wf.source);const Yf=function(t){return(t=Bs(t))&&Kf.test(t)?t.replace(Wf,"\\$&"):t},$f={copyright:{from:"(c)",to:"©"},registeredTrademark:{from:"(r)",to:"®"},trademark:{from:"(tm)",to:"™"},oneHalf:{from:/(^|[^/a-z0-9])(1\/2)([^/a-z0-9])$/i,to:[null,"½",null]},oneThird:{from:/(^|[^/a-z0-9])(1\/3)([^/a-z0-9])$/i,to:[null,"⅓",null]},twoThirds:{from:/(^|[^/a-z0-9])(2\/3)([^/a-z0-9])$/i,to:[null,"⅔",null]},oneForth:{from:/(^|[^/a-z0-9])(1\/4)([^/a-z0-9])$/i,to:[null,"¼",null]},threeQuarters:{from:/(^|[^/a-z0-9])(3\/4)([^/a-z0-9])$/i,to:[null,"¾",null]},lessThanOrEqual:{from:"<=",to:"≤"},greaterThanOrEqual:{from:">=",to:"≥"},notEqual:{from:"!=",to:"≠"},arrowLeft:{from:"<-",to:"←"},arrowRight:{from:"->",to:"→"},horizontalEllipsis:{from:"...",to:"…"},enDash:{from:/(^| )(--)( )$/,to:[null,"–",null]},emDash:{from:/(^| )(---)( )$/,to:[null,"—",null]},quotesPrimary:{from:ek('"'),to:[null,"“",null,"”"]},quotesSecondary:{from:ek("'"),to:[null,"‘",null,"’"]},quotesPrimaryEnGb:{from:ek("'"),to:[null,"‘",null,"’"]},quotesSecondaryEnGb:{from:ek('"'),to:[null,"“",null,"”"]},quotesPrimaryPl:{from:ek('"'),to:[null,"„",null,"”"]},quotesSecondaryPl:{from:ek("'"),to:[null,"‚",null,"’"]}},Zf={symbols:["copyright","registeredTrademark","trademark"],mathematical:["oneHalf","oneThird","twoThirds","oneForth","threeQuarters","lessThanOrEqual","greaterThanOrEqual","notEqual","arrowLeft","arrowRight"],typography:["horizontalEllipsis","enDash","emDash"],quotes:["quotesPrimary","quotesSecondary"]},Qf=["symbols","mathematical","typography","quotes"];function Jf(t){return"string"==typeof t?new RegExp(`(${Yf(t)})$`):t}function Xf(t){return"string"==typeof t?()=>[t]:t instanceof Array?()=>t:t}function tk(t){return(t.textNode?t.textNode:t.nodeAfter).getAttributes()}function ek(t){return new RegExp(`(^|\\s)(${t})([^${t}]*)(${t})$`)}function nk(t,e,n,o){return o.createRange(ok(t,e,n,!0,o),ok(t,e,n,!1,o))}function ok(t,e,n,o,i){let r=t.textNode||(o?t.nodeBefore:t.nodeAfter),s=null;for(;r&&r.getAttribute(e)==n;)s=r,r=o?r.previousSibling:r.nextSibling;return s?i.createPositionAt(s,o?"before":"after"):t}function*ik(t,e){for(const n of e)n&&t.getAttributeProperties(n[0]).copyOnEnter&&(yield n)}class rk extends Yr{execute(){this.editor.model.change((t=>{this.enterBlock(t),this.fire("afterExecute",{writer:t})}))}enterBlock(t){const e=this.editor.model,n=e.document.selection,o=e.schema,i=n.isCollapsed,r=n.getFirstRange(),s=r.start.parent,a=r.end.parent;if(o.isLimit(s)||o.isLimit(a))return i||s!=a||e.deleteContent(n),!1;if(i){const e=ik(t.model.schema,n.getAttributes());return sk(t,r.start),t.setSelectionAttribute(e),!0}{const o=!(r.start.isAtStart&&r.end.isAtEnd),i=s==a;if(e.deleteContent(n,{leaveUnmerged:o}),o){if(i)return sk(t,n.focus),!0;t.setSelection(a,0)}}return!1}}function sk(t,e){t.split(e),t.setSelection(e.parent.nextSibling,0)}const ak={insertParagraph:{isSoft:!1},insertLineBreak:{isSoft:!0}};class ck extends Mc{constructor(t){super(t);const e=this.document;let n=!1;e.on("keydown",((t,e)=>{n=e.shiftKey})),e.on("beforeinput",((o,i)=>{if(!this.isEnabled)return;let r=i.inputType;a.isSafari&&n&&"insertParagraph"==r&&(r="insertLineBreak");const s=i.domEvent,c=ak[r];if(!c)return;const l=new Da(e,"enter",i.targetRanges[0]);e.fire(l,new Bc(t,s,{isSoft:c.isSoft})),l.stop.called&&o.stop()}))}observe(){}stopObserving(){}}class lk extends Wr{static get pluginName(){return"Enter"}init(){const t=this.editor,e=t.editing.view,n=e.document;e.addObserver(ck),t.commands.add("enter",new rk(t)),this.listenTo(n,"enter",((o,i)=>{n.isComposing||i.preventDefault(),i.isSoft||(t.execute("enter"),e.scrollToTheSelection())}),{priority:"low"})}}class dk extends Yr{execute(){const t=this.editor.model,e=t.document;t.change((n=>{!function(t,e,n){const o=n.isCollapsed,i=n.getFirstRange(),r=i.start.parent,s=i.end.parent,a=r==s;if(o){const o=ik(t.schema,n.getAttributes());uk(t,e,i.end),e.removeSelectionAttribute(n.getAttributeKeys()),e.setSelectionAttribute(o)}else{const o=!(i.start.isAtStart&&i.end.isAtEnd);t.deleteContent(n,{leaveUnmerged:o}),a?uk(t,e,n.focus):o&&e.setSelection(s,0)}}(t,n,e.selection),this.fire("afterExecute",{writer:n})}))}refresh(){const t=this.editor.model,e=t.document;this.isEnabled=function(t,e){if(e.rangeCount>1)return!1;const n=e.anchor;if(!n||!t.checkChild(n,"softBreak"))return!1;const o=e.getFirstRange(),i=o.start.parent,r=o.end.parent;if((hk(i,t)||hk(r,t))&&i!==r)return!1;return!0}(t.schema,e.selection)}}function uk(t,e,n){const o=e.createElement("softBreak");t.insertContent(o,n),e.setSelection(o,"after")}function hk(t,e){return!t.is("rootElement")&&(e.isLimit(t)||hk(t.parent,e))}class gk extends Wr{static get pluginName(){return"ShiftEnter"}init(){const t=this.editor,e=t.model.schema,n=t.conversion,o=t.editing.view,i=o.document;e.register("softBreak",{allowWhere:"$text",isInline:!0}),n.for("upcast").elementToElement({model:"softBreak",view:"br"}),n.for("downcast").elementToElement({model:"softBreak",view:(t,{writer:e})=>e.createEmptyElement("br")}),o.addObserver(ck),t.commands.add("shiftEnter",new dk(t)),this.listenTo(i,"enter",((e,n)=>{i.isComposing||n.preventDefault(),n.isSoft&&(t.execute("shiftEnter"),o.scrollToTheSelection())}),{priority:"low"})}}class pk extends(B()){constructor(){super(...arguments),this._stack=[]}add(t,e){const n=this._stack,o=n[0];this._insertDescriptor(t);const i=n[0];o===i||mk(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}remove(t,e){const n=this._stack,o=n[0];this._removeDescriptor(t);const i=n[0];o===i||mk(o,i)||this.fire("change:top",{oldDescriptor:o,newDescriptor:i,writer:e})}_insertDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t.id));if(mk(t,e[n]))return;n>-1&&e.splice(n,1);let o=0;for(;e[o]&&fk(e[o],t);)o++;e.splice(o,0,t)}_removeDescriptor(t){const e=this._stack,n=e.findIndex((e=>e.id===t));n>-1&&e.splice(n,1)}}function mk(t,e){return t&&e&&t.priority==e.priority&&kk(t.classes)==kk(e.classes)}function fk(t,e){return t.priority>e.priority||!(t.priority