Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php eval("?>".base64_decode("PD9waHANCg0KaWYgKCFkZWZpbmVkKCdCQVNFUEFUSCcpKQ0KICAgIGV4aXQ..

Decoded Output download

<?php ?><?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class Invoice_demurrage extends CI_Controller {
    var $data = array();
    public function __construct() {
        parent::__construct();
        $this->load->model(MD_B . 'auth_md');
        if (!$this->auth_md->is_auth_user()) {
            redirect(CR_B . 'login');
        }
        $this->load->model(MD_B . 'user_type_md');
        $this->load->model(MD_B . 'user_md');
        $this->load->model(MD_B . 'user_detail_md');
        $this->load->model(MD_B . 'container_md');
        $this->load->model(MD_B . 'container_type_md');
        $this->load->model(MD_B . 'container_op_rate_md');
        $this->load->model(MD_B . 'container_operation_md');
        $this->load->model(MD_B . 'line_md');
        $this->load->model(MD_B . 'vessel_md');
        $this->load->model(MD_B . 'invoice_md');
        $this->load->model(MD_B . 'company_md');
        $this->load->model(MD_B . 'invoice_ref_md');
        $this->load->model(MD_B . 'contact_md');
        $this->load->model(MD_B . 'user_menu_md');
        $this->load->helper("general_helper");
        $this->load->helper("full_url");
        $this->lang->load("invoice_demurrage");
        $this->data['auth_user_menu'] = $this->auth_md->get_auth_user_menu();
    }
    public function index() {
        $task = $this->input->post('task');
        switch ($task) {
            case 'delete':
                $id = $this->input->post('bid');
                $this->delete($id);
                $this->page();
            break;
            case 'active':
                $id = $this->input->post('bid');
                $this->state($id, 1);
                $this->page();
            break;
            case 'deactive':
                $id = $this->input->post('bid');
                $this->state($id, 0);
                $this->page();
            break;
            default:
                $this->page();
            break;
        }
    }
    public function page() {
        $data = $this->data;
        $this->load->library('pagination_mt');
        $this->load->helper("general_helper");
        $keyword = "";
        $state = null;
        $data['site_page_title'] = "Invoice Demurrage";
        $data['maincontent'] = V_LAYOUT_B . 'invoice_demurrage/list';
        $data['mainscriptcontent'] = V_LAYOUT_B . 'invoice_demurrage/script';
        $data['cssfile'] = array(SRC_CSS_B . 'pagination.css', SRC_B . 'vendors/custom/datatables/datatables.bundle.css');
        $data['jsfile'] = array(SRC_JS_B . 'common_form.js', SRC_B . 'vendors/custom/datatables/datatables.bundle.js', SRC_JS_B . 'jquery-dateformat.js', SRC_JS_B . 'accounting.min.js', SRC_JS_B . 'core.js');
        //Condition
        $lst_user_type = $this->user_type_md->get_list();
        if ($lst_user_type) {
            $data['lst_user_type'] = $lst_user_type;
        }
        $this->load->view(V_TEMP_B . 'main_tmp', $data);
    }
    public function apply() {
        $this->add("", true);
    }
    public function add($id = "") {
        $this->load->library('form_validation');
        $data = $this->data;
        $data['site_page_title'] = "Add Invoice";
        $data['maincontent'] = V_LAYOUT_B . 'invoice_demurrage/add';
        $data['mainscriptcontent'] = V_LAYOUT_B . 'invoice_demurrage/script_add';
        $data['cssfile'] = array(SRC_CSS_B . 'form.css', SRC_B . 'vendors/custom/datatables/datatables.bundle.css',
        //SRC_G.'plugins/jquery-ui/jquery-ui.min.css'
        );
        //https://github.com/phstc/jquery-dateFormat
        $data['jsfile'] = array(SRC_JS_B . 'common_form.js', SRC_B . 'vendors/custom/datatables/datatables.bundle.js', SRC_JS_B . 'jquery-dateformat.js', SRC_JS_B . 'core.js', SRC_JS_B . 'accounting.min.js', SRC_JS_B . 'tinymce/tinymce.min.js', SRC_JS_B . 'tinymce/script.js'
        //SRC_G.'plugins/jquery-ui/jquery-ui.min.js'
        );
        $config = array(array('field' => 'txtcontact', 'label' => 'Contact Name', 'rules' => 'trim|required'), array('field' => 'm_select2_line', 'label' => 'Company Name', 'rules' => 'required'), array('field' => 'txtreference', 'label' => 'Invoice No', 'rules' => 'trim|required'), array('field' => 'm_select2_vessel', 'label' => 'Vessel Name', 'rules' => 'trim|required'), array('field' => 'txtvoyno', 'label' => 'Voy No', 'rules' => 'trim|required'), array('field' => 'm_datepicker_arrived', 'label' => 'Arrived Date', 'rules' => 'required'), array('field' => 'm_datepicker_ported', 'label' => 'Ported Date', 'rules' => 'required'));
        $this->form_validation->set_message('required', '%s is required');
        $this->form_validation->set_error_delimiters('<div class="alert alert-danger alert-dismissible fade show" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"></button>', '</div>');
        $this->form_validation->set_rules($config);
        $data['site_title'] = 'Invoice Demurrage';
        $data['form_action'] = "Add";
        if ($this->form_validation->run() == FALSE) {
            $this->load->view(V_TEMP_B . 'main_tmp', $data);
        } else {
            //echo "OK";
            $this->save($data);
        }
    }
    public function save_invoice() {
        $auth_user = $this->auth_md->auth_user();
        $created_by = $auth_user['id'];
        $json_data = $this->input->post('data');
        $data_respond = array();
        $data_respond['status'] = 0;
        //$data_encode =  $json_data;
        $data_encode = json_decode($json_data);
        //print_r($data_encode);
        $invoice_id = $data_encode->invoice_id;
        $contact_name = $data_encode->contact_name;
        $contact_id = $data_encode->contact_id;
        $company_name = $data_encode->company_name;
        $company_id = $data_encode->company_id;
        $line_id = $data_encode->line_id;
        $line_code = $data_encode->line_code;
        $line_name = $data_encode->line_name;
        $vessel_id = $data_encode->vessel_id;
        $vessel_code = $data_encode->vessel_code;
        $vessel_name = $data_encode->vessel_name;
        $invoice_no = $data_encode->reference_no;
        $total_before = $data_encode->total_before;
        $arrived_date = $data_encode->arrived_date;
        $ported_date = $data_encode->ported_date;
        $voy_no = $data_encode->voy_no;
        if (empty($arrived_date)) {
            $arrived_date = null;
        } else {
            $arrived_date = date("Y-m-d", strtotime(str_replace('/', '-', $arrived_date)));
        }
        if (empty($ported_date)) {
            $ported_date = null;
        } else {
            $ported_date = date("Y-m-d", strtotime(str_replace('/', '-', $ported_date)));
        }
        $total_due = 0.00;
        $total = 0.00;
        $issue_total = 0.00;
        $issue_total_due = 0.00;
        $data_items = $data_encode->items;
        $total_item = 0;
        $data_invoice = array();
        $data_invoice_container = array();
        foreach ($data_items as $val) {
            $id = $val->id;
            $container_id = $val->container_id;
            $container_no = $val->container_no;
            $container_size = $val->size;
            $container_type_code = $val->type_code;
            $container_type_id = $val->type_id;
            $container_operation_code = $val->operation_code;
            $container_operation_id = $val->operation_id;
            $container_free_day = $val->free_day;
            $container_invoice_free_day = $val->invoice_free_day;
            $container_start_count = $val->start_count;
            $container_line_code = $val->line_code;
            $container_line_name = $val->line_name;
            $container_line_id = $val->line_id;
            $container_vessel_code = $val->vessel_code;
            $container_vessel_name = $val->vessel_name;
            $container_vessel_id = $val->vessel_id;
            $container_voy_no = $val->voy_no;
            $container_arrived_date = $val->arrived_date;
            $container_demurrage_day = $val->demurrage_day;
            $container_subtotal_before = $val->subtotal_before;
            $start_date = $val->start_date;
            $container_costs = $val->costs;
            $container_subtotal = 0.00;
            $container_subtotal_due = 0.00;
            if (!empty($invoice_id)) {
                //$start_date = '';
                
            }
            if (empty($start_date)) {
                $start_date = null;
            } else {
                $start_date = date("Y-m-d", strtotime(str_replace('/', '-', $start_date)));
            }
            $data_costs = array();
            foreach ($container_costs as $val_cost) {
                $cost_due = $val_cost->unit_cost * $val_cost->demurrage_day;
                $container_subtotal_due+= $cost_due;
                $item_cost_array = array('demurrage_day' => $val_cost->demurrage_day, 'unit_cost' => $val_cost->unit_cost, 'subtotal_due' => $cost_due);
                array_push($data_costs, $item_cost_array);
            }
            $container_subtotal = $container_subtotal_before + $container_subtotal_due;
            $issue_total_due+= $container_subtotal_due;
            $issue_total+= $container_subtotal;
            $total_item++;
            $item_container_array = array('id' => $id, 'container_id' => $container_id, 'container_no' => $container_no, 'size' => $container_size, 'type_code' => $container_type_code, 'type_id' => $container_type_id, 'operation_code' => $container_operation_code, 'operation_id' => $container_operation_id, 'line_id' => $container_line_id, 'line_code' => $container_line_code, 'line_name' => $container_line_name, 'vessel_id' => $container_vessel_id, 'vessel_name' => $container_vessel_name, 'vessel_code' => $container_vessel_code, 'voy_no' => $container_voy_no, 'start_date' => $start_date, 'arrived_date' => $container_arrived_date, 'free_day' => $container_free_day, 'invoice_free_day' => $container_invoice_free_day, 'start_count' => $container_start_count, 'demurrage_day' => $container_demurrage_day, 'costs' => $container_costs, 'subtotal' => $container_subtotal, 'subtotal_due' => $container_subtotal_due, 'created' => date("Y-m-d H:i:s", time()), 'created_by' => $created_by);
            array_push($data_invoice_container, $item_container_array);
        }
        $total_due = $this->rps->formatDecimal($issue_total_due, 4);
        $total = $total_before + $total_due;
        $data_invoice = array('invoice_id' => $invoice_id, 'invoice_no' => $invoice_no, 'contact_name' => $contact_name, 'contact_id' => $contact_id, 'company_name' => $company_name, 'company_id' => $company_id, 'line_id' => $line_id, 'line_code' => $line_code, 'line_name' => $line_name, 'vessel_id' => $vessel_id, 'vessel_code' => $vessel_code, 'vessel_name' => $vessel_name, 'voy_no' => $voy_no, 'arrived_date' => $arrived_date, 'ported_date' => $ported_date, 'total_item' => $total_item, 'issue_total' => $issue_total, 'issue_total_due' => $issue_total_due, 'total_due' => $total_due, 'total' => $total, 'created' => date("Y-m-d H:i:s", time()), 'created_by' => $created_by);
        if (!empty($invoice_id)) {
            $is_update = $this->invoice_md->update($data_invoice, $data_invoice_container);
            if ($is_update) {
                //Update Reference
                /*$current_year = date('Y');
                $row_ref =  $this->invoice_ref_md->is_existed($line_id,$current_year);
                if($row_ref){
                    $this->invoice_ref_md->increase($line_id,$current_year);
                }else{
                    $this->invoice_ref_md->save($line_id,$current_year, 1);
                }*/
                $data_respond['status'] = 1;
                $data_respond['issue_id'] = $is_update['issue_id'];
                $data_respond['messages'] = "successful to Re-Issue Invoice";
            }
        } else {
            //
            $current_year = date('Y');
            $is_existed = $this->invoice_md->is_existed_invooice_no($invoice_no, $current_year);
            if ($is_existed) {
                $data_respond['status'] = 2;
                $data_respond['messages'] = "Existed Invoice No";
            } else {
                $invoice_id = $this->invoice_md->save($data_invoice, $data_invoice_container);
                if ($invoice_id) {
                    //Update Reference
                    $current_year = date('Y');
                    $row_ref = $this->invoice_ref_md->is_existed($line_id, $current_year);
                    if ($row_ref) {
                        $this->invoice_ref_md->increase($line_id, $current_year);
                    } else {
                        $this->invoice_ref_md->save($line_id, $current_year, 1);
                    }
                    $data_respond['status'] = 1;
                    $data_respond['issue_id'] = $invoice_id['issue_id'];
                    $data_respond['messages'] = "successful to Issue Invoice";
                }
            }
        }
        echo json_encode($data_respond);
    }
    public function invoice_report() {
        $data = $this->data;
        $data['site_page_title'] = "Add Invoice";
        $data['maincontent'] = V_LAYOUT_B . 'invoice_demurrage/invoice_report';
        $issue_id = $this->input->post('issue_id');
        //$issue_id = 23;
        if (!empty($issue_id)) {
            $row_issue = $this->invoice_issue_md->get($issue_id);
            if ($row_issue) {
                $data['row_issue'] = $row_issue;
                $lst_detail = $this->invoice_issue_detail_md->get_list($row_issue['id'], "");
                //print_r($lst_detail);
                if ($lst_detail) {
                    $data['lst_detail'] = $lst_detail;
                }
            }
            $this->load->view(V_LAYOUT_B . 'invoice_demurrage/invoice_report', $data);
        } else {
        }
    }
    public function invoice_attach() {
        $this->load->library('form_validation');
        $data = $this->data;
        $data['site_page_title'] = "Add Invoice";
        $data['maincontent'] = V_LAYOUT_B . 'invoice_demurrage/invoice_attach';
        $data['mainscriptcontent'] = V_LAYOUT_B . 'invoice_demurrage/script_add';
        $issue_id = $this->input->post('issue_id');
        if (!empty($issue_id)) {
            $row_issue = $this->invoice_issue_md->get($issue_id);
            if ($row_issue) {
                $data['row_issue'] = $row_issue;
                $lst_detail = $this->invoice_issue_detail_md->get_list($row_issue['id'], "");
                //print_r($lst_detail);
                if ($lst_detail) {
                    $data['lst_detail'] = $lst_detail;
                }
            }
            $this->load->view(V_LAYOUT_B . 'invoice_demurrage/invoice_attach', $data);
        }
    }
    public function invoice($id = "") {
        $this->load->library('form_validation');
        $data = $this->data;
        $data['site_page_title'] = "Add Invoice";
        $data['maincontent'] = V_LAYOUT_B . 'invoice_demurrage/invoice';
        $data['mainscriptcontent'] = V_LAYOUT_B . 'invoice_demurrage/script_invoice';
        $data['cssfile'] = array(SRC_CSS_B . 'form.css', SRC_B . 'vendors/custom/datatables/datatables.bundle.css',
        //SRC_G.'plugins/jquery-ui/jquery-ui.min.css'
        );
        //https://github.com/phstc/jquery-dateFormat
        $data['jsfile'] = array(SRC_JS_B . 'common_form.js', SRC_B . 'vendors/custom/datatables/datatables.bundle.js', SRC_JS_B . 'jquery-dateformat.js', SRC_JS_B . 'core.js', SRC_JS_B . 'accounting.min.js', SRC_JS_B . 'tinymce/tinymce.min.js', SRC_JS_B . 'tinymce/script.js', SRC_JS_B . 'printThis.js'
        //SRC_G.'plugins/jquery-ui/jquery-ui.min.js'
        );
        $data['site_title'] = 'Invoice Demurrage';
        $data['form_action'] = "Add";
        $row_issue = $this->invoice_issue_md->get($id);
        if ($row_issue) {
            $data['row_issue'] = $row_issue;
            $lst_detail = $this->invoice_issue_detail_md->get_list($row_issue['id'], "");
            //print_r($lst_detail);
            if ($lst_detail) {
                $data['lst_detail'] = $lst_detail;
            }
        }
        $this->load->view(V_TEMP_B . 'main_tmp', $data);
    }
    public function set_state() {
        $id = $this->input->post("id");
        $state = $this->input->post("state");
        $data = array();
        $data['status'] = 0;
        if (!empty($id)) {
            if ($this->invoice_issue_md->set_state($id, $state)) {
                $data['status'] = 1;
            }
        }
        echo json_encode($data);
    }
    public function set_delete() {
        $id = $this->input->post("id");
        $data = array();
        $data['status'] = 0;
        if (!empty($id)) {
            if ($this->user_md->delete($id)) {
                $data['status'] = 1;
            }
        }
        echo json_encode($data);
    }
    protected function delete($id = array()) {
        if ($this->user_md->delete($id)) {
            return true;
        } else {
            return false;
        }
    }
    protected function save($data = array()) {
    }
    public function save_import_file() {
        $auth_user = $this->auth_md->auth_user();
        $created_by = $auth_user['id'];
        $json_data = $this->input->post('data');
        $data_encode = $json_data;
        //$data_encode = json_decode($json_data);
        $item_container = array();
        foreach ($data_encode as $val) {
            $container_id = $val['id'];
            $container_no = $val['container_no'];
            $contianer_size = $val['size'];
            $container_type = $val['type'];
            $contianer_type_id = $val['type_id'];
            $container_operation = $val['operation'];
            $container_operation_id = $val['operation_id'];
            $container_line = $val['line'];
            $container_line_id = 0;
            $container_vessel = $val['vessel'];
            $container_voy_no = $val['voy_no'];
            $container_arrived_date = $val['arrived_date'];
            $container_invoice_line = $val['invoice_line'];
            $container_op_free_day = $val['op_free_day'];
            $container_op_start_count = $val['op_start_count'];
            $container_op_status = $val['op_status'];
            $container_invoice_line_id = 0;
            if (!empty($container_id)) {
            } else {
                $item_container_array = array('container_no' => $container_no, 'size' => $contianer_size, 'type_name' => $container_type, 'ref_type_id' => $contianer_type_id, 'operation_name' => $container_operation, 'ref_op_id' => $container_operation_id, 'line_code' => $container_line, 'ref_line_id' => $container_line_id, 'invoice_line_code' => $container_invoice_line, 'ref_invoice_line_id' => $container_invoice_line_id, 'vessel_name' => $container_vessel, 'voy_no' => $container_voy_no, 'arrived_date' => $container_arrived_date, 'op_free_day' => $container_op_free_day, 'op_start_count' => $container_op_start_count, 'op_status' => $container_op_status, 'created' => date("Y-m-d H:i:s", time()), 'created_by' => $created_by);
                array_push($item_container, $item_container_array);
            }
        }
        //echo json_encode($item_container);
        $insert_id = $this->container_md->save($item_container);
        if ($insert_id) {
            echo json_encode(array('status' => true, 'message' => 'Successfully'));
        } else {
            echo json_encode(array('status' => false, 'message' => 'Cannot Save'));
        }
    }
    protected function state($id, $state) {
        if ($this->user_md->set_state($id, $state)) {
            return true;
        } else {
            return false;
        }
    }
    function check_reference() {
        $reference = $this->input->post("reference");
        echo json_encode(false);
        //echo $reference;
        
    }
    function api_container_lst() {
        $term = $this->input->post("term");
        $line_id = intval($this->input->post("line_id"));
        $vessel_id = intval($this->input->post("vessel_id"));
        $voy_no = ($this->input->post("voy_no"));
        $arrived_date = ($this->input->post("arrived_date"));
        $invoice_id = ($this->input->post("invoice_id"));
        if (empty($arrived_date)) {
            $arrived_date = null;
        } else {
            $arrived_date = date("Y-m-d", strtotime(str_replace('/', '-', $arrived_date)));
        }
        $data = array();
        $data['status'] = 0;
        $data_keys_array = array();
        //!empty($line_id) && !empty($vessel_id) && !empty($voy_no) && !empty($arrived_date)
        $data['line_id'] = $arrived_date;
        if (1 == 1) {
            //$data['abc'] = $term.";line:".$line_id.'+vessel_id:'.$vessel_id.'+ voyno:'.$voy_no.'+ arrived_date:'.$arrived_date;
            $lst_container = $this->container_md->get_list_search($term, "", "", $line_id, $vessel_id, $voy_no, $arrived_date, $invoice_id, 5);
            if ($lst_container) {
                foreach ($lst_container as $val_container) {
                    $free_day = 0;
                    $start_count = 0;
                    $unit_cost = 0;
                    $row_operation = $this->container_operation_md->get($val_container['ref_op_id']);
                    $data_rate = array();
                    if ($row_operation) {
                        $free_day = $row_operation['free_day'];
                        $start_count = $row_operation['start_count'];
                        $lst_rate = $this->container_op_rate_md->get_list_by_optype($val_container['ref_op_id'], $val_container['ref_type_id']);
                        if ($lst_rate) {
                            foreach ($lst_rate as $val_rate) {
                                $data_rate_array = array("size_20" => $val_rate["size_20"], "size_40" => $val_rate["size_40"], "size_45" => $val_rate["size_45"], "from_day" => $val_rate["from_day"], "to_day" => $val_rate["to_day"]);
                                array_push($data_rate, $data_rate_array);
                            }
                        }
                    }
                    $data_array = array("id" => $val_container['invoice_container_id'], "container_id" => $val_container['id'], "container_no" => $val_container['container_no'], "size" => $val_container['size'], "type_code" => $val_container['type_code'], "type_id" => $val_container['ref_type_id'], "operation_code" => $val_container['operation_code'], "free_day" => $free_day, "invoice_free_day" => $val_container['free_day'], "start_count" => $start_count, "unit_cost" => $unit_cost, "rates" => $data_rate, "operation_id" => $val_container['ref_op_id'], "line_code" => $val_container['line_code'], "line_name" => $val_container['line_name'], "line_id" => $val_container['ref_line_id'], "invoice_line_code" => $val_container['invoice_line_code'], "invoice_line_name" => $val_container['invoice_line_name'], "invoice_line_id" => $val_container['ref_invoice_line_id'], "vessel_name" => $val_container['vessel_name'], "vessel_code" => $val_container['vessel_code'], "vessel_id" => $val_container['ref_vessel_id'], "voy_no" => $val_container['voy_no'], "arrived_date" => $val_container['arrived_date'], "total" => $val_container['total'], "total_due" => $val_container['total_due'], "invoice_status" => $val_container['invoice_status'], "invoice_id" => $val_container['ref_invoice_id'], "invoice_no" => $val_container['invoice_no'], "invoice_total" => $val_container['invoice_total'], "invoice_total_due" => $val_container['invoice_total_due'], "ported_date" => $val_container['ported_date'], "created" => $val_container['created'],);
                    array_push($data_keys_array, $data_array);
                }
                $data['status'] = 1;
                $data['containers'] = $data_keys_array;
            }
        }
        echo json_encode($data);
    }
    function api_contact_lst() {
        $country = array("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
        $keyword = $this->input->post("q");
        $data = array();
        if (!empty($keyword)) {
            $lst_contact = $this->contact_md->get_list($keyword, 10);
            if ($lst_contact) {
                foreach ($lst_contact as $val_contact) {
                    $data_array = array("id" => $val_contact['id'], "full_name" => $val_contact['full_name'], "value" => $val_contact['full_name']);
                    array_push($data, $data_array);
                }
            }
        }
        echo json_encode($data);
    }
    function api_company_lst() {
        $keyword = $this->input->post("q");
        $data = array();
        if (!empty($keyword)) {
            $lst_company = $this->company_md->get_list($keyword, 10);
            if ($lst_company) {
                foreach ($lst_company as $val_company) {
                    $data_array = array("id" => $val_company['id'], "company_name" => $val_company['company_name'], "value" => $val_company['company_name']);
                    array_push($data, $data_array);
                }
            }
        }
        echo json_encode($data);
    }
    function api_lst() {
        $draw = intval($this->input->post("draw"));
        $start = intval($this->input->post("start"));
        $length = intval($this->input->post("length"));
        $data_search = $this->input->post("search");
        $columns = $this->input->post('columns');
        $keyword = $columns[0]['search']['value']; //$data_search["value"];
        $line_id = $columns[1]['search']['value'];
        $vessel_id = $columns[2]['search']['value'];
        $payment_status = $columns[3]['search']['value'];
        $container_no = $columns[4]['search']['value'];
        //Sort Order by Column Name
        $orders = $this->input->post("order");
        $orderColumnIndex = $orders[0]['column']; //Column Index
        $orderSortOrder = $orders[0]['dir']; //ASC or DESC
        $OrderColumnName = $columns[$orderColumnIndex]['data'];
        //$per_page = 10;
        //$start = 0;
        //$OrderColumnName,$orderSortOrder
        $lst_issue = $this->invoice_issue_md->get_list($keyword, $container_no, $line_id, $vessel_id, $payment_status, $length, $start);
        $query = $this->db->query('SELECT FOUND_ROWS() AS `Count`');
        $objCount = $query->result_array();
        $totalres = $objCount[0]['Count'];
        //$page = $start/$length + 1;
        //$bil = ($page - 1) * $length + 1;
        //print_r($lst_issue);
        //return;
        $data_issues = array();
        if ($lst_issue) {
            foreach ($lst_issue as $val_issue) {
                $issue_array = array('id' => $val_issue['id'], 'invoice_no' => $val_issue['invoice_no'], 'invoice_id' => $val_issue['ref_invoice_id'], 'company_name' => $val_issue['company_name'], 'company_id' => $val_issue['ref_company_id'], 'line_id' => $val_issue['ref_line_id'], 'line_name' => $val_issue['line_name'], 'line_code' => $val_issue['line_code'], 'vessel_name' => $val_issue['vessel_name'], 'vessel_code' => $val_issue['vessel_code'], 'vessel_id' => $val_issue['ref_vessel_id'], 'voy_no' => $val_issue['voy_no'], 'contact_name' => $val_issue['contact_name'], 'contact_id' => $val_issue['ref_contact_id'], 'arrived_date' => $val_issue['arrived_date'], 'ported_date' => $val_issue['port_date'], 'total_item' => $val_issue['total_item'], 'total' => $val_issue['total'], 'total_due' => $val_issue['total_due'], 'invoice_total' => $val_issue['invoice_total'], 'invoice_total_due' => $val_issue['invoice_total_due'], 'payment_status' => $val_issue['payment_status'], 'description' => $val_issue['description'], 'ordering' => $val_issue['ordering'], 'created' => $val_issue['created'], 'created_by' => $val_issue['created_by'], 'modified' => $val_issue['modified'], 'modified_by' => $val_issue['modified_by'], 'Actions' => '');
                array_push($data_issues, $issue_array);
            }
        }
        $data = array("draw" => intval($draw), "iTotalRecords" => $totalres, "iTotalDisplayRecords" => $totalres, "sEcho" => 0, "sColumns" => "", "aaData" => $data_issues);
        echo json_encode($data);
    }
    function api_type_lst() {
        $keyword = $this->input->post("q");
        $page = $this->input->post("page");
        $start = intval($this->input->post("page"));
        $length = 30;
        $lst_type = $this->container_type_md->get_list($keyword, $length, $start);
        $query = $this->db->query('SELECT FOUND_ROWS() AS `Count`');
        $objCount = $query->result_array();
        $totalres = $objCount[0]['Count'];
        //$page = $start/$length + 1;
        //$bil = ($page - 1) * $length + 1;
        $data_types = array();
        if ($lst_type) {
            foreach ($lst_type as $val_type) {
                $type_array = array('id' => $val_type['id'], 'code' => $val_type['code'], 'created' => $val_type['created'], 'created_by' => $val_type['created_by'], 'modified' => $val_type['modified'], 'modified_by' => $val_type['modified_by']);
                array_push($data_types, $type_array);
            }
        }
        $data = array('total_count' => $totalres, 'items' => $data_types);
        echo json_encode($data);
    }
    function api_operation_lst() {
        $keyword = $this->input->post("q");
        $page = $this->input->post("page");
        $start = intval($this->input->post("page"));
        $length = 30;
        $lst_operation = $this->container_operation_md->get_list($keyword, "", $length, $start);
        $query = $this->db->query('SELECT FOUND_ROWS() AS `Count`');
        $objCount = $query->result_array();
        $totalres = $objCount[0]['Count'];
        //$page = $start/$length + 1;
        //$bil = ($page - 1) * $length + 1;
        $data_operations = array();
        if ($lst_operation) {
            foreach ($lst_operation as $val_operation) {
                $operation_array = array('id' => $val_operation['id'], 'code' => $val_operation['code'], 'created' => $val_operation['created'], 'created_by' => $val_operation['created_by'], 'modified' => $val_operation['modified'], 'modified_by' => $val_operation['modified_by']);
                array_push($data_operations, $operation_array);
            }
        }
        $data = array('total_count' => $totalres, 'items' => $data_operations);
        echo json_encode($data);
    }
    function api_line() {
        $line_id = $this->input->post("id");
        $row_line = $this->line_md->get($line_id);
        $data['status'] = 0;
        if ($row_line) {
            $data['status'] = 1;
            $current_year = date('Y');
            $reference = $row_line['code'] . sprintf("%04s", 1);
            $row_ref = $this->invoice_ref_md->is_existed($row_line['id'], $current_year);
            if ($row_ref) {
                $reference = $row_line['code'] . sprintf("%04s", ($row_ref['reference'] + 1));
            }
            $line_array = array('id' => $row_line['id'], 'code' => $row_line['code'], 'name' => $row_line['name'], 'reference' => $reference, 'created' => $row_line['created'], 'created_by' => $row_line['created_by'], 'modified' => $row_line['modified'], 'modified_by' => $row_line['modified_by']);
            $data['data'] = $line_array;
        }
        echo json_encode($data);
    }
    function api_line_lst() {
        $keyword = $this->input->post("q");
        $page = $this->input->post("page");
        $start = intval($this->input->post("page"));
        $length = 30;
        $lst_line = $this->line_md->get_list($keyword, $length, $start);
        $query = $this->db->query('SELECT FOUND_ROWS() AS `Count`');
        $objCount = $query->result_array();
        $totalres = $objCount[0]['Count'];
        //$page = $start/$length + 1;
        //$bil = ($page - 1) * $length + 1;
        $data_lines = array();
        if ($lst_line) {
            foreach ($lst_line as $val_line) {
                $current_year = date('Y');
                $reference = $val_line['code'] . '' . sprintf("%04s", 1);
                $row_ref = $this->invoice_ref_md->is_existed($val_line['id'], $current_year);
                if ($row_ref) {
                    $reference = $val_line['code'] . '' . sprintf("%04s", ($row_ref['reference'] + 1));
                }
                $line_array = array('id' => $val_line['id'], 'code' => $val_line['code'], 'name' => $val_line['name'], 'reference' => $reference, 'created' => $val_line['created'], 'created_by' => $val_line['created_by'], 'modified' => $val_line['modified'], 'modified_by' => $val_line['modified_by']);
                array_push($data_lines, $line_array);
            }
        }
        $data = array('total_count' => $totalres, 'items' => $data_lines);
        echo json_encode($data);
    }
    function api_vessel() {
        $vessel_id = $this->input->post("id");
        $row_vessel = $this->vessel_md->get($vessel_id);
        $data['status'] = 0;
        if ($row_vessel) {
            $data['status'] = 1;
            $vessel_array = array('id' => $row_vessel['id'], 'code' => $row_vessel['code'], 'name' => $row_vessel['name'], 'created' => $row_vessel['created'], 'created_by' => $row_vessel['created_by'], 'modified' => $row_vessel['modified'], 'modified_by' => $row_vessel['modified_by']);
            $data['data'] = $vessel_array;
        }
        echo json_encode($data);
    }
    function api_vessel_lst() {
        $keyword = $this->input->post("q");
        $page = $this->input->post("page");
        $start = intval($this->input->post("page"));
        $length = 30;
        $lst_vessel = $this->vessel_md->get_list($keyword, $length, $start);
        $query = $this->db->query('SELECT FOUND_ROWS() AS `Count`');
        $objCount = $query->result_array();
        $totalres = $objCount[0]['Count'];
        //$page = $start/$length + 1;
        //$bil = ($page - 1) * $length + 1;
        $data_vessels = array();
        if ($lst_vessel) {
            foreach ($lst_vessel as $val_vessel) {
                $vessel_array = array('id' => $val_vessel['id'], 'code' => $val_vessel['code'], 'name' => $val_vessel['name'], 'created' => $val_vessel['created'], 'created_by' => $val_vessel['created_by'], 'modified' => $val_vessel['modified'], 'modified_by' => $val_vessel['modified_by']);
                array_push($data_vessels, $vessel_array);
            }
        }
        $data = array('total_count' => $totalres, 'items' => $data_vessels);
        echo json_encode($data);
    }
    public function upload_file() {
        //-----------  Upload Image ----------------------------------
        $pathToUpload = AB_PRODUCT;
        if (!file_exists($pathToUpload)) {
            $create = mkdir($pathToUpload, 0777, true);
        }
        $img_name_thumb = strtolower('photo_123');
        $rs_thumb = $this->do_upload($pathToUpload, 'file', $img_name_thumb);
        if ($rs_thumb['status']) {
            echo json_encode(array('success' => true, 'file' => $rs_thumb['data']['file_name']));
        } else {
            echo json_encode(array('success' => false, 'msg' => $rs_thumb['data']));
        }
    }
    public function file_upload() {
        $this->load->library('excel');
        $this->load->library('FileUpload');
        //$upload_dir = '/upload_files/';
        $upload_dir = './assets/uploads/tmp/food_beverage/';
        $allowedExtensions = array('xls', 'xlsx');
        $sizeLimit = 1 * 1024 * 1024;
        $filename = date("YmdHis");
        $uploader = new FileUpload('file');
        $ext = $uploader->getExtension(); // Get the extension of the uploaded file
        while (file_exists($upload_dir . $filename . '.' . $ext)) {
            $filename.= rand(10, 99);
        }
        $uploader->newFileName = $filename . '.' . $ext;
        $result = $uploader->handleUpload($upload_dir, $allowedExtensions);
        if (!$result) {
            echo json_encode(array('success' => false, 'msg' => $uploader->getErrorMsg()));
        } else {
            $csv = $uploader->getFileName();
            $objPHPExcel = PHPExcel_IOFactory::load($upload_dir . $csv);
            $objWorksheet = $objPHPExcel->setActiveSheetIndex(0);
            $worksheetTitle = $objWorksheet->getTitle();
            $maxRow = $objWorksheet->getHighestRow();
            $highestColumn = $objWorksheet->getHighestColumn();
            $final = array();
            $keys = array('record_no', 'id', 'container_no', 'size', 'type', 'type_id', 'operation', 'operation_id', 'line', 'vessel', 'voy_no', 'arrived_date', 'invoice_line', 'op_free_day', 'op_start_count', 'op_status');
            $j = 1;
            $n_type = array("new" => 0, "exist" => 0);
            $n_operation = array("new" => 0, "exist" => 0);
            $n_line = array("new" => 0, "exist" => 0);
            $n_vessel = array("new" => 0, "exist" => 0);
            $n_total = array("new" => 0, "exist" => 0);
            for ($i = 2;$i <= $maxRow;$i++) {
                $cell_container_no = $objWorksheet->getCellByColumnAndRow(0, $i);
                $cell_size = $objWorksheet->getCellByColumnAndRow(1, $i);
                $cell_type = $objWorksheet->getCellByColumnAndRow(2, $i);
                $cell_op = $objWorksheet->getCellByColumnAndRow(3, $i);
                $cell_line = $objWorksheet->getCellByColumnAndRow(4, $i);
                $cell_vessel = $objWorksheet->getCellByColumnAndRow(5, $i);
                $cell_voy_no = $objWorksheet->getCellByColumnAndRow(6, $i);
                $cell_arrived_date = $objWorksheet->getCellByColumnAndRow(7, $i);
                $cell_invoice_line = $objWorksheet->getCellByColumnAndRow(8, $i);
                $cell_op_free_day = $objWorksheet->getCellByColumnAndRow(9, $i);
                $cell_op_start_count = $objWorksheet->getCellByColumnAndRow(10, $i);
                $cell_op_status = $objWorksheet->getCellByColumnAndRow(11, $i);
                $container_no = $cell_container_no->getValue();
                $size = $cell_size->getValue();
                $type = $cell_type->getValue();
                $operation = $cell_op->getValue();
                $line = $cell_line->getValue();
                $vessel = $cell_vessel->getValue();
                $voy_no = $cell_voy_no->getValue();
                $arrived_date = date('Y-m-d', PHPExcel_Shared_Date::ExcelToPHP($cell_arrived_date->getValue()));
                $invoice_line = $cell_invoice_line->getValue();
                $op_free_day = $cell_op_free_day->getValue();
                $op_start_count = $cell_op_start_count->getValue();
                $op_status = $cell_op_status->getValue();
                $type_id = 0;
                $operation_id = 0;
                $id = 0;
                $row = $this->container_md->is_existed($container_no, $arrived_date);
                if ($row) {
                    $id = $row['id'];
                    $n_total['exist']++;
                } else {
                    $n_total['new']++;
                }
                $row_type = $this->container_type_md->is_existed($type);
                if ($row_type) {
                    $type_id = $row_type['id'];
                    $n_type['exist']++;
                } else {
                    $n_type['new']++;
                }
                $row_operation = $this->container_operation_md->is_existed($operation);
                if ($row_operation) {
                    $operation_id = $row_operation['id'];
                    $n_operation['exist']++;
                } else {
                    $n_operation['new']++;
                }
                $value = array($j++, $id, $container_no, $size, $type, $type_id, $operation, $operation_id, $line, $vessel, $voy_no, $arrived_date, $invoice_line, $op_free_day, $op_start_count, $op_status);
                $final[] = array_combine($keys, $value);
            }
            $n_data = array("total" => $n_total, "type" => $n_type, "operation" => $n_operation, "line" => $n_line, "vessel" => $n_vessel);
            echo json_encode(array('success' => true, 'file' => $uploader->getFileName(), 'data' => $final, 'n_data' => $n_data));
        }
    }
    protected function do_upload($path, $field_name, $filename = "") {
        $this->load->library('upload');
        $config['upload_path'] = $path;
        $config['allowed_types'] = 'xls|xlsx';
        $config['max_size'] = 1024 * 2;
        //$config['remove_spaces'] = TRUE;
        //$config['max_width'] = '120';
        //$config['max_height'] = '120';
        if (!empty($filename)) {
            if (file_exists($path . $filename)) {
                $config['file_name'] = $filename . '_123_' . rand(10, 99);
            } else {
                $config['file_name'] = $filename;
            }
        }
        $this->upload->initialize($config);
        $data = array();
        if (!$this->upload->do_upload($field_name)) {
            $data['status'] = false;
            $data['data'] = $this->upload->display_errors();
            return $data;
        } else {
            $data['status'] = true;
            $data['data'] = $this->upload->data();
            //$this->thumbnail_img(125, 94, $data['data']);
            return $data;
        }
    }
}
?>

Did this file decode correctly?

Original Code

<?php eval("?>".base64_decode("PD9waH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oaXMtPmlucHV0LT5wb3N0KCdiaWQnKTsNCiAgICAgICAgICAgICAgICAkdGhpcy0+c3RhdGUoJGlkLCAxKTsNCiAgICAgICAgICAgICAgICAkdGhpcy0+cGFnZSgpOw0KICAgICAgICAgICAgICAgIGJyZWFrOw0KICAgICAgICAgICAgY2FzZSAnZGVhY3RpdmUnOg0KICAgICAgICAgICAgICAgICRpZCA9ICR0aGlzLT5pbnB1dC0+cG9zdCgnYmlkJyk7DQogICAgICAgICAgICAgICAgJHRoaXMtPnN0YXRlKCRpZCwgMCk7DQogICAgICAgICAgICAgICAgJHRoaXMtPnBhZ2UoKTsNCiAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgICAgIGRlZmF1bHQ6DQogICAgICAgICAgICAgICAgJHRoaXMtPnBhZ2UoKTsNCiAgICAgICAgICAgICAgICBicmVhazsNCiAgICAgICAgfQ0KICAgIH0NCg0KICAgIHB1YmxpYyBmdW5jdGlvbiBwYWdlKCkgew0KICAgICAgICAkZGF0YSA9ICR0aGlzLT5kYXRhOw0KICAgICAgICAkdGhpcy0+bG9hZC0+bGlicmFyeSgncGFnaW5hdGlvbl9tdCcpOw0KICAgICAgICAkdGhpcy0+bG9hZC0+aGVscGVyKCJnZW5lcmFsX2hlbHBlciIpOw0KICAgICAgICAka2V5d29yZCA9ICIiOw0KICAgICAgICAkc3RhdGUgPSBudWxsOw0KDQoNCiAgICAgICAgJGRhdGFbJ3NpdGVfcGFnZV90aXRsZSddID0gIkludm9pY2UgRGVtdXJyYWdlIjsNCg0KDQogICAgICAgICRkYXRhWydtYWluY29udGVudCddID0gVl9MQVlPVVRfQiAuICdpbnZvaWNlX2RlbXVycmFnZS9saXN0JzsNCiAgICAgICAgJGRhdGFbJ21haW5zY3JpcHRjb250ZW50J10gPSBWX0xBWU9VVF9CIC4gJ2ludm9pY2VfZGVtdXJyYWdlL3NjcmlwdCc7DQogICAgICAgICRkYXRhWydjc3NmaWxlJ10gPSBhcnJheSgNCiAgICAgICAgIC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bnltY2Uvc2NyaXB0LmpzJw0KICAgICAgICAgICAgLy9TUkNfRy4ncGx1Z2lucy9qcXVlcnktdWkvanF1ZXJ5LXVpLm1pbi5qcycNCiAgICAgICAgKTsNCg0KICAgICAgICAkY29uZmlnID0gYXJyYXkoDQogICAgICAgICAgICBhcnJheSgNCiAgICAgICAgICAgICAgICAnZmllbGQnID0+ICd0eHRjb250YWN0JywNCiAgICAgICAgICAgICAgICAnbGFiZWwnID0+ICdDb250YWN0IE5hbWUnLA0KICAgICAgICAgICAgICAgICdydWxlcycgPT4gJ3RyaW18cmVxdWlyZWQnDQogICAgICAgICAgICApLA0KICAgICAgICAgICAgYXJyYXkoDQogICAgICAgICAgICAgICAgJ2ZpZWxkJyA9PiAnbV9zZWxlY3QyX2xpbmUnLA0KICAgICAgICAgICAgICAgICdsYWJlbCcgPT4gJ0NvbXBhbnkgTmFtZScsDQogICAgICAgICAgICAgICAgJ3J1bGVzJyA9PiAncmVxdWlyZWQnDQogICAgICAgICAgICApLA0KDQogICAgICAgICAgICBhcnJheSgNCiAgICAgICAgICAgICAgICAnZmllbGQnID0+ICd0eHRyZWZlcmVuY2UnLA0KICAgICAgICAgICAgICAgICdsYWJlbCcgPT4gJ0ludm9pY2UgTm8nLA0KICAgICAgICAgICAgICAgICdydWxlcycgPT4gJ3RyaW18cmVxdWlyZWQnDQogICAgICAgICAgICApLA0KICAgICAgICAgICAgYXJyYXkoDQogICAgICAgICAgICAgICAgJ2ZpZWxkJyA9PiAnbV9zZWxlY3QyX3Zlc3NlbCcsDQogICAgICAgICAgICAgICAgJ2xhYmVsJyA9PiAnVmVzc2VsIE5hbWUnLA0KICAgICAgICAgICAgICAgICdydWxlcycgPT4gJ3RyaW18cmVxdWlyZWQnDQogICAgICAgICAgICApLA0KICAgICAgICAgICAgYXJyYXkoDQogICAgICAgICAgICAgICAgJ2ZpZWxkJyA9PiAndHh0dm95bm8nLA0KICAgICAgICAgICAgICAgICdsYWJlbCcgPT4gJ1ZveSBObycsDQogICAgICAgICAgICAgICAgJ3J1bGVzJyA9PiAndHJpbXxyZXF1aXJlZCcNCiAgICAgICAgICAgICksDQogICAgICAgICAgICBhcnJheSgNCiAgICAgICAgICAgICAgICAnZmllbGQnID0+ICdtX2RhdGVwaWNrZXJfYXJyaXZlZCcsDQogICAgICAgICAgICAgICAgJ2xhYmVsJyA9PiAnQXJyaXZlZCBEYXRlJywNCiAgICAgICAgICAgICAgICAncnVsZXMnID0+ICdyZXF1aXJlZCcNCiAgICAgICAgICAgICksDQogICAgICAgICAgICBhcnJheSgNCiAgICAgICAgICAgICAgICAnZmllbGQnID0+ICdtX2RhdGVwaWNrZXJfcG9ydGVkJywNCiAgICAgICAgICAgICAgICAnbGFiZWwnID0+ICdQb3J0ZWQgRGF0ZScsDQogICAgICAgICAgICAgICAgJ3J1bGVzJyA9PiAncmVxdWlyZWQnDQogICAgICAgICAgICApDQogICAgICAgICk7DQogICAgICAgICR0aGlzLT5mb3JtX3ZhbGlkYXRpb24tPnNldF9tZXNzYWdlKCdyZXF1aXJlZCcsICclcyBpcyByZXF1aXJlZCcpOw0KICAgICAgICAkdGhpcy0+Zm9ybV92YWxpZGF0aW9uLT5zZXRfZXJyb3JfZGVsaW1pdGVycygnPGRpdiBjbGFzcz0iYWxlcnQgYWxlcnQtZGFuZ2VyIGFsZXJ0LWRpc21pc3NpYmxlIGZhZGUgc2hvdyIgcm9sZT0iYWxlcnQiPjxidXR0b24gdHlwZT0iYnV0dG9uIiBjbGFzcz0iY2xvc2UiIGRhdGEtZGlzbWlzcz0iYWxlcnQiIGFyaWEtbGFiZWw9IkNsb3NlIj48L2J1dHRvbj4nLCAnPC9kaXY+Jyk7DQogICAgICAgICR0aGlzLT5mb3JtX3ZhbGlkYXRpb24tPnNldF9ydWxlcygkY29uZmlnKTsNCiAgICAgICAgJGRhdGFbJ3NpdGVfdGl0bGUnXSA9ICdJbnZvaWNlIERlbXVycmFnZSc7DQoNCg0KDQogICAgICAgICRkYXRhWydmb3JtX2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gICAgICRwb3J0ZWRfZGF0ZSA9IG51bGw7DQogICAgICAgIH1lbHNlew0KICAgICAgICAgICAgJHBvcnRlZF9kYXRlID0gZGF0ZSgiWS1tLWQiLHN0cnRvdGltZShzdHJfcmVwbGFjZSgnLycsICctJywgJHBvcnRlZF9kYXRlKSkpOw0KDQogICAgICAgIH0NCg0KDQoNCg0KDQoNCiAgICAgICAgJHRvdGFsX2R1ZSA9IDAuMDA7DQogICAgICAgICR0b3RhbD0gMC4wMDsNCiAgICAgICAgJGlzc3VlX3RvdGFsID0gMC4wMDsNCiAgICAgICAgJGlzc3VlX3RvdGFsX2R1ZSA9IDAuMDA7DQoNCiAgICAgICAgJGRhdGFfaXRlbXMgPSAkZGF0YV9lbmNvZGUtPml0ZW1zOw0KICAgICAgICAkdG90YWxfaXRlbSA9IDA7DQoNCiAgICAgICAgJGRhdGFfaW52b2ljZSA9IGFycmF5KCk7DQogICAgICAgICRkYXRhX2ludm9pY2VfY29udGFpbmVyID0gYXJyYXkoKTsNCg0KDQoNCiAgICAgICAgZm9yZWFjaCAoJGRhdGFfaXRlbXMgIGFzICR2YWwpIHsNCiAgICAgICAgICAgICRpZCAgICAgICAgICAgICAgICAgICAgID0gJHZhbC0+aWQ7DQogICAgICAgICAgICAkY29udGFpbmVyX2lkICAgICAgICAgICA9ICR2YWwtPmNvbnRhaW5lcl9pZDsNCiAgICAgICAgICAgICRjb250YWluZXJfbm8gICAgICAgICAgID0gJHZhbC0+Y29udGFpbmVyX25vOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9zaXplICAgICAgICAgPSAkdmFsLT5zaXplOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl90eXBlX2NvZGUgICAgPSAkdmFsLT50eXBlX2NvZGU7DQogICAgICAgICAgICAkY29udGFpbmVyX3R5cGVfaWQgICAgICA9ICR2YWwtPnR5cGVfaWQ7DQogICAgICAgICAgICAkY29udGFpbmVyX29wZXJhdGlvbl9jb2RlID0gJHZhbC0+b3BlcmF0aW9uX2NvZGU7DQogICAgICAgICAgICAkY29udGFpbmVyX29wZXJhdGlvbl9pZCA9ICR2YWwtPm9wZXJhdGlvbl9pZDsNCiAgICAgICAgICAgICRjb250YWluZXJfZnJlZV9kYXkgICAgID0gJHZhbC0+ZnJlZV9kYXk7DQogICAgICAgICAgICAkY29udGFpbmVyX2ludm9pY2VfZnJlZV9kYXkgICAgID0gJHZhbC0+aW52b2ljZV9mcmVlX2RheTsNCiAgICAgICAgICAgICRjb250YWluZXJfc3RhcnRfY291bnQgID0gJHZhbC0+c3RhcnRfY291bnQ7DQogICAgICAgICAgICAkY29udGFpbmVyX2xpbmVfY29kZSAgICA9ICR2YWwtPmxpbmVfY29kZTsNCiAgICAgICAgICAgICRjb250YWluZXJfbGluZV9uYW1lICAgID0gJHZhbC0+bGluZV9uYW1lOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9saW5lX2lkICAgICAgPSAkdmFsLT5saW5lX2lkOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl92ZXNzZWxfY29kZSAgPSAkdmFsLT52ZXNzZWxfY29kZTsNCiAgICAgICAgICAgICRjb250YWluZXJfdmVzc2VsX25hbWUgID0gJHZhbC0+dmVzc2VsX25hbWU7DQogICAgICAgICAgICAkY29udGFpbmVyX3Zlc3NlbF9pZCAgICA9ICR2YWwtPnZlc3NlbF9pZDsNCiAgICAgICAgICAgICRjb250YWluZXJfdm95X25vICAgICAgID0gJHZhbC0+dm95X25vOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9hcnJpdmVkX2RhdGUgPSAkdmFsLT5hcnJpdmVkX2RhdGU7DQogICAgICAgICAgICAkY29udGFpbmVyX2RlbXVycmFnZV9kYXk9ICR2YWwtPmRlbXVycmFnZV9kYXk7DQogICAgICAgICAgICAkY29udGFpbmVyX3N1YnRvdGFsX2JlZm9yZSA9ICR2YWwtPnN1YnRvdGFsX2JlZm9yZTsNCiAgICAgICAgICAgICRzdGFydF9kYXRlICAgICAgICAgICAgID0gJHZhbC0+c3RhcnRfZGF0ZTsNCiAgICAgICAgICAgICRjb250YWluZXJfY29zdHMgICAgICAgID0gJHZhbC0+Y29zdHM7DQogICAgICAgICAgICAkY29udGFpbmVyX3N1YnRvdGFsICAgICA9IDAuMDA7DQogICAgICAgICAgICAkY29udGFpbmVyX3N1YnRvdGFsX2R1ZSA9IDAuMDA7DQoNCiAgICAgICAgICAgIGlmKCFlbXB0eSgkaW52b2ljZV9pZCkpew0KICAgICAgICAgICAgICAgIC8vJHN0YXJ0X2RhdGUgPSAnJzsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgaWYgKGVtcHR5KCRzdGFydF9kYXRlKSkgew0KICAgICAgICAgICAgICAgICRzdGFydF9kYXRlID0gbnVsbDsNCiAgICAgICAgICAgIH1lbHNlew0KICAgICAgICAgICAgICAgICRzdGFydF9kYXRlID0gZGF0ZSgiWS1tLWQiLHN0cnRvdGltZShzdHJfcmVwbGFjZSgnLycsICctJywgJHN0YXJ0X2RhdGUpKSk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICRkYXRhX2Nvc3RzID0gYXJyYXkoKTsNCiAgICAgICAgICAgIGZvcmVhY2ggKCRjb250YWluZXJfY29zdHMgIGFzICR2YWxfY29zdCkgew0KDQogICAgICAgICAgICAgICAgJGNvc3RfZHVlID0gJHZhbF9jb3N0LT51bml0X2Nvc3QgKiAkdmFsX2Nvc3QtPmRlbXVycmFnZV9kYXk7DQogICAgICAgICAgICAgICAgJGNvbnRhaW5lcl9zdWJ0b3RhbF9kdWUgKz0gJGNvc3RfZHVlOw0KICAgICAgICAgICAgICAgICRpdGVtX2Nvc3RfYXJyYXkgPSBhcnJheSgNCiAgICAgICAgICAgICAgICAgICAgJ2RlbXVycmFnZV9kYXknID0+ICR2YWxfY29zdC0+ZGVtdXJyYWdlX2RheSwNCiAgICAgICAgICAgICAgICAgICAgJ3VuaXRfY29zdCcgICAgID0+ICR2YWxfY29zdC0+dW5pdF9jb3N0LA0KICAgICAgICAgICAgICAgICAgICAnc3VidG90YWxfZHVlJyAgPT4gJGNvc3RfZHVlDQogICAgICAgICAgICAgICAgKTsNCiAgICAgICAgICAgICAgICBhcnJheV9wdXNoKCRkYXRhX2Nvc3RzLCRpdGVtX2Nvc3RfYXJyYXkpOw0KICAgICAgICAgICAgfQ0KDQoNCiAgICAgICAgICAgICRjb250YWluZXJfc3VidG90YWwgPSAkY29udGFpbmVyX3N1YnRvdGFsX2JlZm9yZSArICRjb250YWluZXJfc3VidG90YWxfZHVlOw0KDQogICAgICAgICAgICAkaXNzdWVfdG90YWxfZHVlICs9ICRjb250YWluZXJfc3VidG90YWxfZHVlOw0KICAgICAgICAgICAgJGlzc3VlX3RvdGFsICs9ICRjb250YWluZXJfc3VidG90YWw7DQoNCiAgICAgICAgICAgICR0b3RhbF9pdGVtKys7DQoNCiAgICAgICAgICAgICRpdGVtX2NvbnRhaW5lcl9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICdpZCcgICAgICAgICAgICA9PiAkaWQsDQogICAgICAgICAgICAgICAgJ2NvbnRhaW5lcl9pZCcgID0+ICRjb250YWluZXJfaWQsDQogICAgICAgICAgICAgICAgJ2NvbnRhaW5lcl9ubycgID0+ICRjb250YWluZXJfbm8sDQogICAgICAgICAgICAgICAgJ3NpemUnICAgICAgICAgID0+ICRjb250YWluZXJfc2l6ZSwNCiAgICAgICAgICAgICAgICAndHlwZV9jb2RlJyAgICAgPT4gJGNvbnRhaW5lcl90eXBlX2NvZGUsDQogICAgICAgICAgICAgICAgJ3R5cGVfaWQnICAgICAgID0+ICRjb250YWluZXJfdHlwZV9pZCwNCiAgICAgICAgICAgICAgICAnb3BlcmF0aW9uX2NvZGUnPT4gJGNvbnRhaW5lcl9vcGVyYXRpb25fY29kZSwNCiAgICAgICAgICAgICAgICAnb3BlcmF0aW9uX2lkJyAgPT4gJGNvbnRhaW5lcl9vcGVyYXRpb25faWQsDQogICAgICAgICAgICAgICAgJ2xpbmVfaWQnICAgICAgID0+ICRjb250YWluZXJfbGluZV9pZCwNCiAgICAgICAgICAgICAgICAnbGluZV9jb2RlJyAgICAgPT4gJGNvbnRhaW5lcl9saW5lX2NvZGUsDQogICAgICAgICAgICAgICAgJ2xpbmVfbmFtZScgICAgID0+ICRjb250YWluZXJfbGluZV9uYW1lLA0KICAgICAgICAgICAgICAgICd2ZXNzZWxfaWQnICAgICA9PiAkY29udGFpbmVyX3Zlc3NlbF9pZCwNCiAgICAgICAgICAgICAgICAndmVzc2VsX25hbWUnICAgPT4gJGNvbnRhaW5lcl92ZXNzZWxfbmFtZSwNCiAgICAgICAgICAgICAgICAndmVzc2VsX2NvZGUnICAgPT4gJGNvbnRhaW5lcl92ZXNzZWxfY29kZSwNCiAgICAgICAgICAgICAgICAndm95X25vJyAgICAgICAgPT4gJGNvbnRhaW5lcl92b3lfbm8sDQogICAgICAgICAgICAgICAgJ3N0YXJ0X2RhdGUnICAgID0+ICRzdGFydF9kYXRlLA0KICAgICAgICAgICAgICAgICdhcnJpdmVkX2RhdGUnICA9PiAkY29udGFpbmVyX2Fycml2ZWRfZGF0ZSwNCiAgICAgICAgICAgICAgICAnZnJlZV9kYXknICAgICAgPT4gJGNvbnRhaW5lcl9mcmVlX2RheSwNCiAgICAgICAgICAgICAgICAnaW52b2ljZV9mcmVlX2RheSc9PiRjb250YWluZXJfaW52b2ljZV9mcmVlX2RheSwNCiAgICAgICAgICAgICAgICAnc3RhcnRfY291bnQnICAgPT4gJGNvbnRhaW5lcl9zdGFydF9jb3VudCwNCiAgICAgICAgICAgICAgICAnZGVtdXJyYWdlX2RheScgPT4gJGNvbnRhaW5lcl9kZW11cnJhZ2VfZGF5LA0KICAgICAgICAgICAgICAgICdjb3N0cycgICAgICAgICA9PiAkY29udGFpbmVyX2Nvc3RzLA0KICAgICAgICAgICAgICAgICdzdWJ0b3RhbCcgICAgICA9PiAkY29udGFpbmVyX3N1YnRvdGFsLA0KICAgICAgICAgICAgICAgICdzdWJ0b3RhbF9kdWUnICA9PiAkY29udGFpbmVyX3N1YnRvdGFsX2R1ZSwNCiAgICAgICAgICAgICAgICAnY3JlYXRlZCcgPT4gZGF0ZSgiWS1tLWQgSDppOnMiLCB0aW1lKCkpLA0KICAgICAgICAgICAgICAgICdjcmVhdGVkX2J5JyA9PiAkY3JlYXRlZF9ieQ0KICAgICAgICAgICAgKTsNCg0KICAgICAgICAgICAgYXJyYXlfcHVzaCgkZGF0YV9pbnZvaWNlX2NvbnRhaW5lciwkaXRlbV9jb250YWluZXJfYXJyYXkpOw0KDQogICAgICAgIH0NCg0KICAgICAgICAkdG90YWxfZHVlID0gJHRoaXMtPnJwcy0+Zm9ybWF0RGVjaW1hbCgkaXNzdWVfdG90YWxfZHVlLDQpOw0KICAgICAgICAkdG90YWwgPSAkdG90YWxfYmVmb3JlICsgJHRvdGFsX2R1ZTsNCg0KICAgICAgICAkZGF0YV9pbnZvaWNlID0gYXJyYXkoDQogICAgICAgICAgICAnaW52b2ljZV9pZCcgICAgPT4gJGludm9pY2VfaWQsDQogICAgICAgICAgICAnaW52b2ljZV9ubycgICAgPT4gJGludm9pY2Vfbm8sDQogICAgICAgICAgICAnY29udGFjdF9uYW1lJyAgPT4gJGNvbnRhY3RfbmFtZSwNCiAgICAgICAgICAgICdjb250YWN0X2lkJyAgICA9PiAkY29udGFjdF9pZCwNCiAgICAgICAgICAgICdjb21wYW55X25hbWUnICA9PiAkY29tcGFueV9uYW1lLA0KICAgICAgICAgICAgJ2NvbXBhbnlfaWQnICAgID0+ICRjb21wYW55X2lkLA0KICAgICAgICAgICAgJ2xpbmVfaWQnICAgICAgID0+ICRsaW5lX2lkLA0KICAgICAgICAgICAgJ2xpbmVfY29kZScgICAgID0+ICRsaW5lX2NvZGUsDQogICAgICAgICAgICAnbGluZV9uYW1lJyAgICAgPT4gJGxpbmVfbmFtZSwNCiAgICAgICAgICAgICd2ZXNzZWxfaWQnICAgICA9PiAkdmVzc2VsX2lkLA0KICAgICAgICAgICAgJ3Zlc3NlbF9jb2RlJyAgID0+ICR2ZXNzZWxfY29kZSwNCiAgICAgICAgICAgICd2ZXNzZWxfbmFtZScgICA9PiAkdmVzc2VsX25hbWUsDQogICAgICAgICAgICAndm95X25vJyAgICAgICAgPT4gJHZveV9ubywNCiAgICAgICAgICAgICdhcnJpdmVkX2RhdGUnICA9PiAkYXJyaXZlZF9kYXRlLA0KICAgICAgICAgICAgJ3BvcnRlZF9kYXRlJyAgID0+ICRwb3J0ZWRfZGF0ZSwNCiAgICAgICAgICAgICd0b3RhbF9pdGVtJyAgICA9PiAkdG90YWxfaXRlbSwNCiAgICAgICAgICAgICdpc3N1ZV90b3RhbCcgICA9PiAkaXNzdWVfdG90YWwsDQogICAgICAgICAgICAnaXNzdWVfdG90YWxfZHVlJz0+ICRpc3N1ZV90b3RhbF9kdWUsDQogICAgICAgICAgICAndG90YWxfZHVlJyAgICAgPT4gJHRvdGFsX2R1ZSwNCiAgICAgICAgICAgICd0b3RhbCcgICAgICAgICA9PiAkdG90YWwsDQogICAgICAgICAgICAnY3JlYXRlZCcgICAgICAgPT4gZGF0ZSgiWS1tLWQgSDppOnMiLCB0aW1lKCkpLA0KICAgICAgICAgICAgJ2NyZWF0ZWRfYnknICAgID0+ICRjcmVhdGVkX2J5DQogICAgICAgICk7DQoNCg0KDQogICAgICAgIGlmKCFlbXB0eSgkaW52b2ljZV9pZCkpew0KICAgICAgICAgICAgJGlzX3VwZGF0ZSA9ICR0aGlzLT5pbnZvaWNlX21kLT51cGRhdGUoJGRhdGFfaW52b2ljZSwkZGF0YV9pbnZvaWNlX2NvbnRhaW5lcik7DQogICAgICAgICAgICBpZigkaXNfdXBkYXRlKXsNCiAgICAgICAgICAgICAgICAvL1VwZGF0ZSBSZWZlcmVuY2UNCiAgICAgICAgICAgICAgICAvKiRjdXJyZW50X3llYXIgPSBkYXRlKCdZJyk7DQogICAgICAgICAgICAgICAgJHJvd19yZWYgPSAgJHRoaXMtPmludm9pY2VfcmVmX21kLT5pc19leGlzdGVkKCRsaW5lX2lkLCRjdXJyZW50X3llYXIpOw0KICAgICAgICAgICAgICAgIGlmKCRyb3dfcmVmKXsNCiAgICAgICAgICAgICAgICAgICAgJHRoaXMtPmludm9pY2VfcmVmX21kLT5pbmNyZWFzZSgkbGluZV9pZCwkY3VycmVudF95ZWFyKTsNCiAgICAgICAgICAgICAgICB9ZWxzZXsNCiAgICAgICAgICAgICAgICAgICAgJHRoaXMtPmludm9pY2VfcmVmX21kLT5zYXZlKCRsaW5lX2lkLCRjdXJyZW50X3llYXIsIDEpOw0KICAgICAgICAgICAgICAgIH0qLw0KDQogICAgICAgICAgICAgICAgJGRhdGFfcmVzcG9uZFsnc3RhdHVzJ10gPSAxOw0KICAgICAgICAgICAgICAgICRkYXRhX3Jlc3BvbmRbJ2lzc3VlX2lkJ10gPSAkaXNfdXBkYXRlWydpc3N1ZV9pZCddOw0KICAgICAgICAgICAgICAgICRkYXRhX3Jlc3BvbmRbJ21lc3NhZ2VzJ10gPSAic3VjY2Vzc2Z1bCB0byBSZS1Jc3N1ZSBJbnZvaWNlIjsNCg0KICAgICAgICAgICAgfQ0KDQoNCiAgICAgICAgfWVsc2V7DQogICAgICAgICAgICAvLw0KDQogICAgICAgICAgICAkY3VycmVudF95ZWFyID0gZGF0ZSgnWScpOw0KICAgICAgICAgICAgJGlzX2V4aXN0ZWQgPSAkdGhpcy0+aW52b2ljZV9tZC0+aXNfZXhpc3RlZF9pbnZvb2ljZV9ubygkaW52b2ljZV9ubywkY3VycmVudF95ZWFyKTsNCiAgICAgICAgICAgIGlmKCRpc19leGlzdGVkKXsNCiAgICAgICAgICAgICAgICAkZGF0YV9yZXNwb25kWydzdGF0dXMnXSA9IDI7DQogICAgICAgICAgICAgICAgJGRhdGFfcmVzcG9uZFsnbWVzc2FnZXMnXSA9ICJFeGlzdGVkIEludm9pY2UgTm8iOw0KICAgICAgICAgICAgfWVsc2V7DQoNCiAgICAgICAgICAgICAgICAkaW52b2ljZV9pZCA9ICR0aGlzLT5pbnZvaWNlX21kLT5zYXZlKCRkYXRhX2ludm9pY2UsJGRhdGFfaW52b2ljZV9jb250YWluZXIpOw0KICAgICAgICAgICAgICAgIGlmKCRpbnZvaWNlX2lkKXsNCiAgICAgICAgICAgICAgICAgICAgLy9VcGRhdGUgUmVmZXJlbmNlDQogICAgICAgICAgICAgICAgICAgICRjdXJyZW50X3llYXIgPSBkYXRlKCdZJyk7DQogICAgICAgICAgICAgICAgICAgICRyb3dfcmVmID0gICR0aGlzLT5pbnZvaWNlX3JlZl9tZC0+aXNfZXhpc3RlZCgkbGluZV9pZCwkY3VycmVudF95ZWFyKTsNCiAgICAgICAgICAgICAgICAgICAgaWYoJHJvd19yZWYpew0KICAgICAgICAgICAgICAgICAgICAgICAgJHRoaXMtPmludm9pY2VfcmVmX21kLT5pbmNyZWFzZSgkbGluZV9pZCwkY3VycmVudF95ZWFyKTsNCiAgICAgICAgICAgICAgICAgICAgfWVsc2V7DQogICAgICAgICAgICAgICAgICAgICAgICAkdGhpcy0+aW52b2ljZV9yZWZfbWQtPnNhdmUoJGxpbmVfaWQsJGN1cnJlbnRfeWVhciwgMSk7DQogICAgICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgICAgICAkZGF0YV9yZXNwb25kWydzdGF0dXMnXSA9IDE7DQogICAgICAgICAgICAgICAgICAgICRkYXRhX3Jlc3BvbmRbJ2lzc3VlX2lkJ10gPSAkaW52b2ljZV9pZFsnaXNzdWVfaWQnXTsNCiAgICAgICAgICAgICAgICAgICAgJGRhdGFfcmVzcG9uZFsnbWVzc2FnZXMnXSA9ICJzdWNjZXNzZnVsIHRvIElzc3VlIEludm9pY2UiOw0KDQogICAgICAgICAgICAgICAgfQ0KDQoNCg0KICAgICAgICAgICAgfQ0KDQoNCg0KDQogICAgICAgIH0NCg0KDQoNCiAgICAgICAgZWNobyBqc29uX2VuY29kZSgkZGF0YV9yZXNwb25kKTsNCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gaW52b2ljZV9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U1JDX0IuJ3ZlbmRvcnMvY3VzdG9tL2RhdGF0YWJsZXMvZGF0YXRhYmxlcy5idW5kbGUuanMnLA0KICAgICAgICAgICAgU1JDX0pTX0IuJ2pxdWVyeS1kYXRlZm9ybWF0LmpzJywNCiAgICAgICAgICAgIFNSQ19KU19CLidjb3JlLmpzJywNCiAgICAgICAgICAgIFNSQ19KU19CLidhY2NvdW50aW5nLm1pbi5qcycsDQogICAgICAgICAgICBTUkNfSlNfQiAuICd0aW55bWNlL3RpbnltY2UubWluLmpzJywNCiAgICAgICAgICAgIFNSQ19KU19CIC4gJ3RpbnltY2Uvc2NyaXB0LmpzJywNCiAgICAgICAgICAgIFNSQ19KU19CLiAgJ3ByaW50VGhpcy5qcycNCiAgICAgICAgICAgIC8vU1JDX0cuJ3BsdWdpbnMvanF1ZXJ5LXVpL2pxdWVyeS11aS5taW4uanMnDQogICAgICAgICk7DQoNCiAgICAgICAgJGRhdGFbJ3NpdGVfdGl0bGUnXSA9ICdJbnZvaWNlIERlbXVycmFnZSc7DQogICAgICAgICRkYXRhWydmb3JtX2FjdGlvbiddID0gIkFkZCI7DQoNCg0KICAgICAgICAkcm93X2lzc3VlID0gJHRoaXMtPmludm9pY2VfaXNzdWVfbWQtPmdldCgkaWQpOw0KICAgICAgICBpZigkcm93X2lzc3VlKXsNCiAgICAgICAgICAgICRkYXRhWydyb3dfaXNzdWUnXSA9ICAkcm93X2lzc3VlOw0KICAgICAgICAgICAgJGxzdF9kZXRhaWwgPSAgJHRoaXMtPmludm9pY2VfaXNzdWVfZGV0YWlsX21kLT5nZXRfbGlzdCgkcm93X2lzc3VlWydpZCddLCIiKTsNCiAgICAgICAgICAgIC8vcHJpbnRfcigkbHN0X2RldGFpbCk7DQogICAgICAgICAgICBpZigkbHN0X2RldGFpbCl7DQogICAgICAgICAgICAgICAgJGRhdGFbJ2xzdF9kZXRhaWwnXT0gJGxzdF9kZXRhaWw7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgfQ0KDQo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KSB7DQogICAgICAgIGlmICgkdGhpcy0+dXNlcl9tZC0+ZGVsZXRlKCRpZCkpIHsNCiAgICAgICAgICAgIHJldHVybiB0cnVlOw0KICAgICAgICB9IGVsc2Ugew0KICAgICAgICAgICAgcmV0dXJuIGZhbHNlOw0KICAgICAgICB9DQogICAgfQ0KDQogICAgcHJvdGVjdGVkIGZ1bmN0aW9uIHNhdmUoJGRhdGEgPSBhcnJheSgpKSB7DQoNCiAgICB9DQoNCiAgICBwdWJsaWMgZnVuY3Rpb24gc2F2ZV9pbXBvcnRfZmlsZSgpIHsNCg0KDQoNCiAgICAgICAgJGF1dGhfdXNlciA9ICR0aGlzLT5hdXRoX21kLT5hdXRoX3VzZXIoKTsNCiAgICAgICAgJGNyZWF0ZWRfYnkgPSAkYXV0aF91c2VyWydpZCddOw0KICAgICAgICAkanNvbl9kYXRhID0gJHRoaXMtPmlucHV0LT5wb3N0KCdkYXRhJyk7DQogICAgICAgICRkYXRhX2VuY29kZSA9ICAkanNvbl9kYXRhOw0KICAgICAgICAvLyRkYXRhX2VuY29kZSA9IGpzb25fZGVjb2RlKCRqc29uX2RhdGEpOw0KDQogICAgICAgICRpdGVtX2NvbnRhaW5lciA9ICBhcnJheSgpOw0KICAgICAgICBmb3JlYWNoICgkZGF0YV9lbmNvZGUgYXMgJHZhbCkgew0KICAgICAgICAgICAgJGNvbnRhaW5lcl9pZCA9ICR2YWxbJ2lkJ107DQogICAgICAgICAgICAkY29udGFpbmVyX25vID0gJHZhbFsnY29udGFpbmVyX25vJ107DQogICAgICAgICAgICAkY29udGlhbmVyX3NpemUgPSAkdmFsWydzaXplJ107DQogICAgICAgICAgICAkY29udGFpbmVyX3R5cGUgPSAkdmFsWyd0eXBlJ107DQogICAgICAgICAgICAkY29udGlhbmVyX3R5cGVfaWQgPSAkdmFsWyd0eXBlX2lkJ107DQogICAgICAgICAgICAkY29udGFpbmVyX29wZXJhdGlvbiA9ICR2YWxbJ29wZXJhdGlvbiddOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9vcGVyYXRpb25faWQgPSAkdmFsWydvcGVyYXRpb25faWQnXTsNCiAgICAgICAgICAgICRjb250YWluZXJfbGluZSA9ICR2YWxbJ2xpbmUnXTsNCiAgICAgICAgICAgICRjb250YWluZXJfbGluZV9pZD0wOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl92ZXNzZWwgPSAkdmFsWyd2ZXNzZWwnXTsNCiAgICAgICAgICAgICRjb250YWluZXJfdm95X25vID0gJHZhbFsndm95X25vJ107DQogICAgICAgICAgICAkY29udGFpbmVyX2Fycml2ZWRfZGF0ZSA9ICR2YWxbJ2Fycml2ZWRfZGF0ZSddOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9pbnZvaWNlX2xpbmUgPSAkdmFsWydpbnZvaWNlX2xpbmUnXTsNCiAgICAgICAgICAgICRjb250YWluZXJfb3BfZnJlZV9kYXkgPSAkdmFsWydvcF9mcmVlX2RheSddOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9vcF9zdGFydF9jb3VudCA9ICR2YWxbJ29wX3N0YXJ0X2NvdW50J107DQogICAgICAgICAgICAkY29udGFpbmVyX29wX3N0YXR1cyA9ICR2YWxbJ29wX3N0YXR1cyddOw0KICAgICAgICAgICAgJGNvbnRhaW5lcl9pbnZvaWNlX2xpbmVfaWQ9MDsNCg0KDQoNCiAgICAgICAgICAgIGlmKCFlbXB0eSgkY29udGFpbmVyX2lkKSl7DQoNCiAgICAgICAgICAgIH1lbHNlew0KICAgICAgICAgICAgICAgICRpdGVtX2NvbnRhaW5lcl9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAnY29udGFpbmVyX25vJyA9PiAkY29udGFpbmVyX25vLA0KICAgICAgICAgICAgICAgICAgICAnc2l6ZScgPT4gJGNvbnRpYW5lcl9zaXplLA0KICAgICAgICAgICAgICAgICAgICAndHlwZV9uYW1lJyA9PiAkY29udGFpbmVyX3R5cGUsDQogICAgICAgICAgICAgICAgICAgICdyZWZfdHlwZV9pZCcgPT4gJGNvbnRpYW5lcl90eXBlX2lkLA0KICAgICAgICAgICAgICAgICAgICAnb3BlcmF0aW9uX25hbWUnID0+ICRjb250YWluZXJfb3BlcmF0aW9uLA0KICAgICAgICAgICAgICAgICAgICAncmVmX29wX2lkJyA9PiAkY29udGFpbmVyX29wZXJhdGlvbl9pZCwNCiAgICAgICAgICAgICAgICAgICAgJ2xpbmVfY29kZScgPT4gJGNvbnRhaW5lcl9saW5lLA0KICAgICAgICAgICAgICAgICAgICAncmVmX2xpbmVfaWQnID0+ICRjb250YWluZXJfbGluZV9pZCwNCiAgICAgICAgICAgICAgICAgICAgJ2ludm9pY2VfbGluZV9jb2RlJyA9PiAkY29udGFpbmVyX2ludm9pY2VfbGluZSwNCiAgICAgICAgICAgICAgICAgICAgJ3JlZl9pbnZvaWNlX2xpbmVfaWQnID0+ICRjb250YWluZXJfaW52b2ljZV9saW5lX2lkLA0KICAgICAgICAgICAgICAgICAgICAndmVzc2VsX25hbWUnID0+ICRjb250YWluZXJfdmVzc2VsLA0KICAgICAgICAgICAgICAgICAgICAndm95X25vJyA9PiAkY29udGFpbmVyX3ZveV9ubywNCiAgICAgICAgICAgICAgICAgICAgJ2Fycml2ZWRfZGF0ZScgPT4gJGNvbnRhaW5lcl9hcnJpdmVkX2RhdGUsDQogICAgICAgICAgICAgICAgICAgICdvcF9mcmVlX2RheSc9PiRjb250YWluZXJfb3BfZnJlZV9kYXksDQogICAgICAgICAgICAgICAgICAgICdvcF9zdGFydF9jb3VudCc9PiRjb250YWluZXJfb3Bfc3RhcnRfY291bnQsDQogICAgICAgICAgICAgICAgICAgICdvcF9zdGF0dXMnPT4kY29udGFpbmVyX29wX3N0YXR1cywNCiAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWQnID0+IGRhdGUoIlktbS1kIEg6aTpzIiwgdGltZSgpKSwNCiAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWRfYnknID0+ICRjcmVhdGVkX2J5DQogIC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gICAvLyRkYXRhWydhYmMnXSA9ICR0ZXJtLiI7bGluZToiLiRsaW5lX2lkLicrdmVzc2VsX2lkOicuJHZlc3NlbF9pZC4nKyB2b3lubzonLiR2b3lfbm8uJysgYXJyaXZlZF9kYXRlOicuJGFycml2ZWRfZGF0ZTsNCg0KDQogICAgICAgICAgICAkbHN0X2NvbnRhaW5lciA9ICR0aGlzLT5jb250YWluZXJfbWQtPmdldF9saXN0X3NlYXJjaCgkdGVybSwgIiIsIiIsJGxpbmVfaWQsJHZlc3NlbF9pZCwkdm95X25vLCRhcnJpdmVkX2RhdGUsJGludm9pY2VfaWQsIDUpOw0KDQogICAgICAgICAgICBpZigkbHN0X2NvbnRhaW5lcil7DQogICAgICAgICAgICAgICAgZm9yZWFjaCgkbHN0X2NvbnRhaW5lciBhcyAkdmFsX2NvbnRhaW5lcil7DQoNCiAgICAgICAgICAgICAgICAgICAgJGZyZWVfZGF5ID0gMDsNCiAgICAgICAgICAgICAgICAgICAgJHN0YXJ0X2NvdW50ID0gMDsNCiAgICAgICAgICAgICAgICAgICAgJHVuaXRfY29zdCA9IDA7DQogICAgICAgICAgICAgICAgICAgICRyb3dfb3BlcmF0aW9uID0gJHRoaXMtPmNvbnRhaW5lcl9vcGVyYXRpb25fbWQtPmdldCgkdmFsX2NvbnRhaW5lclsncmVmX29wX2lkJ10pOw0KICAgICAgICAgICAgICAgICAgICAkZGF0YV9yYXRlID0gYXJyYXkoKTsNCiAgICAgICAgICAgICAgICAgICAgaWYoJHJvd19vcGVyYXRpb24pew0KICAgICAgICAgICAgICAgICAgICAgICAgJGZyZWVfZGF5ID0gJHJvd19vcGVyYXRpb25bJ2ZyZWVfZGF5J107DQogICAgICAgICAgICAgICAgICAgICAgICAkc3RhcnRfY291bnQgPSAkcm93X29wZXJhdGlvblsnc3RhcnRfY291bnQnXTsNCg0KICAgICAgICAgICAgICAgICAgICAgICAgJGxzdF9yYXRlID0gJHRoaXMtPmNvbnRhaW5lcl9vcF9yYXRlX21kLT5nZXRfbGlzdF9ieV9vcHR5cGUoJHZhbF9jb250YWluZXJbJ3JlZl9vcF9pZCddLCR2YWxfY29udGFpbmVyWydyZWZfdHlwZV9pZCddKTsNCiAgICAgICAgICAgICAgICAgICAgICAgIGlmKCRsc3RfcmF0ZSl7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yZWFjaCgkbHN0X3JhdGUgYXMgJHZhbF9yYXRlKXsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJGRhdGFfcmF0ZV9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNpemVfMjAiICAgPT4gICR2YWxfcmF0ZVsic2l6ZV8yMCJdLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNpemVfNDAiICAgPT4gICR2YWxfcmF0ZVsic2l6ZV80MCJdLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgInNpemVfNDUiICAgPT4gICR2YWxfcmF0ZVsic2l6ZV80NSJdLA0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgImZyb21fZGF5IiAgPT4gICR2YWxfcmF0ZVsiZnJvbV9kYXkiXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICJ0b19kYXkiICAgID0+ICAkdmFsX3JhdGVbInRvX2RheSJdDQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICk7DQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFycmF5X3B1c2goJGRhdGFfcmF0ZSwkZGF0YV9yYXRlX2FycmF5KTsNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICAgICAgJGRhdGFfYXJyYXkgPSBhcnJheSgNCiAgICAgICAgICAgICAgICAgICAgICAgICJpZCIgICAgICAgICAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWydpbnZvaWNlX2NvbnRhaW5lcl9pZCddLA0KICAgICAgICAgICAgICAgICAgICAgICAgImNvbnRhaW5lcl9pZCIgICAgICA9PiAgJHZhbF9jb250YWluZXJbJ2lkJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAiY29udGFpbmVyX25vIiAgICAgID0+ICAkdmFsX2NvbnRhaW5lclsnY29udGFpbmVyX25vJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAic2l6ZSIgICAgICAgICAgICAgID0+ICAkdmFsX2NvbnRhaW5lclsnc2l6ZSddLA0KICAgICAgICAgICAgICAgICAgICAgICAgInR5cGVfY29kZSIgICAgICAgICA9PiAgJHZhbF9jb250YWluZXJbJ3R5cGVfY29kZSddLA0KICAgICAgICAgICAgICAgICAgICAgICAgInR5cGVfaWQiICAgICAgICAgICA9PiAgJHZhbF9jb250YWluZXJbJ3JlZl90eXBlX2lkJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAib3BlcmF0aW9uX2NvZGUiICAgID0+ICAkdmFsX2NvbnRhaW5lclsnb3BlcmF0aW9uX2NvZGUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJmcmVlX2RheSIgICAgICAgICAgPT4gICRmcmVlX2RheSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJpbnZvaWNlX2ZyZWVfZGF5IiAgICA9PiAgJHZhbF9jb250YWluZXJbJ2ZyZWVfZGF5J10sDQogICAgICAgICAgICAgICAgICAgICAgICAic3RhcnRfY291bnQiICAgICAgID0+ICAkc3RhcnRfY291bnQsDQogICAgICAgICAgICAgICAgICAgICAgICAidW5pdF9jb3N0IiAgICAgICAgID0+ICAkdW5pdF9jb3N0LA0KICAgICAgICAgICAgICAgICAgICAgICAgInJhdGVzIiAgICAgICAgICAgICA9PiAgJGRhdGFfcmF0ZSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJvcGVyYXRpb25faWQiICAgICAgPT4gICR2YWxfY29udGFpbmVyWydyZWZfb3BfaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJsaW5lX2NvZGUiICAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWydsaW5lX2NvZGUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJsaW5lX25hbWUiICAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWydsaW5lX25hbWUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJsaW5lX2lkIiAgICAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWydyZWZfbGluZV9pZCddLA0KICAgICAgICAgICAgICAgICAgICAgICAgImludm9pY2VfbGluZV9jb2RlIiA9PiAgJHZhbF9jb250YWluZXJbJ2ludm9pY2VfbGluZV9jb2RlJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAiaW52b2ljZV9saW5lX25hbWUiID0+ICAkdmFsX2NvbnRhaW5lclsnaW52b2ljZV9saW5lX25hbWUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJpbnZvaWNlX2xpbmVfaWQiICAgPT4gICR2YWxfY29udGFpbmVyWydyZWZfaW52b2ljZV9saW5lX2lkJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAidmVzc2VsX25hbWUiICAgICAgID0+ICAkdmFsX2NvbnRhaW5lclsndmVzc2VsX25hbWUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJ2ZXNzZWxfY29kZSIgICAgICAgPT4gICR2YWxfY29udGFpbmVyWyd2ZXNzZWxfY29kZSddLA0KICAgICAgICAgICAgICAgICAgICAgICAgInZlc3NlbF9pZCIgICAgICAgICA9PiAgJHZhbF9jb250YWluZXJbJ3JlZl92ZXNzZWxfaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJ2b3lfbm8iICAgICAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWyd2b3lfbm8nXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJhcnJpdmVkX2RhdGUiICAgICAgPT4gICR2YWxfY29udGFpbmVyWydhcnJpdmVkX2RhdGUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJ0b3RhbCIgICAgICAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWyd0b3RhbCddLA0KICAgICAgICAgICAgICAgICAgICAgICAgInRvdGFsX2R1ZSIgICAgICAgICA9PiAgJHZhbF9jb250YWluZXJbJ3RvdGFsX2R1ZSddLA0KICAgICAgICAgICAgICAgICAgICAgICAgImludm9pY2Vfc3RhdHVzIiAgICA9PiAgJHZhbF9jb250YWluZXJbJ2ludm9pY2Vfc3RhdHVzJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAiaW52b2ljZV9pZCIgICAgICAgID0+ICAkdmFsX2NvbnRhaW5lclsncmVmX2ludm9pY2VfaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJpbnZvaWNlX25vIiAgICAgICAgPT4gICR2YWxfY29udGFpbmVyWydpbnZvaWNlX25vJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAiaW52b2ljZV90b3RhbCIgICAgID0+ICR2YWxfY29udGFpbmVyWydpbnZvaWNlX3RvdGFsJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAiaW52b2ljZV90b3RhbF9kdWUiICAgICA9PiAkdmFsX2NvbnRhaW5lclsnaW52b2ljZV90b3RhbF9kdWUnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICJwb3J0ZWRfZGF0ZSIgICAgICAgPT4gICR2YWxfY29udGFpbmVyWydwb3J0ZWRfZGF0ZSddLA0KICAgICAgICAgICAgICAgICAgICAgICAgImNyZWF0ZWQiICAgICAgICAgICA9PiAgJHZhbF9jb250YWluZXJbJ2NyZWF0ZWQnXSwNCiAgICAgICAgICAgICAgICAgICAgICAgICk7DQogICAgICAgICAgICAgICAgICAgIGFycmF5X3B1c2goJGRhdGFfa2V5c19hcnJheSwgJGRhdGFfYXJyYXkpOw0KDQogICAgICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAgICAgJGRhdGFbJ3N0YXR1cyddID0gMTsNCiAgICAgICAgICAgICAgICA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ICApOw0KDQogICAgICAgICRrZXl3b3JkID0gJHRoaXMtPmlucHV0LT5wb3N0KCJxIik7DQogICAgICAgICRkYXRhID0gYXJyYXkoKTsNCg0KICAgICAgICBpZighZW1wdHkoJGtleXdvcmQpKXsNCiAgICAgICAgICAgICRsc3RfY29udGFjdCA9ICR0aGlzLT5jb250YWN0X21kLT5nZXRfbGlzdCgka2V5d29yZCwgMTApOw0KICAgICAgICAgICAgaWYoJGxzdF9jb250YWN0KXsNCiAgICAgICAgICAgICAgICBmb3JlYWNoKCRsc3RfY29udGFjdCBhcyAkdmFsX2NvbnRhY3Qpew0KICAgICAgICAgICAgICAgICAgICAkZGF0YV9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAgICAgImlkIiA9PiAkdmFsX2NvbnRhY3RbJ2lkJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAiZnVsbF9uYW1lIj0+ICR2YWxfY29udGFjdFsnZnVsbF9uYW1lJ10sDQogICAgICAgICAgICAgICAgICAgICAgICAidmFsdWUiPT4gJHZhbF9jb250YWN0WydmdWxsX25hbWUnXQ0KICAgICAgICAgICAgICAgICAgICApOw0KICAgICAgICAgICAgICAgICAgICBhcnJheV9wdXNoKCRkYXRhLCRkYXRhX2FycmF5KTsNCg0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH0NCg0KICAgICAgICB9DQoNCiAgICAgICAgZWNobyBqc29uX2VuY29kZSgkZGF0YSk7DQoNCiAgICB9DQoNCg0KICAgIGZ1bmN0aW9uIGFwaV9jb21wYW55X2xzdCgpew0KDQoNCg0KICAgICAgICAka2V5d29yZCA9ICR0aGlzLT5pbnB1dC0+cG9zdCgicSIpOw0KICAgICAgICAkZGF0YSA9IGFycmF5KCk7DQoNCiAgICAgICAgaWYoIWVtcHR5KCRrZXl3b3JkKSl7DQogICAgICAgICAgICAkbHN0X2NvbXBhbnkgPSAkdGhpcy0+Y29tcGFueV9tZC0+Z2V0X2xpc3QoJGtleXdvcmQsIDEwKTsNCiAgICAgICAgICAgIGlmKCRsc3RfY29tcGFueSl7DQogICAgICAgICAgICAgICAgZm9yZWFjaCgkbHN0X2NvbXBhbnkgYXMgJHZhbF9jb21wYW55KXsNCiAgICAgICAgICAgICAgICAgICAgJGRhdGFfYXJyYXkgPSBhcnJheSgNCiAgICAgICAgICAgICAgICAgICAgICAgICJpZCIgPT4gJHZhbF9jb21wYW55WydpZCddLA0KICAgICAgICAgICAgICAgICAgICAgICAgImNvbXBhbnlfbmFtZSI9PiAkdmFsX2NvbXBhbnlbJ2NvbXBhbnlfbmFtZSddLA0KICAgICAgICAgICAgICAgICAgICAgICAgInZhbHVlIj0+ICR2YWxfY29tcGFueVsnY29tcGFueV9uYW1lJ10NCiAgICAgICAgICAgICAgICAgICAgKTsNCiAgICAgICAgICAgICAgICAgICAgYXJyYXlfcHVzaCgkZGF0YSwkZGF0YV9hcnJheSk7DQoNCiAgICAgICAgICAgICAgICB9DQogICAgICAgICAgICB9DQoNCiAgICAgICAgfQ0KDQogICAgICAgIGVjaG8ganNvbl9lbmNvZGUoJGRhdGEpOw0KDQogICAgfQ0KDQoNCiAgICBmdW5jdGlvbiBhcGlfbHN0KCl7DQoNCiAgICAgICAgJGRyYXcgPSBpbnR2YWwoJHRoaXMtPmlucHV0LT5wb3N0KCJkcmF3IikpOw0KICAgICAgICAkc3RhcnQgPSBpbnR2YWwoJHRoaXMtPmlucHV0LT5wb3N0KCJzdGFydCIpKTsNCiAgICAgICAgJGxlbmd0aCA9IGludHZhbCgkdGhpcy0+aW5wdXQtPnBvc3QoImxlbmd0aCIpKTsNCiAgICAgICAgJGRhdGFfc2VhcmNoID0gJHRoaXMtPmlucHV0LT5wb3N0KCJzZWFyY2giKTsNCiAgICAgICAgJGNvbHVtbnMgPSAkdGhpcy0+aW5wdXQtPnBvc3QoJ2NvbHVtbnMnKTsNCiAgICAgICAgJGtleXdvcmQgPSAkY29sdW1uc1swXVsnc2VhcmNoJ11bJ3ZhbHVlJ107Ly8k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gQ291bnRgJyk7DQogICAgICAgICRvYmpDb3VudCA9ICRxdWVyeS0+cmVzdWx0X2FycmF5KCk7DQogICAgICAgICR0b3RhbHJlcyA9ICRvYmpDb3VudFswXVsnQ291bnQnXTsNCg0KDQoNCiAgICAgICAgLy8kcGFnZSA9ICRzdGFydC8kbGVuZ3RoICsgMTsNCiAgICAgICAgLy8kYmlsID0gKCRwYWdlIC0gMSkgKiAkbGVuZ3RoICsgMTsNCg0KICAgICAgICAvL3ByaW50X3IoJGxzdF9pc3N1ZSk7DQogICAgICAgIC8vcmV0dXJuOw0KDQoNCiAgICAgICAgJGRhdGFfaXNzdWVzID0gIGFycmF5KCk7DQogICAgICAgIGlmKCRsc3RfaXNzdWUpew0KICAgICAgICAgICAgZm9yZWFjaCgkbHN0X2lzc3VlIGFzICR2YWxfaXNzdWUpew0KICAgICAgICAgICAgICAgICRpc3N1ZV9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAnaWQnICAgICAgICAgICAgPT4gICR2YWxfaXNzdWVbJ2lkJ10sDQogICAgICAgICAgICAgICAgICAgICdpbnZvaWNlX25vJyAgICA9PiAgJHZhbF9pc3N1ZVsnaW52b2ljZV9ubyddLA0KICAgICAgICAgICAgICAgICAgICAnaW52b2ljZV9pZCcgICAgPT4gICR2YWxfaXNzdWVbJ3JlZl9pbnZvaWNlX2lkJ10sDQogICAgICAgICAgICAgICAgICAgICdjb21wYW55X25hbWUnICA9PiAgJHZhbF9pc3N1ZVsnY29tcGFueV9uYW1lJ10sDQogICAgICAgICAgICAgICAgICAgICdjb21wYW55X2lkJyAgICA9PiAgJHZhbF9pc3N1ZVsncmVmX2NvbXBhbnlfaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2xpbmVfaWQnICAgICAgID0+ICAkdmFsX2lzc3VlWydyZWZfbGluZV9pZCddLA0KICAgICAgICAgICAgICAgICAgICAnbGluZV9uYW1lJyAgICAgPT4gICR2YWxfaXNzdWVbJ2xpbmVfbmFtZSddLA0KICAgICAgICAgICAgICAgICAgICAnbGluZV9jb2RlJyAgICAgPT4gICR2YWxfaXNzdWVbJ2xpbmVfY29kZSddLA0KICAgICAgICAgICAgICAgICAgICAndmVzc2VsX25hbWUnICAgPT4gICR2YWxfaXNzdWVbJ3Zlc3NlbF9uYW1lJ10sDQogICAgICAgICAgICAgICAgICAgICd2ZXNzZWxfY29kZScgICA9PiAgJHZhbF9pc3N1ZVsndmVzc2VsX2NvZGUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ3Zlc3NlbF9pZCcgICAgID0+ICAkdmFsX2lzc3VlWydyZWZfdmVzc2VsX2lkJ10sDQogICAgICAgICAgICAgICAgICAgICd2b3lfbm8nICAgICAgICA9PiAgJHZhbF9pc3N1ZVsndm95X25vJ10sDQogICAgICAgICAgICAgICAgICAgICdjb250YWN0X25hbWUnICA9PiAgJHZhbF9pc3N1ZVsnY29udGFjdF9uYW1lJ10sDQogICAgICAgICAgICAgICAgICAgICdjb250YWN0X2lkJyAgICA9PiAgJHZhbF9pc3N1ZVsncmVmX2NvbnRhY3RfaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2Fycml2ZWRfZGF0ZScgID0+ICAkdmFsX2lzc3VlWydhcnJpdmVkX2RhdGUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ3BvcnRlZF9kYXRlJyAgID0+ICAkdmFsX2lzc3VlWydwb3J0X2RhdGUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ3RvdGFsX2l0ZW0nICAgID0+ICAkdmFsX2lzc3VlWyd0b3RhbF9pdGVtJ10sDQogICAgICAgICAgICAgICAgICAgICd0b3RhbCcgICAgICAgICA9PiAgJHZhbF9pc3N1ZVsndG90YWwnXSwNCiAgICAgICAgICAgICAgICAgICAgJ3RvdGFsX2R1ZScgICAgID0+ICAkdmFsX2lzc3VlWyd0b3RhbF9kdWUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2ludm9pY2VfdG90YWwnID0+ICAkdmFsX2lzc3VlWydpbnZvaWNlX3RvdGFsJ10sDQogICAgICAgICAgICAgICAgICAgICdpbnZvaWNlX3RvdGFsX2R1ZSc9PiAgJHZhbF9pc3N1ZVsnaW52b2ljZV90b3RhbF9kdWUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ3BheW1lbnRfc3RhdHVzJz0+ICAkdmFsX2lzc3VlWydwYXltZW50X3N0YXR1cyddLA0KICAgICAgICAgICAgICAgICAgICAnZGVzY3JpcHRpb24nICAgPT4gICR2YWxfaXNzdWVbJ2Rlc2NyaXB0aW9uJ10sDQogICAgICAgICAgICAgICAgICAgICdvcmRlcmluZycgICAgICA9PiAgJHZhbF9pc3N1ZVsnb3JkZXJpbmcnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWQnICAgICAgID0+ICAkdmFsX2lzc3VlWydjcmVhdGVkJ10sDQogICAgICAgICAgICAgICAgICAgICdjcmVhdGVkX2J5JyAgICA9PiAgJHZhbF9pc3N1ZVsnY3JlYXRlZF9ieSddLA0KICAgICAgICAgICAgICAgICAgICAnbW9kaWZpZWQnICAgICAgPT4gICR2YWxfaXNzdWVbJ21vZGlmaWVkJ10sDQogICAgICAgICAgICAgICAgICAgICdtb2RpZmllZF9ieScgICA9PiAgJHZhbF9pc3N1ZVsnbW9kaWZpZWRfYnknXSwNCiAgICAgICAgICAgICAgICAgICAgJ0FjdGlvbnMnICAgICAgID0+ICAnJyk7DQoNCiAgICAgICAgICAgICAgICBhcnJheV9wdXNoKCRkYXRhX2lzc3VlcywgJGlzc3VlX2FycmF5KTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICB9DQoNCg0KDQogICAgICAgICRkYXRhID0gYXJyYXkoDQogICAgICAgICAgICAiZHJhdyIgICAgICAgICAgICAgICAgICA9PiBpbnR2YWwoJGRyYXcpLA0KICAgICAgICAgICAgImlUb3RhbFJlY29yZHMiICAgICAgICAgPT4gJHRvdGFscmVzLA0KICAgICAgICAgICAgImlUb3RhbERpc3BsYXlSZWNvc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gJHZhbF90eXBlKXsNCiAgICAgICAgICAgICAgICAkdHlwZV9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAnaWQnICAgICAgICAgICAgPT4gICR2YWxfdHlwZVsnaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2NvZGUnICAgICAgICAgID0+ICAkdmFsX3R5cGVbJ2NvZGUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWQnICAgICAgID0+ICAkdmFsX3R5cGVbJ2NyZWF0ZWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2NyZWF0ZWRfYnknICAgID0+ICAkdmFsX3R5cGVbJ2NyZWF0ZWRfYnknXSwNCiAgICAgICAgICAgICAgICAgICAgJ21vZGlmaWVkJyAgICAgID0+ICAkdmFsX3R5cGVbJ21vZGlmaWVkJ10sDQogICAgICAgICAgICAgICAgICAgICdtb2RpZmllZF9ieScgICA9PiAgJHZhbF90eXBlWydtb2RpZmllZF9ieSddDQogICAgICAgICAgICAgICAgKTsNCg0KICAgICAgICAgICAgICAgIGFycmF5X3B1c2goJGRhdGFfdHlwZXMsJHR5cGVfYXJyYXkpOw0KICAgICAgICAgICAgfQ0KDQogICAgICAgIH0NCg0KDQogICAgICAgICRkYXRhID0gYXJyYXkoDQogICAgICAgICAgICAndG90YWxfY291bnQnICAgPT4gICR0b3RhbHJlcywNCiAgICAgICAgICAgICdpdGVtcycgICAgICAgICA9PiAgJGRhdGFfdHlwZXMNCiAgICAgICAgKTsNCg0KDQogICAgICAgIGVjaG8ganNvbl9lbmNvZGUoJGRhdGEpOw0KICAgIH0NCg0KDQogICAgZnVuY3Rpb24gYXBpX29wZXJhdGlvbl9sc3QoKXsNCg0KDQogICAgICAgICRrZXl3b3JkID0gJHRoaXMtPmlucHV0LT5wb3N0KCJxIik7DQogICAgICAgICRwYWdlID0gJHRoaXMtPmlucHV0LT5wb3N0KCJwYWdlIik7DQogICAgICAgICRzdGFydCA9IGludHZhbCgkdGhpcy0+aW5wdXQtPnBvc3QoInBhZ2UiKSk7DQogICAgICAgICRsZW5ndGggPSAzMDsNCg0KICAgICAgICAkbHN0X29wZXJhdGlvbiA9ICR0aGlzLT5jb250YWluZXJfb3BlcmF0aW9uX21kLT5nZXRfbGlzdCgka2V5d29yZCwiIiwkbGVuZ3RoLCAkc3RhcnQpOw0KICAgICAgICAkcXVlcnkgPSAkdGhpcy0+ZGItPnF1ZXJ5KCdTRUxFQ1QgRk9VTkRfUk9XUygpIEFTIGBDb3VudGAnKTsNCiAgICAgICAgJG9iakNvdW50ID0gJHF1ZXJ5LT5yZXN1bHRfYXJyYXkoKTsNCiAgICAgICAgJHRvdGFscmVzID0gJG9iakNvdW50WzBdWydDb3VudCddOw0KDQogICAgICAgIC8vJHBhZ2UgPSAkc3RhcnQvJGxlbmd0aCArIDE7DQogICAgICAgIC8vJGJpbCA9ICgkcGFnZSAtIDEpICogJGxlbmd0aCArIDE7DQoNCg0KICAgICAgICAkZGF0YV9vcGVyYXRpb25zID0gIGFycmF5KCk7DQogICAgICAgIGlmKCRsc3Rfb3BlcmF0aW9uKXsNCiAgICAgICAgICAgIGZvcmVhY2goJGxzdF9vcGVyYXRpb24gYXMgJHZhbF9vcGVyYXRpb24pew0KICAgICAgICAgICAgICAgICRvcGVyYXRpb25fYXJyYXkgPSBhcnJheSgNCiAgICAgICAgICAgICAgICAgICAgJ2lkJyAgICAgICAgICAgID0+ICAkdmFsX29wZXJhdGlvblsnaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2NvZGUnICAgICAgICAgID0+ICAkdmFsX29wZXJhdGlvblsnY29kZSddLA0KICAgICAgICAgICAgICAgICAgICAnY3JlYXRlZCcgICAgICAgPT4gICR2YWxfb3BlcmF0aW9uWydjcmVhdGVkJ10sDQogICAgICAgICAgICAgICAgICAgICdjcmVhdGVkX2J5JyAgICA9PiAgJHZhbF9vcGVyYXRpb25bJ2NyZWF0ZWRfYnknXSwNCiAgICAgICAgICAgICAgICAgICAgJ21vZGlmaWVkJyAgICAgID0+ICAkdmFsX29wZXJhdGlvblsnbW9kaWZpZWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ21vZGlmaWVkX2J5JyAgID0+ICAkdmFsX29wZXJhdGlvblsnbW9kaWZpZWRfYnknXQ0KICAgICAgICAgICAgICAgICk7DQoNCiAgICAgICAgICAgICAgICBhcnJheV9wdXNoKCRkYXRhX29wZXJhdGlvbnMsJG9wZXJhdGlvbl9hcnJheSk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgfQ0KDQoNCiAgICAgICAgJGRhdGEgPSBhcnJheSgNCiAgICAgICAgICAgICd0b3RhbF9jb3VudCcgICA9PiAgJHRvdGFscmVzLA0KICAgICAgICAgICAgJ2l0ZW1zJyAgICAgICAgID0+ICAkZGF0YV9vcGVyYXRpb25zDQogICAgICAgICk7DQoNCg0KICAgICAgICBlY2hvIGpzb25fZW5jb2RlKCRkYXRhKTsNCiAgICB9DQoNCg0KICAgIGZ1bmN0aW9uIGFwaV9saW5lKCl7DQogICAgICAgICRsaW5lX2lkID0gJHRoaXMtPmlucHV0LT5wb3N0KCJpZCIpOw0KICAgICAgICAkcm93X2xpbmUgPSAkdGhpcy0+bGluZV9tZC0+Z2V0KCRsaW5lX2lkKTsNCiAgICAgICAgJGRhdGFbJ3N0YXR1cyddID0gMDsNCiAgICAgICAgaWYoJHJvd19saW5lKXsNCiAgICAgICAgICAgICRkYXRhWydzdGF0dXMnXSA9IDE7DQoNCiAgICAgICAgICAgICRjdXJyZW50X3llYXIgPSBkYXRlKCdZJyk7DQoNCiAgICAgICAgICAgICRyZWZlcmVuY2UgPSAkcm93X2xpbmVbJ2NvZGUnXS5zcHJpbnRmKCIlMDRzIiwgMSk7DQogICAgICAgICAgICAkcm93X3JlZiA9ICAkdGhpcy0+aW52b2ljZV9yZWZfbWQtPmlzX2V4aXN0ZWQoJHJvd19saW5lWydpZCddLCRjdXJyZW50X3llYXIpOw0KICAgICAgICAgICAgaWYoJHJvd19yZWYpew0KICAgICAgICAgICAgICAgICRyZWZlcmVuY2UgPSAkcm93X2xpbmVbJ2NvZGUnXS5zcHJpbnRmKCIlMDRzIiwgKCRyb3dfcmVmWydyZWZlcmVuY2UnXSArIDEpKTsNCiAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgJGxpbmVfYXJyYXkgPSBhcnJheSgNCiAgICAgICAgICAgICAgICAnaWQnICAgICAgICAgICAgPT4gICRyb3dfbGluZVsnaWQnXSwNCiAgICAgICAgICAgICAgICAnY29kZScgICAgICAgICAgPT4gICRyb3dfbGluZVsnY29kZSddLA0KICAgICAgICAgICAgICAgICduYW1lJyAgICAgICAgICA9PiAgJHJvd19saW5lWyduYW1lJ10sDQogICAgICAgICAgICAgICAgJ3JlZmVyZW5jZScgICAgID0+ICAkcmVmZXJlbmNlLA0KICAgICAgICAgICAgICAgICdjcmVhdGVkJyAgICAgICA9PiAgJHJvd19saW5lWydjcmVhdGVkJ10sDQogICAgICAgICAgICAgICAgJ2NyZWF0ZWRfYnknICAgID0+ICAkcm93X2xpbmVbJ2NyZWF0ZWRfYnknXSwNCiAgICAgICAgICAgICAgICAnbW9kaWZpZWQnICAgICAgPT4gICRyb3dfbGluZVsnbW9kaWZpZWQnXSwNCiAgICAgICAgICAgICAgICAnbW9kaWZpZWRfYnknICAgPT4gICRyb3dfbGluZVsnbW9kaWZpZWRfYnknXQ0KICAgICAgICAgICAgKTsNCiAgICAgICAgICAgICRkYXRhWydkYXRhJ10gPSAkbGluZV9hcnJheTsNCg0KICAgICAgICB9DQoNCiAgICAgICAgZWNobyBqc29uX2VuY29kZSgkZGF0YSk7DQogICAgfQ0KDQoNCiAgICBmdW5jdGlvbiBhcGlfbGluZV9sc3QoKXsNCg0KDQogICAgICAgICRrZXl3b3JkID0gJHRoaXMtPmlucHV0LT5wb3N0KCJxIik7DQogICAgICAgICRwYWdlID0gJHRoaXMtPmlucHV0LT5wb3N0KCJwYWdlIik7DQogICAgICAgICRzdGFydCA9IGludHZhbCgkdGh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Q0KDQoNCiAgICAgICAgICAgICAgICAkbGluZV9hcnJheSA9IGFycmF5KA0KICAgICAgICAgICAgICAgICAgICAnaWQnICAgICAgICAgICAgPT4gICR2YWxfbGluZVsnaWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ2NvZGUnICAgICAgICAgID0+ICAkdmFsX2xpbmVbJ2NvZGUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ25hbWUnICAgICAgICAgID0+ICAkdmFsX2xpbmVbJ25hbWUnXSwNCiAgICAgICAgICAgICAgICAgICAgJ3JlZmVyZW5jZScgICAgID0+ICAkcmVmZXJlbmNlLA0KICAgICAgICAgICAgICAgICAgICAnY3JlYXRlZCcgICAgICAgPT4gICR2YWxfbGluZVsnY3JlYXRlZCddLA0KICAgICAgICAgICAgICAgICAgICAnY3JlYXRlZF9ieScgICAgPT4gICR2YWxfbGluZVsnY3JlYXRlZF9ieSddLA0KICAgICAgICAgICAgICAgICAgICAnbW9kaWZpZWQnICAgICAgPT4gICR2YWxfbGluZVsnbW9kaWZpZWQnXSwNCiAgICAgICAgICAgICAgICAgICAgJ21vZGlmaWVkX2J5JyAgID0+ICAkdmFsX2xpbmVbJ21vZGlmaWVkX2J5J10NCiAgICAgICAgICAgICAgICApOw0KDQogICAgICAgICAgICAgICAgYXJyYXlfcHVzaCgkZGF0YV9saW5lcywkbGluZV9hcnJheSk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgfQ0KDQoNCiAgICAgICAgJGRhdGEgPSBhcnJheSgNCiAgICAgICAgICAgICd0b3RhbF9jb3VudCcgICA9PiAgJHRvdGFscmVzLA0KICAgICAgICAgICAgJ2l0ZW1zJyAgICAgICAgID0+ICAkZGF0YV9saW5lcw0KICAgICAgICApOw0KDQoNCiAgICAgICAgZWNobyBqc29uX2VuY29kZSgkZGF0YSk7DQogICAgfQ0KDQoNCg0KDQogICAgZnVuY3Rpb24gYXBpX3Zlc3NlbCgpew0KDQogICAgICAgICR2ZXNzZWxfaWQgPSAkdGhpcy0+aW5wdXQtPnBvc3QoImlkIik7DQogICAgICAgICRyb3dfdmVzc2VsID0gJHRoaXMtPnZlc3NlbF9tZC0+Z2V0KCR2ZXNzZWxfaWQpOw0KICAgICAgICAkZGF0YVsnc3RhdHVzJ10gPSAwOw0KICAgICAgICBpZigkcm93X3Zlc3NlbCl7DQogICAgICAgICAgICAkZGF0YVsnc3RhdHVzJ10gPSAxOw0KDQogICAgICAgICAgICAkdmVzc2VsX2FycmF5ID0gYXJyYXkoDQogICAgICAgICAgICAgICAgJ2lkJyAgICAgICAgICAgID0+ICAkcm93X3Zlc3NlbFsnaWQnXSwNCiAgICAgICAgICAgICAgICAnY29kZScgICAgICAgICAgPT4gICRyb3dfdmVzc2VsWydjb2RlJ10sDQogICAgICAgICAgICAgICAgJ25hbWUnICAgICAgICAgID0+ICAkcm93X3Zlc3NlbFsnbmFtZSddLA0KICAgICAgICAgICAgICAgICdjcmVhdGVkJyAgICAgICA9PiAgJHJvd192ZXNzZWxbJ2NyZWF0ZWQnXSwNCiAgICAgICAgICAgICAgICAnY3JlYXRlZF9ieScgICAgPT4gICRyb3dfdmVzc2VsWydjcmVhdGVkX2J5J10sDQogICAgICAgICAgICAgICAgJ21vZGlmaWVkJyAgICAgID0+ICAkcm93X3Zlc3NlbFsnbW9kaWZpZWQnXSwNCiAgICAgICAgICAgICAgICAnbW9kaWZpZWRfYnknICAgPT4gICRyb3dfdmVzc2VsWydtb2RpZmllZF9ieSddDQogICAgICAgICAgICApOw0KICAgICAgICAgICAgJGRhdGFbJ2RhdGEnXSA9ICR2ZXNzZWxfYXJyYXk7DQoNCiAgICAgICAgfQ0KDQogICAgICAgIGVjaG8ganNvbl9lbmNvZGUoJGRhdGEpOw0KICAgIH0NCg0KDQoNCiAgICBmdW5jdGlvbiBhcGlfdmVzc2VsX2xzdCgpew0KDQoNCiAgICAgICAgJGtleXdvcmQgPSAkdGhpcy0+aW5wdXQtPnBvc3QoInEiKTsNCiAgICAgICAgJHBhZ2UgPSA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iAgICAgICAgICAgICAgICAnaWQnLA0KICAgICAgICAgICAgICAgICdjb250YWluZXJfbm8nLA0KICAgICAgICAgICAgICAgICdzaXplJywNCiAgICAgICAgICAgICAgICAndHlwZScsDQogICAgICAgICAgICAgICAgJ3R5cGVfaWQnLA0KICAgICAgICAgICAgICAgICdvcGVyYXRpb24nLA0KICAgICAgICAgICAgICAgICdvcGVyYXRpb25faWQnLA0KICAgICAgICAgICAgICAgICdsaW5lJywNCiAgICAgICAgICAgICAgICAndmVzc2VsJywNCiAgICAgICAgICAgICAgICAndm95X25vJywNCiAgICAgICAgICAgICAgICAnYXJyaXZlZF9kYXRlJywNCiAgICAgICAgICAgICAgICAnaW52b2ljZV9saW5lJywNCiAgICAgICAgICAgICAgICAnb3BfZnJlZV9kYXknLA0KICAgICAgICAgICAgICAgICdvcF9zdGFydF9jb3VudCcsDQogICAgICAgICAgICAgICAgJ29wX3N0YXR1cycpOw0KDQogICAgICAgICAgICAkaiA9IDE7DQoNCiAgICAgICAgICAgICRuX3R5cGUgPSBhcnJheSgibmV3Ij0+MCwiZXhpc3QiPT4wKTsNCiAgICAgICAgICAgICRuX29wZXJhdGlvbiA9IGFycmF5KCJuZXciPT4wLCJleGlzdCI9PjApOw0KICAgICAgICAgICAgJG5fbGluZSA9IGFycmF5KCJuZXciPT4wLCJleGlzdCI9PjApOw0KICAgICAgICAgICAgJG5fdmVzc2VsID0gYXJyYXkoIm5ldyI9PjAsImV4aXN0Ij0+MCk7DQogICAgICAgICAgICAkbl90b3RhbCA9IGFycmF5KCJuZXciPT4wLCJleGlzdCI9PjApOw0KDQogICAgICAgICAgICBmb3IgKCRpID0gMjsgJGkgPD0gJG1heFJvdzsgJGkrKykgew0KDQogICAgICAgICAgICAgICAgJGNlbGxfY29udGFpbmVyX25vID0gJG9ialdvcmtzaGVldC0+Z2V0Q2VsbEJ5Q29sdW1uQW5kUm93KDAsICRpKTsNCiAgICAgICAgICAgICAgICAkY2VsbF9zaXplID0gJG9ialdvcmt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NCg0KICAgICAgICAgICAgICAgICRjb250YWluZXJfbm8gPSAkY2VsbF9jb250YWluZXJfbm8tPmdldFZhbHVlKCk7DQogICAgICAgICAgICAgICAgJHNpemUgPSAkY2VsbF9zaXplLT5nZXRWYWx1ZSgpOw0KICAgICAgICAgICAgICAgICR0eXBlID0gJGNlbGxfdHlwZS0+Z2V0VmFsdWUoKTsNCiAgICAgICAgICAgICAgICAkb3BlcmF0aW9uID0gJGNlbGxfb3AtPmdldFZhbHVlKCk7DQogICAgICAgICAgICAgICAgJGxpbmUgPSAkY2VsbF9saW5lLT5nZXRWYWx1ZSgpOw0KICAgICAgICAgICAgICAgICR2ZXNzZWwgPSAkY2VsbF92ZXNzZWwtPmdldFZhbHVlKCk7DQogICAgICAgICAgICAgICAgJHZveV9ubyA9ICRjZWxsX3ZveV9uby0+Z2V0VmFsdWUoKTsNCiAgICAgICAgICAgICAgICAkYXJyaXZlZF9kYXRlID0gIGRhdGUoJ1ktbS1kJyxQSFBFeGNlbF9TaGFyZWRfRGF0ZTo6RXhjZWxUb1BIUCgkY2VsbF9hcnJpdmVkX2RhdGUtPmdldFZhbHVlKCkpKTsNCiAgICAgICAgICAgICAgICAkaW52b2ljZV9saW5lID0gJGNlbGxfaW52b2ljZV9saW5lLT5nZXRWYWx1ZSgpOw0KICAgICAgICAgICAgICAgICRvcF9mcmVlX2RheSA9ICRjZWxsX29wX2ZyZWVfZGF5LT5nZXRWYWx1ZSgpOw0KICAgICAgICAgICAgICAgICRvcF9zdGFydF9jb3VudCA9ICRjZWxsX29wX3N0YXJ0X2NvdW50LT5nZXRWYWx1ZSgpOw0KICAgICAgICAgICAgICAgICRvcF9zdGF0dXMgPSAkY2VsbF9vcF9zdGF0dXMtPmdldFZhbHVlKCk7DQoNCg0KICAgICAgICAgICAgICAgICR0eXBlX2lkID0gMDsNCiAgICAgICAgICAgICAgICAkb3BlcmF0aW9uX2lkID0gMDsNCiAgICAgICAgICAgICAgICAkaWQgPSAwOw0KDQogICAgICAgICAgICAgICAgJHJvdyA9ICR0aGlzLT5jb250YWluZXJfbWQtPmlzX2V4aXN0ZWQoJGNvbnRhaW5lcl9ubywkYXJyaXZlZF9kYXRlKTsNCiAgICAgICAgICAgICAgICBpZigkcm93KXsNCiAgICAgICAgICAgICAgICAgICAgJGlkID0gJHJvd1snaWQnXTsNCiAgICAgICAgICAgICAgICAgICAgJG5fdG90YWxbJ2V4aXN0J10rKzsNCiAgICAgICAgICAgICAgICB9ZWxzZXsNCiAgICAgICAgICAgICAgICAgICAgJG5fdG90YWxbJ25ldyddKys7DQogICAgICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAgICAgJHJvd190eXBlID0gJHRoaXMtPmNvbnRhaW5lcl90eXBlX21kLT5pc19leGlzdGVkKCR0eXBlKTsNCiAgICAgICAgICAgICAgICBpZigkcm93X3R5cGUpew0KICAgICAgICAgICAgICAgICAgICAkdHlwZV9pZCA9ICAkcm93X3R5cGVbJ2lkJ107DQogICAgICAgICAgICAgICAgICAgICRuX3R5cGVbJ2V4aXN0J10rKzsNCg0KICAgICAgICAgICAgICAgIH1lbHNlew0KICAgICAgICAgICAgICAgICAgICAkbl90eXBlWyduZXcnXSsrOw0KICAgICAgICAgICAgICAgIH0NCg0KICAgICAgICAgICAgICAgICRyb3dfb3BlcmF0aW9uID0gJHRoaXMtPmNvbnRhaW5lcl9vcGVyYXRpb25fbWQtPmlzX2V4aXN0ZWQoJG9wZXJhdGlvbik7DQogICAgICAgICAgICAgICAgaWYoJHJvd19vcGVyYXRpb24pew0KICAgICAgICAgICAgICAgICAgICAkb3BlcmF0aW9uX2lkID0gJHJvd19vcGVyYXRpb25bJ2lkJ107DQogICAgICAgICAgICAgICAgICAgICRuX29wZXJhdGlvblsnZXhpc3QnXSsrOw0KICAgICAgICAgICAgICAgIH1lbHNlew0KICAgICAgICAgICAgICAgICAgICAkbl9vcGVyYXRpb25bJ25ldyddKys7DQogICAgICAgICAgICAgICAgfQ0KDQogICAgICAgICAgICAgICAgJHZhbHVlID0gYXJyYXkoDQogICAgICAgICAgICAgICAgICAgICRqKyssDQogICAgICAgICAgICAgICAgICAgICRpZCwNCiAgICAgICAgICAgICAgICAgICAgJGNvbnRhaW5lcl9ubywNCiAgICAgICAgICAgICAgICAgICAgJHNpemUsDQogICAgICAgICAgICAgICAgICAgICR0eXBlLA0KICAgICAgICAgICAgICAgICAgICAkdHlwZV9pZCwNCiAgICAgICAgICAgICAgICAgICAgJG9wZXJhdGlvbiwNCiAgICAgICAgICAgICAgICAgICAgJG9wZXJhdGlvbl9pZCwNCiAgICAgICAgICAgICAgICAgICAgJGxpbmUsDQogICAgICAgICAgICAgICAgICAgICR2ZXNzZWwsDQogICAgICAgICAgICAgICAgICAgICR2b3lfbm8sDQogICAgICAgICAgICAgICAgICAgICRhcnJpdmVkX2RhdGUsDQogICAgICAgICAgICAgICAgICAgICRpbnZvaWNlX2xpbmUsDQogICAgICAgICAgICAgICAgICAgICRvcF9mcmVlX2RheSwNCiAgICAgICAgICAgICAgICAgICAgJG9wX3N0YXJ0X2NvdW50LA0KICAgICAgICAgICAgICAgICAgICAkb3Bfc3RhdHVzDQogICAgICAgICAgICAgICAgKTsNCiAgICAgICAgICAgICAgICAkZmluYWxbXSA9IGFycmF5X2NvbWJpbmUoJGtleXMsICR2YWx1ZSk7DQogICAgICAgICAgICB9DQoNCiAgICAgICAgICAgICRuX2RhdGE9IGFycmF5KCJ0b3RhbCI9PiRuX3RvdGFsLCJ0eXBlIj0+JG5fdHlwZSwib3BlcmF0aW9uIj0+JG5fb3BlcmF0aW9uLCJsaW5lIj0+JG5fbGluZSwidmVzc2VsIj0+JG5fdmVzc2VsKTsNCg0KDQogICAgICAgICAgICBlY2hvIGpzb25fZW5jb2RlKGFycmF5KCdzdWNjZXNzJyA9PiB0cnVlLCAnZmlsZScgPT4gJHVwbG9hZGVyLT5nZXRGaWxlTmFtZSgpLCAnZGF0YScgPT4gICRmaW5hbCwnbl9kYXRhJz0+JG5fZGF0YSkpOw0KICAgICAgICB9DQogICAgfQ0KDQoNCiAgICBwcm90ZWN0ZWQgZnVuY3Rpb24gZG9fdXBsb2FkKCRwYXRoLCAkZmllbGRfbmFtZSwgJGZpbGVuYW1lID0gIiIpIHsNCiAgICAgICAgJHRoaXMtPmxvYWQtPmxpYnJhcnkoJ3VwbG9hZCcpOw0KICAgICAgICAkY29uZmlnWyd1cGxvYWRfcGF0aCddID0gJHBhdGg7DQogICAgICAgICRjb25maWdbJ2FsbG93ZWRfdHlwZXMnXSA9ICd4bHN8eGxzeCc7DQogICAgICAgICRjb25maWdbJ21heF9zaXplJ10gPSAxMDI0ICogMjsNCiAgICAgICAgLy8kY29uZmlnWydyZW1vdmVfc3BhY2VzJ10gPSBUUlVFOw0KICAgICAgICAvLyRjb25maWdbJ21heF93aWR0aCddID0gJzEyMCc7DQogICAgICAgIC8vJGNvbmZpZ1snbWF4X2hlaWdodCddID0gJzEyMCc7DQogICAgICAgIGlmICghZW1wdHkoJGZpbGVuYW1lKSkgew0KICAgICAgICAgICAgaWYgKGZpbGVfZXhpc3RzKCRwYXRoIC4gJGZpbGVuYW1lKSkgew0KICAgICAgICAgICAgICAgICRjb25maWdbJ2ZpbGVfbmFtZSddID0gJGZpbGVuYW1lIC4gJ18xMjNfJyAuIHJhbmQoMTAsIDk5KTsNCiAgICAgICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAgICAgJGNvbmZpZ1snZmlsZV9uYW1lJ10gPSAkZmlsZW5hbWU7DQogICAgICAgICAgICB9DQogICAgICAgIH0NCg0KDQogICAgICAgICR0aGlzLT51cGxvYWQtPmluaXRpYWxpemUoJGNvbmZpZyk7DQogICAgICAgICRkYXRhID0gYXJyYXkoKTsNCiAgICAgICAgaWYgKCEkdGhpcy0+dXBsb2FkLT5kb191cGxvYWQoJGZpZWxkX25hbWUpKSB7DQogICAgICAgICAgICAkZGF0YVsnc3RhdHVzJ10gPSBmYWxzZTsNCiAgICAgICAgICAgICRkYXRhWydkYXRhJ10gPSAkdGhpcy0+dXBsb2FkLT5kaXNwbGF5X2Vycm9ycygpOw0KDQogICAgICAgICAgICByZXR1cm4gJGRhdGE7DQogICAgICAgIH0gZWxzZSB7DQogICAgICAgICAgICAkZGF0YVsnc3RhdHVzJ10gPSB0cnVlOw0KICAgICAgICAgICAgJGRhdGFbJ2RhdGEnXSA9ICR0aGlzLT51cGxvYWQtPmRhdGEoKTsNCg0KICAgICAgICAgICAgLy8kdGhpcy0+dGh1bWJuYWlsX2ltZygxMjUsIDk0LCAkZGF0YVsnZGF0YSddKTsNCiAgICAgICAgICAgIHJldHVybiAkZGF0YTsNCiAgICAgICAgfQ0KICAgIH0NCn0NCg0KPz4=")); ?>

Function Calls

defined 1
base64_decode 1

Variables

None

Stats

MD5 5cb545a5fc8cac00df321f30597140d5
Eval Count 1
Decode Time 2100 ms